From 60e9cae20c936945bd3f33993881b76e0591c0f0 Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 13:44:34 -0400 Subject: [PATCH 01/20] Adds a placeholder for goMaker --- go.work | 14 +++++++------- src/dev_tools/goMaker/.gitignore | 1 + src/dev_tools/goMaker/go.mod | 7 +++++++ src/dev_tools/goMaker/go.sum | 2 ++ 4 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 src/dev_tools/goMaker/.gitignore create mode 100644 src/dev_tools/goMaker/go.mod create mode 100644 src/dev_tools/goMaker/go.sum diff --git a/go.work b/go.work index 97372958b4..77bf63a962 100644 --- a/go.work +++ b/go.work @@ -1,10 +1,10 @@ // Go Version go 1.22 -use ./src/apps/chifra - -use ./src/examples/usesSDK - -use ./sdk/go - -use ./src/dev_tools/sdkTester +use ( + ./sdk/go + ./src/apps/chifra + ./src/dev_tools/goMaker + ./src/dev_tools/sdkTester + ./src/examples/usesSDK +) diff --git a/src/dev_tools/goMaker/.gitignore b/src/dev_tools/goMaker/.gitignore new file mode 100644 index 0000000000..ba2906d066 --- /dev/null +++ b/src/dev_tools/goMaker/.gitignore @@ -0,0 +1 @@ +main diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod new file mode 100644 index 0000000000..5b0f3b0a12 --- /dev/null +++ b/src/dev_tools/goMaker/go.mod @@ -0,0 +1,7 @@ +module github.com/TrueBlocks/trueblocks-core/goMaker + +go 1.22 + +replace github.com/TrueBlocks/trueblocks-core/v0/sdk => ../sdk + +require github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum new file mode 100644 index 0000000000..cf31734198 --- /dev/null +++ b/src/dev_tools/goMaker/go.sum @@ -0,0 +1,2 @@ +github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a h1:RYfmiM0zluBJOiPDJseKLEN4BapJ42uSi9SZBQ2YyiA= +github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a/go.mod h1:5YoVOkjYAQumqlV356Hj3xeYh4BdZuLE0/nRkf2NKkI= From 1b07c99143bfdcf0b6a1707296f45ce51df72e49 Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 14:01:04 -0400 Subject: [PATCH 02/20] Removes unused code --- bin/.gitignore | 1 + .../classDefinitions/classdefinition.txt | 6 ----- .../classDefinitions/commandoption.txt | 6 ----- .../fields/classdefinition.csv | 25 ------------------- .../classDefinitions/fields/commandoption.csv | 22 ---------------- .../classDefinitions/fields/member.csv | 15 ----------- .../makeClass/classDefinitions/member.txt | 8 ------ .../classDefinitions/fields/measure.csv | 14 ----------- .../classDefinitions/fields/testcase.csv | 17 ------------- .../testRunner/classDefinitions/measure.txt | 6 ----- .../testRunner/classDefinitions/testcase.txt | 8 ------ 11 files changed, 1 insertion(+), 127 deletions(-) delete mode 100644 src/dev_tools/makeClass/classDefinitions/classdefinition.txt delete mode 100644 src/dev_tools/makeClass/classDefinitions/commandoption.txt delete mode 100644 src/dev_tools/makeClass/classDefinitions/fields/classdefinition.csv delete mode 100644 src/dev_tools/makeClass/classDefinitions/fields/commandoption.csv delete mode 100644 src/dev_tools/makeClass/classDefinitions/fields/member.csv delete mode 100644 src/dev_tools/makeClass/classDefinitions/member.txt delete mode 100644 src/dev_tools/testRunner/classDefinitions/fields/measure.csv delete mode 100644 src/dev_tools/testRunner/classDefinitions/fields/testcase.csv delete mode 100644 src/dev_tools/testRunner/classDefinitions/measure.txt delete mode 100644 src/dev_tools/testRunner/classDefinitions/testcase.txt diff --git a/bin/.gitignore b/bin/.gitignore index 9b515137ea..5daa58e7f8 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1,3 +1,4 @@ +goMaker sdkTester old examples diff --git a/src/dev_tools/makeClass/classDefinitions/classdefinition.txt b/src/dev_tools/makeClass/classDefinitions/classdefinition.txt deleted file mode 100644 index 2bf97ebe53..0000000000 --- a/src/dev_tools/makeClass/classDefinitions/classdefinition.txt +++ /dev/null @@ -1,6 +0,0 @@ -[settings] -class = CClassDefinition -fields = classdefinition.csv -includes = utillib.h|member.h -# doc_route = 00-no_doc -# go_output = src/dev_tools/makeClass diff --git a/src/dev_tools/makeClass/classDefinitions/commandoption.txt b/src/dev_tools/makeClass/classDefinitions/commandoption.txt deleted file mode 100644 index ab64eb2a86..0000000000 --- a/src/dev_tools/makeClass/classDefinitions/commandoption.txt +++ /dev/null @@ -1,6 +0,0 @@ -[settings] -class = CCommandOption -fields = commandoption.csv -includes = utillib.h -# doc_route = 00-no_doc -# go_output = src/dev_tools/makeClass diff --git a/src/dev_tools/makeClass/classDefinitions/fields/classdefinition.csv b/src/dev_tools/makeClass/classDefinitions/fields/classdefinition.csv deleted file mode 100644 index 57d3e9e1bc..0000000000 --- a/src/dev_tools/makeClass/classDefinitions/fields/classdefinition.csv +++ /dev/null @@ -1,25 +0,0 @@ -name ,type ,strDefault ,omitempty ,doc ,description -short_fn ,string , , , , -input_path ,string , , , , -class_name ,string , , , , -class_base ,string , , , , -class_upper ,string , , , , -base_class ,string , , , , -base_name ,string , , , , -base_proper ,string , , , , -base_lower ,string , , , , -base_upper ,string , , , , -base_base ,string , , , , -go_model ,string , , , , -display_str ,string , , , , -fieldArray ,[]Member , , , , -extraArray ,[]Member , , , , -contained_by ,string , , , , -doc_group ,string , , , , -doc_order ,string , , , , -doc_descr ,string , , , , -doc_route ,string , , , , -doc_alias ,string , , , , -doc_producer ,string , , , , -go_output ,string , , , , -disabled ,bool , , , , diff --git a/src/dev_tools/makeClass/classDefinitions/fields/commandoption.csv b/src/dev_tools/makeClass/classDefinitions/fields/commandoption.csv deleted file mode 100644 index bc5ff1ac07..0000000000 --- a/src/dev_tools/makeClass/classDefinitions/fields/commandoption.csv +++ /dev/null @@ -1,22 +0,0 @@ -name ,type ,strDefault ,omitempty ,doc ,description -num ,string , , , , -group ,string , , , , -api_group ,string , , , , -api_route ,string , , , , -tool ,string , , , , -longName ,string , , , , -hotKey ,string , , , , -def_val ,string , , , , -is_required ,bool , , , , -is_customizable ,bool , , , , -is_visible ,bool , , , , -is_visible_docs ,bool , , , , -generate ,string , , , , -option_type ,string , , , , -data_type ,string , , , , -real_type ,string , , , , -go_intype ,string , , , , -go_flagtype ,string , , , , -summary ,string , , , , -capabilities ,string , , , , -description ,string , , , , diff --git a/src/dev_tools/makeClass/classDefinitions/fields/member.csv b/src/dev_tools/makeClass/classDefinitions/fields/member.csv deleted file mode 100644 index 366399fada..0000000000 --- a/src/dev_tools/makeClass/classDefinitions/fields/member.csv +++ /dev/null @@ -1,15 +0,0 @@ -name ,type ,strDefault ,omitempty ,doc ,description -type ,string , ,true , , -name ,string , ,true , , -strDefault ,string , ,true , , -value ,string , ,true , , -indexed ,bool , ,true , , -internalType ,string , ,true , , -components ,[]Member , ,true , , -memberFlags ,uint64 ,IS_ENABLED ,true , , -precision ,uint64 ,5 ,true , , -maxWidth ,uint64 ,NOPOS ,true , , -doc ,uint64 , ,true , , -disp ,uint64 , ,true , , -example ,string , ,true , , -description ,string , ,true , , diff --git a/src/dev_tools/makeClass/classDefinitions/member.txt b/src/dev_tools/makeClass/classDefinitions/member.txt deleted file mode 100644 index c35c341f18..0000000000 --- a/src/dev_tools/makeClass/classDefinitions/member.txt +++ /dev/null @@ -1,8 +0,0 @@ -[settings] -class = CMember -fields = member.csv -includes = utillib.h -sort = v1.name < v2.name -equals = name == it.name -# doc_route = 00-no_doc -# go_output = src/dev_tools/makeClass diff --git a/src/dev_tools/testRunner/classDefinitions/fields/measure.csv b/src/dev_tools/testRunner/classDefinitions/fields/measure.csv deleted file mode 100644 index c8fb1bd13f..0000000000 --- a/src/dev_tools/testRunner/classDefinitions/fields/measure.csv +++ /dev/null @@ -1,14 +0,0 @@ -name ,type ,strDefault ,omitempty ,doc ,description -git_hash ,string , , , , -date ,string , , , , -machine ,string , , , , -node ,string , , , , -chain ,string , , , , -epoch ,string , , , , -group ,string , , , , -cmd ,string , , , , -type ,string , , , , -nTests ,uint64 , , , , -nPassed ,uint64 , , , , -totSecs ,double , , , , -avgSecs ,double , , , , diff --git a/src/dev_tools/testRunner/classDefinitions/fields/testcase.csv b/src/dev_tools/testRunner/classDefinitions/fields/testcase.csv deleted file mode 100644 index 885e771324..0000000000 --- a/src/dev_tools/testRunner/classDefinitions/fields/testcase.csv +++ /dev/null @@ -1,17 +0,0 @@ -name ,type ,strDefault ,omitempty ,doc ,description -origLine ,string , , , , -builtin ,bool , ,true , , -onOff ,string , , , , -mode ,string , , , , -speed ,string , , , , -route ,string , , , , -tool ,string , , , , -name ,string , , , , -post ,string , , , , -options ,string , , , , -path ,string , , , , -goldPath ,string , , , , -workPath ,string , , , , -fileName ,string , , , , -test_id ,uint32 , , , , -isCmd ,bool , , , , diff --git a/src/dev_tools/testRunner/classDefinitions/measure.txt b/src/dev_tools/testRunner/classDefinitions/measure.txt deleted file mode 100644 index bc4ef9887a..0000000000 --- a/src/dev_tools/testRunner/classDefinitions/measure.txt +++ /dev/null @@ -1,6 +0,0 @@ -[settings] -class = CMeasure -fields = measure.csv -includes = utillib.h -# doc_route = 00-no_doc -# go_output = src/dev_tools/testRunner diff --git a/src/dev_tools/testRunner/classDefinitions/testcase.txt b/src/dev_tools/testRunner/classDefinitions/testcase.txt deleted file mode 100644 index 82755e5920..0000000000 --- a/src/dev_tools/testRunner/classDefinitions/testcase.txt +++ /dev/null @@ -1,8 +0,0 @@ -[settings] -class = CTestCase -fields = testcase.csv -includes = utillib.h -equals = (route % it.route && tool % it.tool && name % it.name) -sort = v1.test_id < v2.test_id -# doc_route = 00-no_doc -# go_output = src/dev_tools/testRunner From 3fa25a2e41961679fe884041cad53293f62d946a Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 14:01:47 -0400 Subject: [PATCH 03/20] Adds goMaker to the build --- src/CMakeLists.txt | 1 + src/dev_tools/CMakeLists.txt | 1 + src/dev_tools/goMaker/CMakeLists.txt | 5 +++++ src/dev_tools/goMaker/main.go | 15 +++++++++++++++ 4 files changed, 22 insertions(+) create mode 100644 src/dev_tools/goMaker/CMakeLists.txt create mode 100644 src/dev_tools/goMaker/main.go diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 743a1a9240..fee8d84007 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -69,6 +69,7 @@ add_custom_target(lint COMMAND "golangci-lint" "run" WORKING_DIRECTORY "${CMAKE_ add_custom_target(format COMMAND "${BIN_DIR}/makeClass" "--format" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") add_custom_target(options COMMAND "${BIN_DIR}/makeClass" "--options --openapi" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") add_custom_target(generate COMMAND "${BIN_DIR}/makeClass" "--all --readmes --openapi --options --gocmds --sdk --protobuf" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") +add_custom_target(generate2 COMMAND "${BIN_DIR}/goMaker" "" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/../build") add_custom_target(sdk COMMAND "${BIN_DIR}/makeClass" "--sdk" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") add_custom_target(gocmds COMMAND "${BIN_DIR}/makeClass" "--options --gocmds" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") add_custom_target(readmes COMMAND "${BIN_DIR}/makeClass" "--readmes" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") diff --git a/src/dev_tools/CMakeLists.txt b/src/dev_tools/CMakeLists.txt index 1920b3f95c..e3995b58df 100644 --- a/src/dev_tools/CMakeLists.txt +++ b/src/dev_tools/CMakeLists.txt @@ -8,3 +8,4 @@ set(BASE_INCLUDE "${CMAKE_SOURCE_DIR}/dev_tools/utillib") add_subdirectory(utillib) add_subdirectory(makeClass) add_subdirectory(testRunner) +add_subdirectory(goMaker) diff --git a/src/dev_tools/goMaker/CMakeLists.txt b/src/dev_tools/goMaker/CMakeLists.txt new file mode 100644 index 0000000000..82140d398b --- /dev/null +++ b/src/dev_tools/goMaker/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required (VERSION 3.5) + +project (goMaker) + +ADD_GO_INSTALLABLE_PROGRAM(goMaker *.go ${BIN_DIR}) diff --git a/src/dev_tools/goMaker/main.go b/src/dev_tools/goMaker/main.go new file mode 100644 index 0000000000..f51e1ecf62 --- /dev/null +++ b/src/dev_tools/goMaker/main.go @@ -0,0 +1,15 @@ +package main + +import ( + "fmt" + "os" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" +) + +func main() { + // assumes it's running from ./build folder + thePath := "../src/other/data-models/" + pwd, _ := os.Getwd() + fmt.Println(thePath, file.FolderExists(thePath), pwd) +} From 993f492c6f184d1d9820c261c871294dbe44119b Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 14:04:39 -0400 Subject: [PATCH 04/20] Adds a VERSION file and moves some code --- VERSION | 1 + src/apps/chifra/pkg/version/{version_strings.go => string.go} | 0 2 files changed, 1 insertion(+) create mode 100644 VERSION rename src/apps/chifra/pkg/version/{version_strings.go => string.go} (100%) diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000..ecd7ee50cb --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +2.5.8 diff --git a/src/apps/chifra/pkg/version/version_strings.go b/src/apps/chifra/pkg/version/string.go similarity index 100% rename from src/apps/chifra/pkg/version/version_strings.go rename to src/apps/chifra/pkg/version/string.go From 049d9fa34c7cfa2fa0786ed95254312ca3a8d65b Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 14:16:11 -0400 Subject: [PATCH 05/20] Moves data files to ./other/data-models. Adds usage field (unused) to endpoints data. Cleaning --- src/cmd-line-endpoints.csv | 31 ------------------- src/dev_tools/makeClass/handle_gocmds.cpp | 2 +- src/dev_tools/makeClass/options.cpp | 8 ++--- src/other/data-models/cmd-line-endpoints.csv | 31 +++++++++++++++++++ .../data-models}/cmd-line-options.csv | 0 5 files changed, 36 insertions(+), 36 deletions(-) delete mode 100644 src/cmd-line-endpoints.csv create mode 100644 src/other/data-models/cmd-line-endpoints.csv rename src/{ => other/data-models}/cmd-line-options.csv (100%) diff --git a/src/cmd-line-endpoints.csv b/src/cmd-line-endpoints.csv deleted file mode 100644 index a7875b013a..0000000000 --- a/src/cmd-line-endpoints.csv +++ /dev/null @@ -1,31 +0,0 @@ -num ,group ,is_visible ,is_visible_docs ,api_group ,api_route ,tool ,summary ,capabilities ,description - 01 ,Accounts ,false ,true , , , , , ,Access and cache transactional data - 01 ,Accounts ,true ,true ,apps ,list ,acctExport --appearances ,List transactions ,default| ,List every appearance of an address anywhere on the chain. - 01 ,Accounts ,true ,true ,apps ,export ,acctExport ,Export details ,default|caching|ether| ,Export full details of transactions for one or more addresses. - 01 ,Accounts ,true ,true ,apps ,monitors ,acctExport --appearances ,Manage monitors ,default|caching| ,Add, remove, clean, and list address monitors. - 01 ,Accounts ,true ,true ,tools ,names ,ethNames ,Names ,default| ,Query addresses or names of well-known accounts. - 01 ,Accounts ,true ,true ,tools ,abis ,grabABI ,ABIs ,default|caching| ,Fetches the ABI for a smart contract. - - 02 ,Chain Data ,false ,true , , , , , ,Access and cache blockchain-related data - 02 ,Chain Data ,true ,true ,tools ,blocks ,getBlocks ,Get blocks ,default|caching|ether|raw| ,Retrieve one or more blocks from the chain or local cache. - 02 ,Chain Data ,true ,true ,tools ,transactions ,getTrans ,Get transactions ,default|caching|ether|raw| ,Retrieve one or more transactions from the chain or local cache. - 02 ,Chain Data ,true ,true ,tools ,receipts ,getReceipts ,Get receipts ,default|caching|raw| ,Retrieve receipts for the given transaction(s). - 02 ,Chain Data ,true ,true ,tools ,logs ,getLogs ,Get logs ,default|caching|raw| ,Retrieve logs for the given transaction(s). - 02 ,Chain Data ,true ,true ,tools ,traces ,getTraces ,Get traces ,default|caching|ether|raw| ,Retrieve traces for the given transaction(s). - 02 ,Chain Data ,true ,true ,tools ,when ,whenBlock ,Get block dates ,default|caching| ,Find block(s) based on date, blockNum, timestamp, or 'special'. - - 03 ,Chain State ,false ,true , , , , , ,Access to account and token state - 03 ,Chain State ,true ,true ,tools ,state ,getState ,Get balance(s) ,default|caching|ether| ,Retrieve account balance(s) for one or more addresses at given block(s). - 03 ,Chain State ,true ,true ,tools ,tokens ,getTokens ,Get token balance(s) ,default|caching| ,Retrieve token balance(s) for one or more addresses at given block(s). - - 04 ,Admin ,false ,true , , , , , ,Control the scraper and build the index - 04 ,Admin ,true ,true ,apps ,config ,config ,Manage config ,default| ,Report on and edit the configuration of the TrueBlocks system. - 04 ,Admin ,true ,true ,apps ,status ,cacheStatus ,Get status on caches ,default| ,Report on the state of the internal binary caches. - 04 ,Admin ,true ,true ,apps ,daemon ,flame , ,verbose|version|noop|noColor| ,Initialize and control long-running processes such as the API and the scrapers. - 04 ,Admin ,true ,true ,apps ,scrape ,blockScrape ,Scrape index ,verbose|version|noop|noColor|chain| ,Scan the chain and update the TrueBlocks index of appearances. - 04 ,Admin ,true ,true ,apps ,chunks ,chunkMan ,Manage chunks ,default| ,Manage, investigate, and display the Unchained Index. - 04 ,Admin ,true ,true ,apps ,init ,init ,Initialize index ,verbose|version|noop|noColor|chain| ,Initialize the TrueBlocks system by downloading the Unchained Index from IPFS. - - 05 ,Other ,false ,true , , , , , ,Access to other and external data - 05 ,Other ,true ,true ,apps ,explore ,fireStorm ,Explore ,verbose|version|noop|noColor|chain|file| ,Open a local or remote explorer for one or more addresses, blocks, or transactions. - 05 ,Other ,true ,true ,tools ,slurp ,ethslurp ,Slurp Etherscan ,default|caching|ether|raw| ,Fetch data from Etherscan for any address. diff --git a/src/dev_tools/makeClass/handle_gocmds.cpp b/src/dev_tools/makeClass/handle_gocmds.cpp index d083de67fb..09f5f0fe09 100644 --- a/src/dev_tools/makeClass/handle_gocmds.cpp +++ b/src/dev_tools/makeClass/handle_gocmds.cpp @@ -258,7 +258,7 @@ bool COptions::handle_gocmds(void) { contents = asciiFileToString(getPathToTemplates("version.go.tmpl")); replace(contents, "[{VERSION}]", getVersionStr(true, false)); - stringToAsciiFile(getPathToSource("apps/chifra/pkg/version/version_strings.go"), contents); + stringToAsciiFile(getPathToSource("apps/chifra/pkg/version/string.go"), contents); LOG_INFO(cYellow, "makeClass --gocmds", cOff, " processed ", counter.nVisited, " files (changed ", counter.nProcessed, ").", string_q(40, ' ')); diff --git a/src/dev_tools/makeClass/options.cpp b/src/dev_tools/makeClass/options.cpp index 6b32660cc5..a4c7dd0a77 100644 --- a/src/dev_tools/makeClass/options.cpp +++ b/src/dev_tools/makeClass/options.cpp @@ -117,18 +117,18 @@ bool COptions::parseArguments(string_q& command) { establishFolder(getDocsPathContent("chifra/")); } - string_q endpointsFile = getPathToSource("cmd-line-endpoints.csv"); + string_q endpointsFile = getPathToSource("other/data-models/cmd-line-endpoints.csv"); if (!fileExists(endpointsFile)) { - endpointsFile = "./cmd-line-endpoints.csv"; + endpointsFile = "./other/data-models/cmd-line-endpoints.csv"; if (!fileExists(endpointsFile)) { return usage("Could not find " + endpointsFile); } } forEveryLineInAsciiFile(endpointsFile, parseEndpointsFile, this); - string_q optionsFile = getPathToSource("cmd-line-options.csv"); + string_q optionsFile = getPathToSource("other/data-models/cmd-line-options.csv"); if (!fileExists(optionsFile)) { - optionsFile = "./cmd-line-options.csv"; + optionsFile = "./other/data-models/cmd-line-options.csv"; if (!fileExists(optionsFile)) { return usage("Could not find " + optionsFile); } diff --git a/src/other/data-models/cmd-line-endpoints.csv b/src/other/data-models/cmd-line-endpoints.csv new file mode 100644 index 0000000000..9c61053be9 --- /dev/null +++ b/src/other/data-models/cmd-line-endpoints.csv @@ -0,0 +1,31 @@ +num,group,is_visible,is_visible_docs,api_group,api_route,tool,summary,usage,capabilities,description +11,Accounts,false,true,,,,,,,Access and cache transactional data +12,Accounts,true,true,apps,list,acctExport --appearances,List transactions,[flags]
[address...],default|,List every appearance of an address anywhere on the chain. +13,Accounts,true,true,apps,export,acctExport,Export details,[flags]
[address...] [topics...] [fourbytes...],default|caching|ether|,Export full details of transactions for one or more addresses. +14,Accounts,true,true,apps,monitors,acctExport --appearances,Manage monitors,[flags]
[address...],default|caching|,Add, remove, clean, and list address monitors. +15,Accounts,true,true,tools,names,ethNames,Names,[flags] [term...],default|,Query addresses or names of well-known accounts. +16,Accounts,true,true,tools,abis,grabABI,ABIs,[flags]
[address...],default|caching|,Fetches the ABI for a smart contract. + +21,Chain Data,false,true,,,,,,,Access and cache blockchain-related data +22,Chain Data,true,true,tools,blocks,getBlocks,Get blocks,[flags] [block...],default|caching|ether|raw|,Retrieve one or more blocks from the chain or local cache. +23,Chain Data,true,true,tools,transactions,getTrans,Get transactions,[flags] [tx_id...],default|caching|ether|raw|,Retrieve one or more transactions from the chain or local cache. +24,Chain Data,true,true,tools,receipts,getReceipts,Get receipts,[flags] [tx_id...],default|caching|raw|,Retrieve receipts for the given transaction(s). +25,Chain Data,true,true,tools,logs,getLogs,Get logs,[flags] [tx_id...],default|caching|raw|,Retrieve logs for the given transaction(s). +26,Chain Data,true,true,tools,traces,getTraces,Get traces,[flags] [tx_id...],default|caching|ether|raw|,Retrieve traces for the given transaction(s). +27,Chain Data,true,true,tools,when,whenBlock,Get block dates,[flags] < block | date > [ block... | date... ],default|caching|,Find block(s) based on date, blockNum, timestamp, or 'special'. + +31,Chain State,false,true,,,,,,,Access to account and token state +32,Chain State,true,true,tools,state,getState,Get balance(s),[flags]
[address...] [block...],default|caching|ether|,Retrieve account balance(s) for one or more addresses at given block(s). +33,Chain State,true,true,tools,tokens,getTokens,Get token balance(s),[flags]
[address...] [block...],default|caching|,Retrieve token balance(s) for one or more addresses at given block(s). + +41,Admin,false,true,,,,,,,Control the scraper and build the index +42,Admin,true,true,apps,config,config,Manage config, [flags],default|,Report on and edit the configuration of the TrueBlocks system. +43,Admin,true,true,apps,status,cacheStatus,Get status on caches, [mode...] [flags],default|,Report on the state of the internal binary caches. +44,Admin,true,true,apps,daemon,flame,,[flags],verbose|version|noop|noColor|,Initialize and control long-running processes such as the API and the scrapers. +45,Admin,true,true,apps,scrape,blockScrape,Scrape index,[flags],verbose|version|noop|noColor|chain|,Scan the chain and update the TrueBlocks index of appearances. +46,Admin,true,true,apps,chunks,chunkMan,Manage chunks, [flags] [blocks...] [address...],default|,Manage, investigate, and display the Unchained Index. +47,Admin,true,true,apps,init,init,Initialize index,[flags],verbose|version|noop|noColor|chain|,Initialize the TrueBlocks system by downloading the Unchained Index from IPFS. + +51,Other,false,true,,,,,,,Access to other and external data +52,Other,true,true,apps,explore,fireStorm,Explore,[flags] [terms...],verbose|version|noop|noColor|chain|file|,Open a local or remote explorer for one or more addresses, blocks, or transactions. +53,Other,true,true,tools,slurp,ethslurp,Slurp Etherscan,[flags]
[address...] [block...],default|caching|ether|raw|,Fetch data from Etherscan for any address. diff --git a/src/cmd-line-options.csv b/src/other/data-models/cmd-line-options.csv similarity index 100% rename from src/cmd-line-options.csv rename to src/other/data-models/cmd-line-options.csv From 74fec2d09c05eb0205d260efaaeb637d9f2c703e Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 14:54:47 -0400 Subject: [PATCH 06/20] Fixes a few things with the old code generator --- docs/content/chifra/admin.md | 2 +- docs/content/chifra/other.md | 2 +- docs/readmes/admin-scrape.md | 2 +- docs/readmes/other-explore.md | 2 +- .../readme-intros/admin-scrape.config.md | 2 +- src/apps/chifra/cmd/explore.go | 2 +- src/apps/chifra/internal/explore/README.md | 2 +- src/apps/chifra/internal/scrape/README.md | 2 +- src/dev_tools/makeClass/handle_gocmds.cpp | 8 +++-- src/dev_tools/utillib/sfstring.cpp | 7 ++++ src/dev_tools/utillib/sfstring.h | 1 + src/other/data-models/cmd-line-options.csv | 34 +++++++++---------- test/gold/apps/chifra/chifra_help_explore.txt | 2 +- .../apps/fireStorm/fireStorm_bad_hash.txt | 2 +- .../fireStorm/fireStorm_block_not_found.txt | 2 +- .../apps/fireStorm/fireStorm_caps_allowed.txt | 2 +- .../fireStorm/fireStorm_caps_disallowed_1.txt | 2 +- .../fireStorm_caps_disallowed_10.txt | 2 +- .../fireStorm/fireStorm_caps_disallowed_3.txt | 2 +- .../fireStorm/fireStorm_caps_disallowed_4.txt | 2 +- .../fireStorm/fireStorm_caps_disallowed_5.txt | 2 +- .../fireStorm/fireStorm_caps_disallowed_6.txt | 2 +- .../fireStorm/fireStorm_caps_disallowed_7.txt | 2 +- .../fireStorm/fireStorm_caps_disallowed_8.txt | 2 +- .../fireStorm/fireStorm_caps_disallowed_9.txt | 2 +- .../apps/fireStorm/fireStorm_google_fail.txt | 2 +- .../apps/fireStorm/fireStorm_google_fail2.txt | 2 +- test/gold/apps/fireStorm/fireStorm_help.txt | 2 +- .../apps/fireStorm/fireStorm_help_long.txt | 2 +- .../fireStorm/fireStorm_invalid_param_1.txt | 2 +- 30 files changed, 57 insertions(+), 45 deletions(-) diff --git a/docs/content/chifra/admin.md b/docs/content/chifra/admin.md index c099897cb4..ed92ff259e 100644 --- a/docs/content/chifra/admin.md +++ b/docs/content/chifra/admin.md @@ -237,7 +237,7 @@ Each of the following additional configurable command line options are available | firstSnap | uint64 | 2000000 | the first block at which snap_to_grid is enabled | | unripeDist | uint64 | 28 | the distance (in blocks) from the front of the chain under which (inclusive) a block is considered unripe | | channelCount | uint64 | 20 | number of concurrent processing channels | -| allowMissing | bool | true | do not report errors for blockchains that contain blocks with zero addresses | +| allowMissing | bool | false | do not report errors for blockchains that contain blocks with zero addresses | Note that for Ethereum mainnet, the default values for appsPerChunk and firstSnap are 2,000,000 and 2,300,000 respectively. See the specification for a justification of these values. diff --git a/docs/content/chifra/other.md b/docs/content/chifra/other.md index 34a33e6b82..af8702fa0b 100644 --- a/docs/content/chifra/other.md +++ b/docs/content/chifra/other.md @@ -36,7 +36,7 @@ Purpose: Open a local or remote explorer for one or more addresses, blocks, or transactions. Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/docs/readmes/admin-scrape.md b/docs/readmes/admin-scrape.md index 4f86425b95..cf4923ee60 100644 --- a/docs/readmes/admin-scrape.md +++ b/docs/readmes/admin-scrape.md @@ -61,7 +61,7 @@ Each of the following additional configurable command line options are available | firstSnap | uint64 | 2000000 | the first block at which snap_to_grid is enabled | | unripeDist | uint64 | 28 | the distance (in blocks) from the front of the chain under which (inclusive) a block is considered unripe | | channelCount | uint64 | 20 | number of concurrent processing channels | -| allowMissing | bool | true | do not report errors for blockchains that contain blocks with zero addresses | +| allowMissing | bool | false | do not report errors for blockchains that contain blocks with zero addresses | Note that for Ethereum mainnet, the default values for appsPerChunk and firstSnap are 2,000,000 and 2,300,000 respectively. See the specification for a justification of these values. diff --git a/docs/readmes/other-explore.md b/docs/readmes/other-explore.md index 17e8659bbb..85a2367470 100644 --- a/docs/readmes/other-explore.md +++ b/docs/readmes/other-explore.md @@ -9,7 +9,7 @@ Purpose: Open a local or remote explorer for one or more addresses, blocks, or transactions. Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/docs/templates/readme-intros/admin-scrape.config.md b/docs/templates/readme-intros/admin-scrape.config.md index c97060e10a..bc18e1628a 100644 --- a/docs/templates/readme-intros/admin-scrape.config.md +++ b/docs/templates/readme-intros/admin-scrape.config.md @@ -5,4 +5,4 @@ | firstSnap | uint64 | 2000000 | the first block at which snap_to_grid is enabled | | unripeDist | uint64 | 28 | the distance (in blocks) from the front of the chain under which (inclusive) a block is considered unripe | | channelCount | uint64 | 20 | number of concurrent processing channels | -| allowMissing | bool | true | do not report errors for blockchains that contain blocks with zero addresses | +| allowMissing | bool | false | do not report errors for blockchains that contain blocks with zero addresses | diff --git a/src/apps/chifra/cmd/explore.go b/src/apps/chifra/cmd/explore.go index f9b304861c..3f1863ea2b 100644 --- a/src/apps/chifra/cmd/explore.go +++ b/src/apps/chifra/cmd/explore.go @@ -36,7 +36,7 @@ var exploreCmd = &cobra.Command{ }), } -const usageExplore = `explore [flags] [term...] +const usageExplore = `explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier` diff --git a/src/apps/chifra/internal/explore/README.md b/src/apps/chifra/internal/explore/README.md index 2598341482..5cd30d666d 100644 --- a/src/apps/chifra/internal/explore/README.md +++ b/src/apps/chifra/internal/explore/README.md @@ -9,7 +9,7 @@ Purpose: Open a local or remote explorer for one or more addresses, blocks, or transactions. Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/src/apps/chifra/internal/scrape/README.md b/src/apps/chifra/internal/scrape/README.md index bac2c4667e..1d84eca262 100644 --- a/src/apps/chifra/internal/scrape/README.md +++ b/src/apps/chifra/internal/scrape/README.md @@ -55,7 +55,7 @@ Each of the following additional configurable command line options are available | firstSnap | uint64 | 2000000 | the first block at which snap_to_grid is enabled | | unripeDist | uint64 | 28 | the distance (in blocks) from the front of the chain under which (inclusive) a block is considered unripe | | channelCount | uint64 | 20 | number of concurrent processing channels | -| allowMissing | bool | true | do not report errors for blockchains that contain blocks with zero addresses | +| allowMissing | bool | false | do not report errors for blockchains that contain blocks with zero addresses | Note that for Ethereum mainnet, the default values for appsPerChunk and firstSnap are 2,000,000 and 2,300,000 respectively. See the specification for a justification of these values. diff --git a/src/dev_tools/makeClass/handle_gocmds.cpp b/src/dev_tools/makeClass/handle_gocmds.cpp index 09f5f0fe09..ed69eb8727 100644 --- a/src/dev_tools/makeClass/handle_gocmds.cpp +++ b/src/dev_tools/makeClass/handle_gocmds.cpp @@ -821,6 +821,8 @@ string_q clean_positionals(const string_q& progName, const string_q& strIn) { if (contains(toLower(progName), "when")) os << (strIn == "list" ? "< block | date > [ block... | date... ]" : ""); + else if (contains(toLower(progName), "explore")) + os << (strIn == "list" ? "[terms...]" : ""); else os << (strIn == "list" ? " [term...]" : ""); @@ -842,8 +844,10 @@ string_q clean_positionals(const string_q& progName, const string_q& strIn) { replaceAll(strOut, "addrs topics fourbytes", "
[address...] [topics] [fourbytes]"); replaceAll(strOut, "addrs", "
[address...]"); replaceAll(strOut, "files", " [file...]"); - replaceAll(strOut, "terms", " [term...]"); - replaceAll(strOut, "modes", " [mode...]"); + if (contains(toLower(progName), "explore")) + replaceAll(strOut, "terms", "[terms...]"); + else + replaceAll(strOut, "modes", " [mode...]"); return trim(strOut); } diff --git a/src/dev_tools/utillib/sfstring.cpp b/src/dev_tools/utillib/sfstring.cpp index ce6473987b..50519823b9 100644 --- a/src/dev_tools/utillib/sfstring.cpp +++ b/src/dev_tools/utillib/sfstring.cpp @@ -283,6 +283,13 @@ string_q toUpper(const string_q& in) { return ret.c_str(); } +//-------------------------------------------------------------------- +string_q toSingular(const string_q& in) { + string_q ret = in; + replaceReverse(ret, "s", ""); + return endsWith(in, "s") ? ret : in; +} + //-------------------------------------------------------------------- string_q toProper(const string_q& in) { string ret; diff --git a/src/dev_tools/utillib/sfstring.h b/src/dev_tools/utillib/sfstring.h index a847a9341a..9c49a023a2 100644 --- a/src/dev_tools/utillib/sfstring.h +++ b/src/dev_tools/utillib/sfstring.h @@ -94,6 +94,7 @@ extern bool containsAny(const string_q& haystack, const string_q& needle); extern string_q toLower(const string_q& in); extern string_q toUpper(const string_q& in); extern string_q toProper(const string_q& in); +extern string_q toSingular(const string_q& in); extern string_q toCamelCase(const string_q& in); extern string_q firstLower(const string_q& in); extern string_q firstUpper(const string_q& in); diff --git a/src/other/data-models/cmd-line-options.csv b/src/other/data-models/cmd-line-options.csv index 446c73e318..96598b3c2c 100644 --- a/src/other/data-models/cmd-line-options.csv +++ b/src/other/data-models/cmd-line-options.csv @@ -235,7 +235,7 @@ num,group,tags,api_route,tool,longName,hotKey,def_val,is_required,is_customizabl 12175,apps,Admin,scrape,blockScrape,first_snap,,2000000,false,false,false,false,config,flag,,the first block at which snap_to_grid is enabled 12165,apps,Admin,scrape,blockScrape,unripe_dist,,28,false,false,false,false,config,flag,,the distance (in blocks) from the front of the chain under which (inclusive) a block is considered unripe 12150,apps,Admin,scrape,blockScrape,channel_count,,20,false,false,false,false,config,flag,,number of concurrent processing channels -12180,apps,Admin,scrape,blockScrape,allow_missing,,true,false,false,false,false,config,flag,,do not report errors for blockchains that contain blocks with zero addresses +12180,apps,Admin,scrape,blockScrape,allow_missing,,,false,false,false,false,config,flag,,do not report errors for blockchains that contain blocks with zero addresses 12195,apps,Admin,scrape,blockScrape,,,,false,false,true,true,--,description,,Scan the chain and update the TrueBlocks index of appearances. 12196,apps,Admin,scrape,blockScrape,n1,,,false,false,false,false,--,note,,The --touch option may only be used for blocks after the latest scraped block (if any). It will be snapped back to the latest snap_to block. @@ -326,20 +326,20 @@ num,group,tags,api_route,tool,longName,hotKey,def_val,is_required,is_customizabl 12226,tools,Other,slurp,ethslurp,n3,,,false,false,false,false,--,note,,The withdrawals option is only available on certain chains. It is ignored otherwise. 12228,tools,Other,slurp,ethslurp,n4,,,false,false,false,false,--,note,,If the value of --source is key, --types is ignored and only appearances or counts are returned. -11660,dev_tools,,,makeClass,files,,,true,false,true,true,gocmd,positional,list,one or more class definition files -11740,dev_tools,,,makeClass,all,a,,false,false,true,true,gocmd,switch,,list, or run all class definitions found in the local folder -11780,dev_tools,,,makeClass,options,o,,false,false,true,true,gocmd,switch,,export options code (check validity in the process) -11780,dev_tools,,,makeClass,gocmds,g,,false,false,true,true,gocmd,switch,,export go command code -11780,dev_tools,,,makeClass,readmes,m,,false,false,true,true,gocmd,switch,,create readme files for each tool and app -11782,dev_tools,,,makeClass,format,f,,false,false,true,true,gocmd,switch,,format source code files (.cpp and .h) found in local folder and below -11787,dev_tools,,,makeClass,sdk,s,,false,false,true,true,gocmd,switch,,create typescript sdk -11781,dev_tools,,,makeClass,openapi,A,,false,false,true,true,gocmd,switch,,export openapi.yaml file for API documentation -11824,dev_tools,,,makeClass,,,,false,false,true,true,--,description,,Automatically writes C++ for various purposes. -11826,dev_tools,,,makeClass,n1,,,false,false,false,false,--,note,,The `--options` flag generates `COption` code for each of the various tools. -11830,dev_tools,,,makeClass,n2,,,false,false,false,false,--,note,,More information on class definition files is found in the documentation. +11660,dev_tools,Dev,,makeClass,files,,,true,false,true,true,gocmd,positional,list,one or more class definition files +11740,dev_tools,Dev,,makeClass,all,a,,false,false,true,true,gocmd,switch,,list, or run all class definitions found in the local folder +11780,dev_tools,Dev,,makeClass,options,o,,false,false,true,true,gocmd,switch,,export options code (check validity in the process) +11780,dev_tools,Dev,,makeClass,gocmds,g,,false,false,true,true,gocmd,switch,,export go command code +11780,dev_tools,Dev,,makeClass,readmes,m,,false,false,true,true,gocmd,switch,,create readme files for each tool and app +11782,dev_tools,Dev,,makeClass,format,f,,false,false,true,true,gocmd,switch,,format source code files (.cpp and .h) found in local folder and below +11787,dev_tools,Dev,,makeClass,sdk,s,,false,false,true,true,gocmd,switch,,create typescript sdk +11781,dev_tools,Dev,,makeClass,openapi,A,,false,false,true,true,gocmd,switch,,export openapi.yaml file for API documentation +11824,dev_tools,Dev,,makeClass,,,,false,false,true,true,--,description,,Automatically writes C++ for various purposes. +11826,dev_tools,Dev,,makeClass,n1,,,false,false,false,false,--,note,,The `--options` flag generates `COption` code for each of the various tools. +11830,dev_tools,Dev,,makeClass,n2,,,false,false,false,false,--,note,,More information on class definition files is found in the documentation. -11880,dev_tools,,,testRunner,mode,m,,false,false,true,true,gocmd,flag,enum[cmd*|api|both],determine which set of tests to run -11900,dev_tools,,,testRunner,filter,f,,false,false,true,true,gocmd,flag,enum[fast*|medi|slow|all],determine how long it takes to run tests -11930,dev_tools,,,testRunner,skip,s,1,false,false,true,true,gocmd,flag,,run only every 'skip' test (faster) -11960,dev_tools,,,testRunner,report,r,,false,false,true,true,gocmd,switch,,display performance report to screen -11980,dev_tools,,,testRunner,,,,false,false,true,true,--,description,,Run TrueBlocks' test cases with options. +11880,dev_tools,Dev,,testRunner,mode,m,,false,false,true,true,gocmd,flag,enum[cmd*|api|both],determine which set of tests to run +11900,dev_tools,Dev,,testRunner,filter,f,,false,false,true,true,gocmd,flag,enum[fast*|medi|slow|all],determine how long it takes to run tests +11930,dev_tools,Dev,,testRunner,skip,s,1,false,false,true,true,gocmd,flag,,run only every 'skip' test (faster) +11960,dev_tools,Dev,,testRunner,report,r,,false,false,true,true,gocmd,switch,,display performance report to screen +11980,dev_tools,Dev,,testRunner,,,,false,false,true,true,--,description,,Run TrueBlocks' test cases with options. diff --git a/test/gold/apps/chifra/chifra_help_explore.txt b/test/gold/apps/chifra/chifra_help_explore.txt index 75c3d2def7..2547c54512 100644 --- a/test/gold/apps/chifra/chifra_help_explore.txt +++ b/test/gold/apps/chifra/chifra_help_explore.txt @@ -3,7 +3,7 @@ Purpose: Open a local or remote explorer for one or more addresses, blocks, or transactions. Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_bad_hash.txt b/test/gold/apps/fireStorm/fireStorm_bad_hash.txt index dbbae7a589..d52350b734 100644 --- a/test/gold/apps/fireStorm/fireStorm_bad_hash.txt +++ b/test/gold/apps/fireStorm/fireStorm_bad_hash.txt @@ -4,7 +4,7 @@ TEST[DATE|TIME] Caps: -fmt,-noHeader,-output,-append TEST[DATE|TIME] Format: txt Error: The term option (0xf503017d7baf7fbc0fff749badha5hfab532aeeecf549be93e358737d0648f50d57083a0) is not valid. Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_block_not_found.txt b/test/gold/apps/fireStorm/fireStorm_block_not_found.txt index b4675e358b..75b8099291 100644 --- a/test/gold/apps/fireStorm/fireStorm_block_not_found.txt +++ b/test/gold/apps/fireStorm/fireStorm_block_not_found.txt @@ -4,7 +4,7 @@ TEST[DATE|TIME] Caps: -fmt,-noHeader,-output,-append TEST[DATE|TIME] Format: txt Error: block at 0x0f1217b92276cd17608d4212879739e6a5ec388bd7a03bef9798655234afd2b2 returned an error: not found Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_caps_allowed.txt b/test/gold/apps/fireStorm/fireStorm_caps_allowed.txt index 016ea4694a..b10d276b4e 100644 --- a/test/gold/apps/fireStorm/fireStorm_caps_allowed.txt +++ b/test/gold/apps/fireStorm/fireStorm_caps_allowed.txt @@ -1,7 +1,7 @@ chifra explore 12.0 --chain --nocolor --noop --verbose --file --fail_on_purpose Error: open --fail_on_purpose: no such file or directory Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_1.txt b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_1.txt index 899aa79ac9..312f7b85ef 100644 --- a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_1.txt +++ b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_1.txt @@ -3,7 +3,7 @@ Error: unknown flag: --fmt Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_10.txt b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_10.txt index 2612c5020d..e146e171fb 100644 --- a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_10.txt +++ b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_10.txt @@ -3,7 +3,7 @@ Error: unknown flag: --decache Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_3.txt b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_3.txt index 4edce3b9ac..d0536c8e16 100644 --- a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_3.txt +++ b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_3.txt @@ -3,7 +3,7 @@ Error: unknown flag: --no_header Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_4.txt b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_4.txt index 7511336101..8bf71254dd 100644 --- a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_4.txt +++ b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_4.txt @@ -3,7 +3,7 @@ Error: unknown flag: --output Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_5.txt b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_5.txt index ecee2e668e..68fbde2ce1 100644 --- a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_5.txt +++ b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_5.txt @@ -3,7 +3,7 @@ Error: unknown flag: --append Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_6.txt b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_6.txt index f8d24e0042..ddcb2970a3 100644 --- a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_6.txt +++ b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_6.txt @@ -3,7 +3,7 @@ Error: unknown flag: --raw Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_7.txt b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_7.txt index 40c2d9b8d4..6aab4436be 100644 --- a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_7.txt +++ b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_7.txt @@ -3,7 +3,7 @@ Error: unknown flag: --ether Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_8.txt b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_8.txt index 286ef63554..b0fb5d62f4 100644 --- a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_8.txt +++ b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_8.txt @@ -3,7 +3,7 @@ Error: unknown flag: --wei Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_9.txt b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_9.txt index a58d6ef641..c76067a2a2 100644 --- a/test/gold/apps/fireStorm/fireStorm_caps_disallowed_9.txt +++ b/test/gold/apps/fireStorm/fireStorm_caps_disallowed_9.txt @@ -3,7 +3,7 @@ Error: unknown flag: --cache Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_google_fail.txt b/test/gold/apps/fireStorm/fireStorm_google_fail.txt index 1a7fb9b1cb..47c823fcb0 100644 --- a/test/gold/apps/fireStorm/fireStorm_google_fail.txt +++ b/test/gold/apps/fireStorm/fireStorm_google_fail.txt @@ -6,7 +6,7 @@ TEST[DATE|TIME] Caps: -fmt,-noHeader,-output,-append TEST[DATE|TIME] Format: txt Error: The --local option is not available with the --google option. Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_google_fail2.txt b/test/gold/apps/fireStorm/fireStorm_google_fail2.txt index 688aa493a0..910739c6fd 100644 --- a/test/gold/apps/fireStorm/fireStorm_google_fail2.txt +++ b/test/gold/apps/fireStorm/fireStorm_google_fail2.txt @@ -5,7 +5,7 @@ TEST[DATE|TIME] Caps: -fmt,-noHeader,-output,-append TEST[DATE|TIME] Format: txt Error: The --google option requires an address term. Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_help.txt b/test/gold/apps/fireStorm/fireStorm_help.txt index 74cf24d66f..691d1c30e6 100644 --- a/test/gold/apps/fireStorm/fireStorm_help.txt +++ b/test/gold/apps/fireStorm/fireStorm_help.txt @@ -3,7 +3,7 @@ Purpose: Open a local or remote explorer for one or more addresses, blocks, or transactions. Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_help_long.txt b/test/gold/apps/fireStorm/fireStorm_help_long.txt index 231c031aa6..4de564fb95 100644 --- a/test/gold/apps/fireStorm/fireStorm_help_long.txt +++ b/test/gold/apps/fireStorm/fireStorm_help_long.txt @@ -3,7 +3,7 @@ Purpose: Open a local or remote explorer for one or more addresses, blocks, or transactions. Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier diff --git a/test/gold/apps/fireStorm/fireStorm_invalid_param_1.txt b/test/gold/apps/fireStorm/fireStorm_invalid_param_1.txt index 7e96be497d..3a0f8b6c07 100644 --- a/test/gold/apps/fireStorm/fireStorm_invalid_param_1.txt +++ b/test/gold/apps/fireStorm/fireStorm_invalid_param_1.txt @@ -3,7 +3,7 @@ Error: unknown flag: --junk Usage: - chifra explore [flags] [term...] + chifra explore [flags] [terms...] Arguments: terms - one or more address, name, block, or transaction identifier From f19e82cd64ab7f1f326883734e695e14d77e2ede Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 15:33:20 -0400 Subject: [PATCH 07/20] Removes generation of all SDK code from the C++. Does not yet replace it. --- src/dev_tools/makeClass/handle_gocmds.cpp | 25 -- src/dev_tools/makeClass/handle_sdk.cpp | 47 --- src/dev_tools/makeClass/handle_sdk_go.cpp | 342 ------------------ src/dev_tools/makeClass/handle_sdk_py.cpp | 28 -- .../makeClass/handle_sdk_py_paths.cpp | 111 ------ .../makeClass/handle_sdk_py_types.cpp | 19 - src/dev_tools/makeClass/handle_sdk_ts.cpp | 45 --- .../makeClass/handle_sdk_ts_paths.cpp | 184 ---------- .../makeClass/handle_sdk_ts_types.cpp | 129 ------- src/dev_tools/makeClass/options.cpp | 22 +- src/dev_tools/makeClass/options.h | 14 +- 11 files changed, 15 insertions(+), 951 deletions(-) delete mode 100644 src/dev_tools/makeClass/handle_sdk.cpp delete mode 100644 src/dev_tools/makeClass/handle_sdk_go.cpp delete mode 100644 src/dev_tools/makeClass/handle_sdk_py.cpp delete mode 100644 src/dev_tools/makeClass/handle_sdk_py_paths.cpp delete mode 100644 src/dev_tools/makeClass/handle_sdk_py_types.cpp delete mode 100644 src/dev_tools/makeClass/handle_sdk_ts.cpp delete mode 100644 src/dev_tools/makeClass/handle_sdk_ts_paths.cpp delete mode 100644 src/dev_tools/makeClass/handle_sdk_ts_types.cpp diff --git a/src/dev_tools/makeClass/handle_gocmds.cpp b/src/dev_tools/makeClass/handle_gocmds.cpp index ed69eb8727..46db29c0c3 100644 --- a/src/dev_tools/makeClass/handle_gocmds.cpp +++ b/src/dev_tools/makeClass/handle_gocmds.cpp @@ -202,19 +202,6 @@ bool COptions::handle_gocmds_output(const CCommandOption& ep) { return true; } -//--------------------------------------------------------------------------------------------------- -string_q toChifraHelp(const CCommandOption& cmd) { - if ((cmd.description.empty() && !cmd.api_route.empty()) || cmd.api_route == "blaze") - return ""; - - CCommandOption ret = cmd; - replaceAll(ret.description, ".", ""); - ret.description = firstLower(ret.description); - if (cmd.api_route.empty()) - return toProper(ret.Format(" [{GROUP}]:")) + "\n"; - return ret.Format(" [{w:14:API_ROUTE}][{DESCRIPTION}]") + "\n"; -} - //--------------------------------------------------------------------------------------------------- bool COptions::handle_gocmds(void) { LOG_INFO(cYellow, "handling go commands...", string_q(50, ' '), cOff); @@ -222,8 +209,6 @@ bool COptions::handle_gocmds(void) { for (auto ep : endpointArray) { if (!ep.is_visible) { - if (!ep.group.empty()) - chifraHelpStream << toChifraHelp(ep); continue; } CCommandOptionArray members; @@ -248,17 +233,7 @@ bool COptions::handle_gocmds(void) { handle_gocmds_options(ep); handle_gocmds_output(ep); handle_gocmds_docfile(ep); - chifraHelpStream << toChifraHelp(ep); } - chifraHelpStream << STR_CHIFRA_HELP_END; - - string_q contents = asciiFileToString(getPathToTemplates("help_text.go.tmpl")); - replace(contents, "[{HELP_TEXT}]", chifraHelpStream.str()); - stringToAsciiFile(getPathToSource("apps/chifra/cmd/help_text.go"), contents); - - contents = asciiFileToString(getPathToTemplates("version.go.tmpl")); - replace(contents, "[{VERSION}]", getVersionStr(true, false)); - stringToAsciiFile(getPathToSource("apps/chifra/pkg/version/string.go"), contents); LOG_INFO(cYellow, "makeClass --gocmds", cOff, " processed ", counter.nVisited, " files (changed ", counter.nProcessed, ").", string_q(40, ' ')); diff --git a/src/dev_tools/makeClass/handle_sdk.cpp b/src/dev_tools/makeClass/handle_sdk.cpp deleted file mode 100644 index d93b18ed6b..0000000000 --- a/src/dev_tools/makeClass/handle_sdk.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/*------------------------------------------------------------------------------------------- - * qblocks - fast, easily-accessible, fully-decentralized data from blockchains - * copyright (c) 2016, 2021 TrueBlocks, LLC (http://trueblocks.io) - * - * This program is free software: you may redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. You should have received a copy of the GNU General - * Public License along with this program. If not, see http://www.gnu.org/licenses/. - *-------------------------------------------------------------------------------------------*/ -#include "utillib.h" -#include "options.h" - -extern bool sortByDataModelName2(const CClassDefinition& c1, const CClassDefinition& c2); -//------------------------------------------------------------------------------------------------------------ -bool COptions::handle_sdk(void) { - CToml config(rootConfigToml_makeClass); - bool enabled = config.getConfigBool("enabled", "sdk", false); - if (isTestMode() || !enabled) { - LOG_WARN("Skipping sdk generation..."); - return true; - } - - LOG_INFO(cYellow, "handling sdk generation...", cOff); - sort(dataModels.begin(), dataModels.end(), sortByDataModelName2); - - if (!handle_sdk_ts()) { - return false; - } - - if (!handle_sdk_py()) { - return false; - } - - if (!handle_sdk_go()) { - return false; - } - - return true; -} - -//------------------------------------------------------------------------------------------------------------ -bool sortByDataModelName2(const CClassDefinition& c1, const CClassDefinition& c2) { - return c1.class_name < c2.class_name; -} diff --git a/src/dev_tools/makeClass/handle_sdk_go.cpp b/src/dev_tools/makeClass/handle_sdk_go.cpp deleted file mode 100644 index ddcaeb9167..0000000000 --- a/src/dev_tools/makeClass/handle_sdk_go.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/*------------------------------------------------------------------------------------------- - * qblocks - fast, easily-accessible, fully-decentralized data from blockchains - * copyright (c) 2016, 2021 TrueBlocks, LLC (http://trueblocks.io) - * - * This program is free software: you may redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. You should have received a copy of the GNU General - * Public License along with this program. If not, see http://www.gnu.org/licenses/. - *-------------------------------------------------------------------------------------------*/ -#include "utillib.h" -#include "options.h" - -//------------------------------------------------------------------------------------------------------------ -extern string_q handle_sdk_go_enum(const string_q& route, const string_q& fn, const CCommandOption& option); - -//------------------------------------------------------------------------------------------------------------ -bool COptions::handle_sdk_go(void) { - handle_sdk_go_innersdk(); - handle_sdk_go_outersdk(); - - ostringstream log; - log << cYellow << "makeClass --sdk (go)" << cOff; - log << " processed " << counter.routeCount << "/" << counter.cmdCount; - log << " paths (changed " << counter.nProcessed << ")." << string_q(40, ' '); - LOG_INFO(log.str()); - - return true; -} - -//------------------------------------------------------------------------------------------------------------ -string_q handle_sdk_go_enum(const string_q& route, const string_q& fn, const CCommandOption& option, - ostringstream& enumsThing) { - string_q ret = option.data_type; - replace(ret, "list<", ""); - replace(ret, "enum[", ""); - replace(ret, "]", ""); - replace(ret, ">", ""); - replaceAll(ret, "*", ""); - bool hasAll = contains(ret, "all"); - - CStringArray parts; - explode(parts, ret, '|'); - - string_q r(1, route[0]); - r = toProper(r) + fn[0]; - string_q a = ""; - if (r == "CM") { - static int cnt = 1; - if (cnt == 1) { - a = "1"; - } else { - a = "2"; - } - cnt = 2; - } - string_q none = "No" + r + a; - string_q some = r + "Some"; - string_q all = r + "All"; - string_q inc = - "balance|proxy|deployed|accttype|name|symbol|decimals|totalsupply|ext|int|token|nfts|1155|index|blooms"; - - ostringstream os; - os << "type " << toProper(route) << fn << " int" << endl; - os << endl; - os << "const (\n"; - os << "\t" << none << " " << toProper(route) << fn << " = 0" << endl; - for (size_t i = 0; i < parts.size() - (hasAll ? 2 : 0); i++) { - string_q part = parts[i]; - os << "\t" << r << firstUpper(part); - if (i == 0) { - os << " = 1 << iota"; - } - os << endl; - } - if (hasAll) { - os << "\t" << some << " = "; - bool first = true; - for (auto p : parts) { - if (containsI(inc, p)) { - if (!first) - os << " | "; - os << r << firstUpper(p); - first = false; - } - } - os << endl; - os << "\t" << all << " = "; - for (size_t i = 0; i < parts.size() - 2; ++i) { - if (i > 0) - os << " | "; - os << r << firstUpper(parts[i]); - } - os << endl; - } - os << ")" << endl; - os << endl; - - os << "func (v " << toProper(route) << fn << ") String() string {\n"; - - os << "\tswitch v {" << endl; - os << "\tcase " << none << ":" << endl; - os << "\t\treturn \"none\"" << endl; - if (hasAll) { - os << "\tcase " << some << ":" << endl; - os << "\t\treturn \"some\"" << endl; - os << "\tcase " << all << ":" << endl; - os << "\t\treturn \"all\"" << endl; - } - os << "\t}" << endl; - os << endl; - - os << "\tvar m = map[" << toProper(route) << fn << "]string{" << endl; - for (auto& part : parts) { - if (part == "all" || part == "some") { - continue; - } - os << "\t\t" << r << firstUpper(part) << ": \"" << firstLower(part) << "\"," << endl; - } - os << "\t}" << endl << endl; - os << "\tvar ret []string" << endl; - os << "\tfor _, val := range []" << toProper(route) << fn << "{"; - ostringstream cases; - for (size_t i = 0; i < parts.size() - (hasAll ? 2 : 0); ++i) { - if (i > 0) - os << ", "; - os << r << firstUpper(parts[i]); - cases << "\t\tcase \"" << firstLower(parts[i]) << "\":" << endl; - cases << "\t\t\tresult |= " << r << firstUpper(parts[i]) << endl; - } - os << "} {" << endl; - os << "\t\tif v&val != 0 {" << endl; - os << "\t\t\tret = append(ret, m[val])" << endl; - os << "\t\t}" << endl; - os << "\t}" << endl << endl; - os << "\treturn strings.Join(ret, \",\")\n"; - os << "}" << endl << endl; - - const char* STR_FROMSTRS = - "func enumFrom[{PROPER}][{NAME}](values []string) ([{PROPER}][{NAME}], error) {\n" - " if len(values) == 0 {\n" - " return [{none}], fmt.Errorf(\"no value provided for [{LNAME}] option\")\n" - " }\n" - "\n" - "[{ALLTHING}] var result [{PROPER}][{NAME}]\n" - " for _, val := range values {\n" - " switch val {\n" - "[{CASES}] default:\n" - " return [{none}], fmt.Errorf(\"unknown [{LNAME}]: %s\", val)\n" - " }\n" - " }\n" - "\n" - " return result, nil\n" - "}\n"; - - string_q aStr; - if (hasAll) { - const char* STR_ALL = - "\tif len(values) == 1 && values[0] == \"all\" {\n" - "\t\treturn [{ALL}], nil\n" - "\t} else if len(values) == 1 && values[0] == \"some\" {\n" - "\t\treturn [{SOME}], nil\n" - "\t}\n\n"; - aStr = STR_ALL; - replace(aStr, "[{ALL}]", all); - replace(aStr, "[{SOME}]", some); - } - - string_q str = STR_FROMSTRS; - replaceAll(str, "[{PROPER}]", toProper(route)); - replaceAll(str, "[{CASES}]", cases.str()); - replaceAll(str, "[{LNAME}]", toLower(fn)); - replaceAll(str, "[{NAME}]", fn); - replaceAll(str, "[{none}]", none); - replaceAll(str, "[{ALLTHING}]", aStr); - os << str; - - const char* STR_ENUM_THING = - "\tcase \"[{LNAME}]\":\n" - "\t\tvar err error\n" - "\t\tvalues := strings.Split(value, \",\")\n" - "\t\tif opts.[{NAME}], err = enumFrom[{PROPER}][{NAME}](values); err != nil {\n" - "\t\t\treturn false, err\n" - "\t\t} else {\n" - "\t\t\tfound = true\n" - "\t\t}"; - string_q eT = STR_ENUM_THING; - replaceAll(eT, "[{LNAME}]", firstLower(fn)); - replaceAll(eT, "[{NAME}]", firstUpper(fn)); - replaceAll(eT, "[{PROPER}]", toProper(route)); - enumsThing << eT << endl; - - return os.str(); -} - -//------------------------------------------------------------------------------------------------------------ -bool COptions::handle_sdk_go_innersdk(void) { - string_q path = getCWD() + "apps/chifra/sdk/"; - establishFolder(path); - - for (auto ep : endpointArray) { - if (!isApiRoute(ep.api_route) || ep.api_route == "explore") { - continue; - } - - string_q contents = asciiFileToString(getPathToTemplates("blank_sdk.go.tmpl")); - contents = substitute(contents, "[{PROPER}]", toProper(ep.api_route)); - contents = substitute(contents, "[{LOWER}]", toLower(ep.api_route)); - - string_q package = toLower(ep.api_route) + (toLower(ep.api_route) == "init" ? "Pkg" : ""); - contents = substitute(contents, "[{PKG}]", package); - - codewrite_t cw(path + ep.api_route + ".go", contents); - cw.nSpaces = 0; - cw.stripEOFNL = false; - counter.nProcessed += writeCodeIn(this, cw); - counter.nVisited++; - } - - return true; -} - -//------------------------------------------------------------------------------------------------------------ -bool COptions::handle_sdk_go_outersdk(void) { - string_q path = getCWD() + "../sdk/go/"; - establishFolder(path); - - for (auto ep : endpointArray) { - if (!isApiRoute(ep.api_route) || ep.api_route == "explore") { - continue; - } - - size_t maxNameWid = 0; - size_t maxTypeWid = 0; - ostringstream fields, enums, enumsThing; - for (auto member : routeOptionArray) { - if (member.generate == "config") { - continue; - } - bool isOne = member.api_route == ep.api_route && member.isChifraRoute(true); - if (isOne) { - string_q fn = substitute(toProper(member.longName), "_", ""); - if (fn == "Blocks") { - fn = "BlockIds"; - } else if (fn == "Transactions") { - fn = "TransactionIds"; - } - maxNameWid = max(maxNameWid, (fn).size() + 1); - string_q t = member.go_intype; - if (member.data_type == "" || member.data_type == "") { - t = "base.Blknum"; - } else if (member.data_type == "list") { - t = "[]string"; - } else if (member.data_type == "list") { - t = "[]string"; - } else if (member.data_type == "list") { - t = "[]string"; - } else if (contains(member.data_type, "enum")) { - t = toProper(member.api_route) + toProper(member.longName); - // enums << handle_sdk_go_enum(ep.api_route, fn, member) << endl; - } else if (contains(member.data_type, "address")) { - t = "base.Address"; - } else if (contains(member.data_type, "topic")) { - t = "base.Topic"; - } - maxTypeWid = max(maxTypeWid, t.size() + 1); - } - } - - for (auto member : routeOptionArray) { - if (member.generate == "config") { - continue; - } - - bool isOne = member.api_route == ep.api_route && member.isChifraRoute(true); - if (isOne) { - string_q fn = substitute(toProper(member.longName), "_", ""); - if (fn == "Blocks") { - fn = "BlockIds"; - } else if (fn == "Transactions") { - fn = "TransactionIds"; - } - string_q t = member.go_intype; - if (member.data_type == "" || member.data_type == "") { - t = "base.Blknum"; - } else if (member.data_type == "list") { - t = "[]string"; - } else if (member.data_type == "list") { - t = "[]string"; - } else if (member.data_type == "list") { - t = "[]string"; - } else if (contains(member.data_type, "enum")) { - t = toProper(member.api_route) + toProper(member.longName); - enums << handle_sdk_go_enum(ep.api_route, fn, member, enumsThing) << endl; - } else if (contains(member.data_type, "address")) { - t = "base.Address"; - } else if (contains(member.data_type, "topic")) { - t = "base.Topic"; - } - ostringstream f; - f << padRight(fn + " ", maxNameWid) << t; - fields << "\t" << padRight(f.str(), maxNameWid + maxTypeWid); - fields << "`json:\"" << substitute(firstLower(fn), "Ids", "s") << ",omitempty\"`" << endl; - if (!(member.option_type % "positional")) { - reportOneOption(ep.api_route, toCamelCase(member.longName), "go-sdk"); - } - } - } - fields << "\t" << toProper("Globals") << endl << endl; - - string_q caps = get_corrected_caps(ep.capabilities); - CStringArray globals; - explode(globals, caps, '|'); - for (auto global : globals) { - reportOneOption(ep.api_route, global, "go-sdk"); - } - - string_q package = toLower(ep.api_route) + (toLower(ep.api_route) == "init" ? "Pkg" : ""); - string_q contents = asciiFileToString(getPathToTemplates("blank_sdk2.go.tmpl")); - contents = substitute(contents, "[{FIELDS}]", fields.str()); - contents = substitute(contents, "[{ENUMS1}]", enums.str() == "" ? "// No enums\n\n" : enums.str()); - contents = substitute(contents, "[{PROPER}]", toProper(ep.api_route)); - contents = substitute(contents, "[{LOWER}]", toLower(ep.api_route)); - contents = substitute(contents, "[{PKG}]", package); - if (enumsThing.str() == "") { - contents = substitute(substitute(contents, "[{ENUMS2}]", "\t// No enums\n\n"), "opts, ok := target.(*", - "_, ok := target.(*"); - } else { - contents = substitute(contents, "[{ENUMS2}]", "\tswitch key {\n" + enumsThing.str() + "\t}\n"); - } - - codewrite_t cw(path + ep.api_route + ".go", contents); - cw.nSpaces = 0; - cw.stripEOFNL = false; - counter.nProcessed += writeCodeIn(this, cw); - counter.nVisited++; - } - - return true; -} diff --git a/src/dev_tools/makeClass/handle_sdk_py.cpp b/src/dev_tools/makeClass/handle_sdk_py.cpp deleted file mode 100644 index 6554f85017..0000000000 --- a/src/dev_tools/makeClass/handle_sdk_py.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/*------------------------------------------------------------------------------------------- - * qblocks - fast, easily-accessible, fully-decentralized data from blockchains - * copyright (c) 2016, 2021 TrueBlocks, LLC (http://trueblocks.io) - * - * This program is free software: you may redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. You should have received a copy of the GNU General - * Public License along with this program. If not, see http://www.gnu.org/licenses/. - *-------------------------------------------------------------------------------------------*/ -#include "utillib.h" -#include "options.h" - -//------------------------------------------------------------------------------------------------------------ -bool COptions::handle_sdk_py(void) { - CStringArray types, paths; - if (!handle_sdk_py_types(types)) { - return false; - } - - if (!handle_sdk_py_paths(paths)) { - return false; - } - - return true; -} diff --git a/src/dev_tools/makeClass/handle_sdk_py_paths.cpp b/src/dev_tools/makeClass/handle_sdk_py_paths.cpp deleted file mode 100644 index 97f5e083b1..0000000000 --- a/src/dev_tools/makeClass/handle_sdk_py_paths.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/*------------------------------------------------------------------------------------------- - * qblocks - fast, easily-accessible, fully-decentralized data from blockchains - * copyright (c) 2016, 2021 TrueBlocks, LLC (http://trueblocks.io) - * - * This program is free software: you may redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. You should have received a copy of the GNU General - * Public License along with this program. If not, see http://www.gnu.org/licenses/. - *-------------------------------------------------------------------------------------------*/ -#include "utillib.h" -#include "options.h" - -//------------------------------------------------------------------------------------------------------------ -extern string_q getGlobalFeature(const string_q& route, const string_q& feature); - -//------------------------------------------------------------------------------------------------------------ -string_q getGlobals(const CCommandOption& ep) { - ostringstream os; - - string_q caps = get_corrected_caps(ep.capabilities); - CStringArray globals; - explode(globals, caps, '|'); - for (auto global : globals) { - string_q g = getGlobalFeature(ep.api_route, global); - CStringArray parts; - explode(parts, g, '|'); - if (parts.size() < 4) - continue; - string_q line = " \"[{LONGNAME}]\": {\"hotkey\": \"[{HOTKEY}]\", \"type\": \"[{TYPE}]\"},"; - ; - - string_q optionName = parts[0]; - replace(line, "[{LONGNAME}]", optionName); - replace(line, "[{HOTKEY}]", parts[3]); - replace(line, "[{TYPE}]", parts[2] == "boolean" ? "switch" : "flag"); - os << line << endl; - - reportOneOption(ep.api_route, optionName, "python-sdk"); - } - return os.str(); -} - -//------------------------------------------------------------------------------------------------------------ -bool COptions::handle_sdk_py_paths(CStringArray& pathsOut) { - for (auto ep : endpointArray) { - string_q apiRoute = ep.api_route; - - CStringArray types; - getReturnTypes(ep, types); - if (!isApiRoute(apiRoute) || types.empty()) { - // if there is no route nor any returned data, do nothing - continue; - } - - ostringstream filename; - filename << sdkPath << "python/src/_" << apiRoute << ".py"; - - CCommandOptionArray members; - for (auto option : routeOptionArray) { - if (option.isChifraRoute(false) && option.api_route == apiRoute) { - members.push_back(option); - } - } - - counter.cmdCount += members.size(); - counter.routeCount++; - - string_q source = asciiFileToString(getPathToTemplates("python.tmpl")); - replaceAll(source, "[{ROUTE}]", apiRoute); - - if (apiRoute != "daemon" && apiRoute != "explore") { - string_q firstPos; - ostringstream params; - for (auto member : members) { - string_q line = " \"[{LONGNAME}]\": {\"hotkey\": \"[{HOTKEY}]\", \"type\": \"[{TYPE}]\"},\n"; - string_q optionName = toCamelCase(member.longName); - if (!member.is_visible_docs) { - continue; - } - - replace(line, "[{LONGNAME}]", optionName); - replace(line, "[{HOTKEY}]", member.hotKey.empty() ? "" : "-" + member.hotKey); - replace(line, "[{TYPE}]", member.option_type); - if (member.option_type == "positional") { - if (firstPos.empty()) { - firstPos = member.longName; - } - } else { - params << line; - reportOneOption(apiRoute, optionName, "python-sdk"); - } - } - - replace(source, "[{GLOBALS}]", getGlobals(ep)); - replace(source, "[{OPTIONS}]", params.str()); - replace(source, "[{FIRST}]", firstPos); - } - writeIfDifferent(filename.str(), source + "\n"); - } - - ostringstream log; - log << cYellow << "makeClass --sdk (python)" << cOff; - log << " processed " << counter.routeCount << "/" << counter.cmdCount; - log << " paths (changed " << counter.nProcessed << ")." << string_q(40, ' '); - LOG_INFO(log.str()); - - return true; -} diff --git a/src/dev_tools/makeClass/handle_sdk_py_types.cpp b/src/dev_tools/makeClass/handle_sdk_py_types.cpp deleted file mode 100644 index 9a7edaeca8..0000000000 --- a/src/dev_tools/makeClass/handle_sdk_py_types.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/*------------------------------------------------------------------------------------------- - * qblocks - fast, easily-accessible, fully-decentralized data from blockchains - * copyright (c) 2016, 2021 TrueBlocks, LLC (http://trueblocks.io) - * - * This program is free software: you may redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. You should have received a copy of the GNU General - * Public License along with this program. If not, see http://www.gnu.org/licenses/. - *-------------------------------------------------------------------------------------------*/ -#include "utillib.h" -#include "options.h" - -//------------------------------------------------------------------------------------------------------------ -bool COptions::handle_sdk_py_types(CStringArray& typesOut) { - return true; -} diff --git a/src/dev_tools/makeClass/handle_sdk_ts.cpp b/src/dev_tools/makeClass/handle_sdk_ts.cpp deleted file mode 100644 index 9b76bd19b0..0000000000 --- a/src/dev_tools/makeClass/handle_sdk_ts.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/*------------------------------------------------------------------------------------------- - * qblocks - fast, easily-accessible, fully-decentralized data from blockchains - * copyright (c) 2016, 2021 TrueBlocks, LLC (http://trueblocks.io) - * - * This program is free software: you may redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. You should have received a copy of the GNU General - * Public License along with this program. If not, see http://www.gnu.org/licenses/. - *-------------------------------------------------------------------------------------------*/ -#include "utillib.h" -#include "options.h" - -//------------------------------------------------------------------------------------------------------------ -bool COptions::handle_sdk_ts(void) { - CStringArray types, paths; - if (!handle_sdk_ts_types(types)) { - return false; - } - - if (!handle_sdk_ts_paths(paths)) { - return false; - } - - types.push_back("Basetypes"); - sort(types.begin(), types.end()); - ostringstream os1; - for (auto type : types) - os1 << "export * from './" << firstLower(type) << "';" << endl; - os1 << "export * from './upgrades';" << endl; - string_q typesPath = sdkPath + "typescript/src/types/index.ts"; - writeIfDifferent(typesPath, os1.str()); - - sort(paths.begin(), paths.end()); - ostringstream os2; - for (auto path : paths) { - os2 << "export * from './" << path << "';" << endl; - } - string_q pathsPath = sdkPath + "typescript/src/paths/index.ts"; - writeIfDifferent(pathsPath, os2.str()); - - return true; -} diff --git a/src/dev_tools/makeClass/handle_sdk_ts_paths.cpp b/src/dev_tools/makeClass/handle_sdk_ts_paths.cpp deleted file mode 100644 index 1ffead8b62..0000000000 --- a/src/dev_tools/makeClass/handle_sdk_ts_paths.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/*------------------------------------------------------------------------------------------- - * qblocks - fast, easily-accessible, fully-decentralized data from blockchains - * copyright (c) 2016, 2021 TrueBlocks, LLC (http://trueblocks.io) - * - * This program is free software: you may redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. You should have received a copy of the GNU General - * Public License along with this program. If not, see http://www.gnu.org/licenses/. - *-------------------------------------------------------------------------------------------*/ -#include "utillib.h" -#include "options.h" - -//------------------------------------------------------------------------------------------------------------ -const char* STR_TYPESCRIPT_PATH_CODE = - "/* eslint object-curly-newline: [\"error\", \"never\"] */\n" - "/* eslint max-len: [\"error\", 160] */\n" - "/*\n" - " * This file was generated with makeClass --sdk. Do not edit it.\n" - " */\n" - "import * as ApiCallers from '../lib/api_callers';\n" - "import { [{TYPES}] } from '../types';\n" - "\n" - "export function get[{ROUTE}](\n" - " parameters?: {\n" - "[{PARAMS}]\n[{GLOBALS}] },\n" - " options?: RequestInit,\n" - ") {\n" - " return ApiCallers.fetch<[{RETTYPE}]>(\n" - " { endpoint: '/[{LOWER}]', method: 'get', parameters, options },\n" - " );\n" - "}\n"; - -//------------------------------------------------------------------------------------------------------------ -string_q toTsType(const string_q& in, map& map) { - string_q ret = in; - if (contains(ret, "list<")) { - ret = substitute(ret, "list<", ""); - ret = substitute(ret, ">", ""); - ret += "[]"; - } - - if (startsWith(ret, "enum[") && contains(ret, "[]")) { - ret = "string[]"; - } - - ret = substitute(ret, "addr[]", "address[]"); - ret = substitute(ret, "", "boolean"); - ret = substitute(ret, "", "uint64"); - ret = substitute(ret, "", "blknum"); - ret = substitute(ret, "", "string"); - ret = substitute(ret, "", "double"); - ret = substitute(ret, "
", "address"); - ret = substitute(ret, "tx_id", "txId"); - if (!contains(ret, "enum") && !contains(ret, "string") && ret != "boolean") { - string_q val = substitute(ret, "[]", ""); - map[toLower(val)] = val; - } - if (contains(ret, "enum[")) { - ret = substitute(ret, "enum[", "'"); - ret = substitute(ret, "]", "'"); - ret = substitute(ret, "|", "' | '"); - } - - return ret; -} - -//------------------------------------------------------------------------------------------------------------ -string_q get_corrected_caps(const string_q& capsIn) { - string_q x = "fmt|chain|noHeader"; - string_q capsOut = substitute(capsIn, "default", x); - replace(capsOut, "caching", "cache|decache"); - replace(capsOut, "verbose|", ""); - replace(capsOut, "version|", ""); - replace(capsOut, "noop|", ""); - replace(capsOut, "noColor|", ""); - replace(capsOut, "help|", ""); - return capsOut; -} - -//------------------------------------------------------------------------------------------------------------ -string_q getGlobalParams(const string_q& s1, const string_q& route) { - string_q caps = get_corrected_caps(s1); - CStringArray globals; - explode(globals, caps, '|'); - - ostringstream os; - for (auto global : globals) { - os << " " << global << (global == "chain" ? "" : "?") << ": "; - if (global == "chain" || global == "fmt") { - os << "string,\n"; - } else { - os << "boolean,\n"; - } - reportOneOption(route, global, "typescript-sdk"); - } - return os.str(); -} - -//------------------------------------------------------------------------------------------------------------ -bool COptions::handle_sdk_ts_paths(CStringArray& pathsOut) { - for (auto ep : endpointArray) { - string_q apiRoute = ep.api_route; - - CStringArray types; - getReturnTypes(ep, types); - if (!isApiRoute(apiRoute) || types.empty()) { - // if there is no route nor any returned data, do nothing - continue; - } - - ostringstream filename; - filename << sdkPath << "typescript/src/paths/" << apiRoute << ".ts"; - - CCommandOptionArray members; - for (auto option : routeOptionArray) { - if (option.isChifraRoute(false) && option.api_route == apiRoute) { - members.push_back(option); - } - } - - counter.cmdCount += members.size(); - counter.routeCount++; - - ostringstream returns; - map imports; - for (auto type : types) { - if (returns.str() != "" && returns.str() != "void") { - returns << " | "; - } - returns << firstUpper(type) << "[]"; - imports[type] = firstUpper(type); - } - - ostringstream params; - for (auto member : members) { - if (!member.is_visible_docs) { - continue; - } - string_q optionName = toCamelCase(member.longName); - params << " " << optionName; - params << (member.is_required ? "" : "?") << ": "; - params << toTsType(member.data_type, imports) << ","; - params << endl; - - if (member.option_type != "positional") { - reportOneOption(apiRoute, optionName, "typescript-sdk"); - } - } - - ostringstream typeImports; - for (auto imp : imports) { - string_q type = imp.second; - if (type % "any") { - continue; - } - if (typeImports.str() != "") { - typeImports << ", "; - } - typeImports << type; - } - - string_q source = STR_TYPESCRIPT_PATH_CODE; - replaceAll(source, "[{ROUTE}]", toProper(apiRoute)); - replaceAll(source, "[{LOWER}]", toLower(apiRoute)); - replaceAll(source, "[{RETTYPE}]", trim(returns.str(), '\n')); - replaceAll(source, "[{TYPES}]", trim(typeImports.str(), '\n')); - replaceAll(source, "[{PARAMS}]", trim(params.str(), '\n')); - replaceAll(source, "[{GLOBALS}]", getGlobalParams(ep.capabilities, apiRoute)); - - pathsOut.push_back(apiRoute); - writeIfDifferent(filename.str(), source); - } - - ostringstream log; - log << cYellow << "makeClass --sdk (typescript)" << cOff; - log << " processed " << counter.routeCount << "/" << counter.cmdCount; - log << " paths (changed " << counter.nProcessed << ")." << string_q(40, ' '); - LOG_INFO(log.str()); - - return true; -} diff --git a/src/dev_tools/makeClass/handle_sdk_ts_types.cpp b/src/dev_tools/makeClass/handle_sdk_ts_types.cpp deleted file mode 100644 index 1a156e4bdc..0000000000 --- a/src/dev_tools/makeClass/handle_sdk_ts_types.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/*------------------------------------------------------------------------------------------- - * qblocks - fast, easily-accessible, fully-decentralized data from blockchains - * copyright (c) 2016, 2021 TrueBlocks, LLC (http://trueblocks.io) - * - * This program is free software: you may redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. You should have received a copy of the GNU General - * Public License along with this program. If not, see http://www.gnu.org/licenses/. - *-------------------------------------------------------------------------------------------*/ -#include "utillib.h" -#include "options.h" - -//------------------------------------------------------------------------------------------------------------ -string_q type2Key(const string_q& in) { - string_q ret = in; - if (contains(ret, "list<")) { - ret = substitute(ret, "list<", ""); - ret = substitute(ret, ">", ""); - } - if (contains(ret, "enum[")) { - ret = substitute(ret, "enum[", ""); - ret = substitute(ret, "]", ""); - } - if (startsWith(ret, "int")) { - string_q key = substitute(ret, "int", ""); - ret = "int" + padLeft(key, 5, '0'); - } - if (startsWith(ret, "uint")) { - string_q key = substitute(ret, "uint", ""); - ret = "uint" + padLeft(key, 5, '0'); - } - ret = toLower(ret); - return ret; -} - -//------------------------------------------------------------------------------------------------------------ -bool COptions::handle_sdk_ts_types(CStringArray& typesOut) { - for (auto model : dataModels) { - if (model.doc_route == "no_doc") { - continue; - } - string_q modelName = substitute(model.class_name, "Array", ""); - modelName = firstUpper(modelName); - replace(modelName, "C", ""); - if (modelName == "Status") { - modelName = "Config"; - } - - map imports; - ostringstream fieldStream; - for (auto field : model.fieldArray) { - if (endsWith(field.type, "Map") || field.type == "CKeyArray" || field.type == "Value" || - field.type == "topic" || startsWith(field.name, "unused") || contains(field.name, "::") || - containsI(field.type, "storageslot") || field.type % "any") { - continue; - } - bool isArray = contains(field.type, "Array"); - string_q ft = substitute(substitute(substitute(field.type, "Array", ""), "Ptr", ""), "uint8", "bool"); - if (startsWith(field.type, "C")) { - replace(ft, "C", ""); - } - if (isArray) { - ft = ft + "[]"; - } - ft = substitute(ft, "String", "string"); - ft = substitute(ft, "Topic", "topic"); - ft = substitute(ft, "Address", "address"); - ft = substitute(ft, "Any", "any"); - ft = substitute(ft, "Hash", "hash"); - ft = substitute(ft, "[]string", "string[]"); - replace(ft, "bool", "boolean"); - - bool isOptional = field.memberFlags & IS_OMITEMPTY; - if (field.name == "fromName" || field.name == "toName") { - isOptional = true; - } - fieldStream << " " << field.name << (isOptional ? "?" : "") << ": " << ft << endl; - replace(ft, "[]", ""); - - if (ft != modelName) { - imports[type2Key(toLower(ft))] = ft; - } - } - - const char* STR_HEADER1 = - "/* eslint object-curly-newline: [\"error\", \"never\"] */\n" - "/* eslint max-len: [\"error\", 160] */\n" - "/*\n" - " * This file was generated with makeClass --sdk. Do not edit it.\n" - " */[{IMPORTS}]\n"; - - ostringstream os; - os << STR_HEADER1; - os << "export type " << modelName << " = {" << endl; - os << fieldStream.str(); - os << "}" << endl; - string_q contents = os.str(); - - if (imports.size() > 0) { - ostringstream imps; - for (auto imp : imports) { - if (imp.second == "string" || imp.second == "boolean" || imp.second == "any") { - continue; - } - if (imps.str() != "") { - imps << ", "; - } - imps << imp.second; - } - - if (imps.str() != "") { - ostringstream importLine; - importLine << endl << "import { " << imps.str() << " } from '.';" << endl; - replace(contents, "[{IMPORTS}]", importLine.str()); - } else { - replace(contents, "[{IMPORTS}]", ""); - } - } - - typesOut.push_back(modelName); - string_q fileName = sdkPath + "typescript/src/types/" + firstLower(modelName) + ".ts"; - writeIfDifferent(fileName, contents); - } - - return true; -} diff --git a/src/dev_tools/makeClass/options.cpp b/src/dev_tools/makeClass/options.cpp index a4c7dd0a77..2f45b7185f 100644 --- a/src/dev_tools/makeClass/options.cpp +++ b/src/dev_tools/makeClass/options.cpp @@ -26,7 +26,6 @@ static const COption params[] = { COption("gocmds", "g", "", OPT_SWITCH, "export go command code"), COption("readmes", "m", "", OPT_SWITCH, "create readme files for each tool and app"), COption("format", "f", "", OPT_SWITCH, "format source code files (.cpp and .h) found in local folder and below"), - COption("sdk", "s", "", OPT_SWITCH, "create typescript sdk"), COption("openapi", "A", "", OPT_SWITCH, "export openapi.yaml file for API documentation"), COption("protobuf", "p", "", OPT_SWITCH, "compile protobufs"), COption("", "", "", OPT_DESCRIPTION, "Automatically writes C++ for various purposes."), @@ -71,9 +70,6 @@ bool COptions::parseArguments(string_q& command) { } else if (arg == "-f" || arg == "--format") { format = true; - } else if (arg == "-s" || arg == "--sdk") { - sdk = true; - } else if (arg == "-A" || arg == "--openapi") { openapi = true; @@ -202,8 +198,6 @@ bool COptions::parseArguments(string_q& command) { return false; if (format && !handle_format()) return false; - if (sdk && !handle_sdk()) - return false; if (protobuf && !handle_protobuf()) return false; @@ -218,7 +212,7 @@ bool COptions::parseArguments(string_q& command) { return usage(usageErrs[ERR_NEEDONECLASS]); // We need the template files - CStringArray templs = {"", "blank.yaml", "blank.cpp", "blank.h", "blank.go.tmpl", "blank_options.go.tmpl"}; + CStringArray templs = {"", "blank.yaml", "blank_options.go.tmpl"}; for (auto temp : templs) { if (!fileExists(getPathToTemplates(temp))) { return makeError(ERR_CONFIGMISSING, getPathToTemplates(temp)); @@ -235,7 +229,6 @@ void COptions::Init(void) { // END_CODE_GLOBALOPTS all = false; - sdk = false; openapi = false; classDefs.clear(); @@ -415,3 +408,16 @@ void COptions::verifyDescriptions(void) { } } } + +//------------------------------------------------------------------------------------------------------------ +string_q get_corrected_caps(const string_q& capsIn) { + string_q x = "fmt|chain|noHeader"; + string_q capsOut = substitute(capsIn, "default", x); + replace(capsOut, "caching", "cache|decache"); + replace(capsOut, "verbose|", ""); + replace(capsOut, "version|", ""); + replace(capsOut, "noop|", ""); + replace(capsOut, "noColor|", ""); + replace(capsOut, "help|", ""); + return capsOut; +} diff --git a/src/dev_tools/makeClass/options.h b/src/dev_tools/makeClass/options.h index 3fe5097171..0aded38264 100644 --- a/src/dev_tools/makeClass/options.h +++ b/src/dev_tools/makeClass/options.h @@ -38,7 +38,6 @@ class CCounter { class COptions : public COptionsBase { public: bool all; - bool sdk; bool openapi; bool protobuf; @@ -56,7 +55,7 @@ class COptions : public COptionsBase { map hugoAliasMap; ostringstream goCallStream, goPkgStream; - ostringstream goRouteStream, chifraHelpStream; + ostringstream goRouteStream; ostringstream apiTagStream, apiPathStream; ostringstream goStream; @@ -71,17 +70,6 @@ class COptions : public COptionsBase { bool handle_format(void); bool handle_datamodel(void); - bool handle_sdk(void); - bool handle_sdk_ts(void); - bool handle_sdk_ts_paths(CStringArray& pathsOut); - bool handle_sdk_ts_types(CStringArray& typesOut); - bool handle_sdk_py(void); - bool handle_sdk_py_paths(CStringArray& pathsOut); - bool handle_sdk_py_types(CStringArray& typesOut); - bool handle_sdk_go(void); - bool handle_sdk_go_innersdk(void); - bool handle_sdk_go_outersdk(void); - bool handle_gocmds_cmd(const CCommandOption& ep); bool handle_gocmds_options(const CCommandOption& ep); bool handle_gocmds_docfile(const CCommandOption& ep); From 31498c887149256c811e06c8154700ced6cf0fa8 Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 15:33:45 -0400 Subject: [PATCH 08/20] Removes no longer needed templates --- src/dev_tools/makeClass/templates/blank.cpp | 237 ------------------ src/dev_tools/makeClass/templates/blank.h | 142 ----------- .../makeClass/templates/blank_sdk.go.tmpl | 34 --- .../makeClass/templates/blank_sdk2.go.tmpl | 60 ----- .../makeClass/templates/help_text.go.tmpl | 10 - src/dev_tools/makeClass/templates/python.tmpl | 18 -- .../makeClass/templates/version.go.tmpl | 10 - 7 files changed, 511 deletions(-) delete mode 100644 src/dev_tools/makeClass/templates/blank.cpp delete mode 100644 src/dev_tools/makeClass/templates/blank.h delete mode 100644 src/dev_tools/makeClass/templates/blank_sdk.go.tmpl delete mode 100644 src/dev_tools/makeClass/templates/blank_sdk2.go.tmpl delete mode 100644 src/dev_tools/makeClass/templates/help_text.go.tmpl delete mode 100644 src/dev_tools/makeClass/templates/python.tmpl delete mode 100644 src/dev_tools/makeClass/templates/version.go.tmpl diff --git a/src/dev_tools/makeClass/templates/blank.cpp b/src/dev_tools/makeClass/templates/blank.cpp deleted file mode 100644 index e311c9fe08..0000000000 --- a/src/dev_tools/makeClass/templates/blank.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/*------------------------------------------------------------------------------------------- - * qblocks - fast, easily-accessible, fully-decentralized data from blockchains - * copyright (c) 2016, 2021 TrueBlocks, LLC (http://trueblocks.io) - * - * This program is free software: you may redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. You should have received a copy of the GNU General - * Public License along with this program. If not, see http://www.gnu.org/licenses/. - *-------------------------------------------------------------------------------------------*/ -/* - * Parts of this file were generated with makeClass --run. Edit only those parts of - * the code inside of 'EXISTING_CODE' tags. - */ -// clang-format off -#include "[{FN}].h" -[OTHER_INCS] -[{NAMESPACE1}] -//--------------------------------------------------------------------------- -IMPLEMENT_NODE([{CLASS_NAME}], [{BASE_CLASS}]); - -//--------------------------------------------------------------------------- -extern string_q next[{PROPER}]Chunk(const string_q& fieldIn, const void* dataPtr); -static string_q next[{PROPER}]Chunk_custom(const string_q& fieldIn, const void* dataPtr); - -//--------------------------------------------------------------------------- -void [{CLASS_NAME}]::Format(ostream& ctx, const string_q& fmtIn, void* dataPtr) const { - if (!m_showing) - return; - - // EXISTING_CODE - // EXISTING_CODE - - string_q fmt = (fmtIn.empty() ? expContext().fmtMap["[{LONG}]_fmt"] : fmtIn); - if (fmt.empty()) { - toJson(ctx); - return; - } - - // EXISTING_CODE - // EXISTING_CODE - - while (!fmt.empty()) - ctx << getNextChunk(fmt, next[{PROPER}]Chunk, this); -} - -//--------------------------------------------------------------------------- -string_q next[{PROPER}]Chunk(const string_q& fieldIn, const void* dataPtr) { - if (dataPtr) - return reinterpret_cast(dataPtr)->getValueByName(fieldIn); - - // EXISTING_CODE - // EXISTING_CODE - - return fldNotFound(fieldIn); -} - -//--------------------------------------------------------------------------- -string_q [{CLASS_NAME}]::getValueByName(const string_q& fieldName) const { - // Give customized code a chance to override first - string_q ret = next[{PROPER}]Chunk_custom(fieldName, this); - if (!ret.empty()) - return ret; - - // EXISTING_CODE - // EXISTING_CODE - - [GET_CASE_CODE] -[PARENT_GETBYVALUE] - // EXISTING_CODE - // EXISTING_CODE - -[CHILD_OBJ_GETTER] // Finally, give the parent class a chance - return [{BASE_CLASS}]::getValueByName(fieldName); -} - -//--------------------------------------------------------------------------------------------------- -bool [{CLASS_NAME}]::setValueByName(const string_q& fieldNameIn, const string_q& fieldValueIn) { - string_q fieldName = fieldNameIn; - string_q fieldValue = fieldValueIn; - - // EXISTING_CODE - // EXISTING_CODE - -[{PARENT_SET}] switch (tolower(fieldName[0])) { -[SET_CASE_CODE] } - return false; -} - -//--------------------------------------------------------------------------------------------------- -void [{CLASS_NAME}]::finishParse() { - // EXISTING_CODE - // EXISTING_CODE -} - -//--------------------------------------------------------------------------------------------------- -bool [{CLASS_NAME}]::Serialize(CArchive& archive) { - if (archive.isWriting()) - return SerializeC(archive); - - // Always read the base class (it will handle its own backLevels if any, then - // read this object's back level (if any) or the current version. - [{BASE_CLASS}]::Serialize(archive); - if (readBackLevel(archive)) - return true; - - // EXISTING_CODE - // EXISTING_CODE -[ARCHIVE_READ] // EXISTING_CODE - // EXISTING_CODE - finishParse(); - return true; -} - -//--------------------------------------------------------------------------------------------------- -bool [{CLASS_NAME}]::SerializeC(CArchive& archive) const { - // Writing always writes the latest version of the data -[{PARENT_SER}] - // EXISTING_CODE - // EXISTING_CODE -[ARCHIVE_WRITE] // EXISTING_CODE - // EXISTING_CODE - return true; -} - -//--------------------------------------------------------------------------------------------------- -bool [{CLASS_NAME}]::Migrate(CArchive& archiveIn, CArchive& archiveOut) const { - ASSERT(archiveIn.isReading()); - ASSERT(archiveOut.isWriting()); - [{CLASS_NAME}] copy; - // EXISTING_CODE - // EXISTING_CODE - copy.Serialize(archiveIn); - copy.SerializeC(archiveOut); - return true; -} - -//--------------------------------------------------------------------------- -CArchive& operator>>(CArchive& archive, [{CLASS_NAME}]Array& array) { - uint64_t count; - archive >> count; - array.resize(count); - for (size_t i = 0; i < count; i++) { - ASSERT(i < array.capacity()); - array.at(i).Serialize(archive); - } - return archive; -} - -//--------------------------------------------------------------------------- -CArchive& operator<<(CArchive& archive, const [{CLASS_NAME}]Array& array) { - uint64_t count = array.size(); - archive << count; - for (size_t i = 0; i < array.size(); i++) - array[i].SerializeC(archive); - return archive; -} - -//--------------------------------------------------------------------------- -void [{CLASS_NAME}]::registerClass(void) { - // only do this once - if (HAS_FIELD([{CLASS_NAME}], "schema")) - return; - - [{PARENT_REG}]size_t fieldNum = 1000; - ADD_FIELD([{CLASS_NAME}], "schema", T_NUMBER, ++fieldNum); - ADD_FIELD([{CLASS_NAME}], "deleted", T_BOOL, ++fieldNum); - ADD_FIELD([{CLASS_NAME}], "showing", T_BOOL, ++fieldNum); - ADD_FIELD([{CLASS_NAME}], "cname", T_TEXT, ++fieldNum); -[ADD_FIELDS][HIDE_FIELDS] - - // Hide our internal fields, user can turn them on if they like - HIDE_FIELD([{CLASS_NAME}], "schema"); - HIDE_FIELD([{CLASS_NAME}], "deleted"); - HIDE_FIELD([{CLASS_NAME}], "showing"); - HIDE_FIELD([{CLASS_NAME}], "cname"); - - builtIns.push_back(_bi[{CLASS_NAME}]); - - // EXISTING_CODE - // EXISTING_CODE -} - -//--------------------------------------------------------------------------- -string_q next[{PROPER}]Chunk_custom(const string_q& fieldIn, const void* dataPtr) { - const [{CLASS_NAME}]* [{SHORT3}] = reinterpret_cast(dataPtr); - if ([{SHORT3}]) { - switch (tolower(fieldIn[0])) { - // EXISTING_CODE - // EXISTING_CODE - case 'p': - // Display only the fields of this node, not it's parent type - if (fieldIn % "parsed") - return nextBasenodeChunk(fieldIn, [{SHORT3}]); - // EXISTING_CODE - // EXISTING_CODE - break; - - default: - break; - } - } - - return ""; -} - -// EXISTING_CODE -// EXISTING_CODE - -//--------------------------------------------------------------------------- -bool [{CLASS_NAME}]::readBackLevel(CArchive& archive) { - bool done = false; - // EXISTING_CODE - // EXISTING_CODE - return done; -} - -[OPERATORS_IMPL]//------------------------------------------------------------------------- -ostream& operator<<(ostream& os, const [{CLASS_NAME}]& it) { - // EXISTING_CODE - // EXISTING_CODE - - it.Format(os, "", nullptr); - os << "\n"; - return os; -} - -[{GET_OBJ}][{GET_STR}]//--------------------------------------------------------------------------- -const char* STR_DISPLAY_[{CLASS_UPPER}] =[{DISPLAY_FIELDS}]; - -//--------------------------------------------------------------------------- -// EXISTING_CODE -// EXISTING_CODE -[{NAMESPACE2}] -// clang-format on diff --git a/src/dev_tools/makeClass/templates/blank.h b/src/dev_tools/makeClass/templates/blank.h deleted file mode 100644 index c6269478f2..0000000000 --- a/src/dev_tools/makeClass/templates/blank.h +++ /dev/null @@ -1,142 +0,0 @@ -#pragma once -/*------------------------------------------------------------------------------------------- - * qblocks - fast, easily-accessible, fully-decentralized data from blockchains - * copyright (c) 2016, 2021 TrueBlocks, LLC (http://trueblocks.io) - * - * This program is free software: you may redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. You should have received a copy of the GNU General - * Public License along with this program. If not, see http://www.gnu.org/licenses/. - *-------------------------------------------------------------------------------------------*/ -/* - * Parts of this file were generated with makeClass --run. Edit only those parts of - * the code inside of 'EXISTING_CODE' tags. - */ -// clang-format off -[H_INCLUDES] -[{NAMESPACE1}] - -// EXISTING_CODE -// EXISTING_CODE - -//-------------------------------------------------------------------------- -class [{CLASS_NAME}] : public [{BASE_CLASS}] { - public: -[FIELD_DEC] - public: - [{CLASS_NAME}](void); - [{CLASS_NAME}](const [{CLASS_NAME}]& [{SHORT}]); - ~[{CLASS_NAME}](void); - [{CLASS_NAME}]& operator=(const [{CLASS_NAME}]& [{SHORT}]); - - DECLARE_NODE([{CLASS_NAME}]); - -[{GET_OBJ}][{GET_STR}] // EXISTING_CODE - // EXISTING_CODE - bool operator==(const [{CLASS_NAME}]& it) const; - bool operator!=(const [{CLASS_NAME}]& it) const { - return !operator==(it); - } - friend bool operator<(const [{CLASS_NAME}]& v1, const [{CLASS_NAME}]& v2); - friend ostream& operator<<(ostream& os, const [{CLASS_NAME}]& it); - - protected: - void clear(void); - void initialize(void); - void duplicate(const [{CLASS_NAME}]& [{SHORT}]); - bool readBackLevel(CArchive& archive) override; - - // EXISTING_CODE - // EXISTING_CODE -}; - -//-------------------------------------------------------------------------- -inline [{CLASS_NAME}]::[{CLASS_NAME}](void) { - initialize(); - // EXISTING_CODE - // EXISTING_CODE -} - -//-------------------------------------------------------------------------- -inline [{CLASS_NAME}]::[{CLASS_NAME}](const [{CLASS_NAME}]& [{SHORT}]) { - // EXISTING_CODE - // EXISTING_CODE - duplicate([{SHORT}]); -} - -// EXISTING_CODE -// EXISTING_CODE - -//-------------------------------------------------------------------------- -inline [{CLASS_NAME}]::~[{CLASS_NAME}](void) { - clear(); - // EXISTING_CODE - // EXISTING_CODE -} - -//-------------------------------------------------------------------------- -inline void [{CLASS_NAME}]::clear(void) { -[FIELD_CLEAR] // EXISTING_CODE - // EXISTING_CODE -} - -//-------------------------------------------------------------------------- -inline void [{CLASS_NAME}]::initialize(void) { - [{BASE_CLASS}]::initialize(); - -[INIT_DEFAULTS] - // EXISTING_CODE - // EXISTING_CODE -} - -//-------------------------------------------------------------------------- -inline void [{CLASS_NAME}]::duplicate(const [{CLASS_NAME}]& [{SHORT}]) { - clear(); - [{BASE_CLASS}]::duplicate([{SHORT}]); - -[FIELD_COPY] - // EXISTING_CODE - // EXISTING_CODE -} - -//-------------------------------------------------------------------------- -inline [{CLASS_NAME}]& [{CLASS_NAME}]::operator=(const [{CLASS_NAME}]& [{SHORT}]) { - duplicate([{SHORT}]); - // EXISTING_CODE - // EXISTING_CODE - return *this; -} - -//------------------------------------------------------------------------- -inline bool [{CLASS_NAME}]::operator==(const [{CLASS_NAME}]& it) const { - // EXISTING_CODE - // EXISTING_CODE - // [{EQUAL_COMMENT}] - return [{EQUAL_CODE}]; -} - -//------------------------------------------------------------------------- -inline bool operator<(const [{CLASS_NAME}]& v1, const [{CLASS_NAME}]& v2) { - // EXISTING_CODE - // EXISTING_CODE - // [{SORT_COMMENT}] - return [{SORT_CODE}]; -} - -//--------------------------------------------------------------------------- -typedef vector<[{CLASS_NAME}]> [{CLASS_NAME}]Array; -extern CArchive& operator>>(CArchive& archive, [{CLASS_NAME}]Array& array); -extern CArchive& operator<<(CArchive& archive, const [{CLASS_NAME}]Array& array); - -[OPERATORS_DECL]//--------------------------------------------------------------------------- -extern const char* STR_DISPLAY_[{CLASS_UPPER}]; - -//--------------------------------------------------------------------------- -// EXISTING_CODE -// EXISTING_CODE - -[{NAMESPACE2}] -// clang-format on diff --git a/src/dev_tools/makeClass/templates/blank_sdk.go.tmpl b/src/dev_tools/makeClass/templates/blank_sdk.go.tmpl deleted file mode 100644 index 25d9547238..0000000000 --- a/src/dev_tools/makeClass/templates/blank_sdk.go.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2024 The TrueBlocks Authors. All rights reserved. -// Use of this source code is governed by a license that can -// be found in the LICENSE file. -/* - * Parts of this file were generated with makeClass --run. Edit only those parts of - * the code inside of 'EXISTING_CODE' tags. - */ - -package sdk - -import ( - "io" - "net/url" - - [{PKG}] "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/[{LOWER}]" - outputHelpers "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output/helpers" -) - -// [{PROPER}] provides an interface to the command line chifra [{LOWER}] through the SDK. -func [{PROPER}](w io.Writer, values url.Values) error { - [{PKG}].ResetOptions(sdkTestMode) - opts := [{PKG}].[{PROPER}]FinishParseInternal(w, values) - outputHelpers.EnableCommand("[{LOWER}]", true) - // EXISTING_CODE - // EXISTING_CODE - outputHelpers.InitJsonWriterApi("[{LOWER}]", w, &opts.Globals) - err := opts.[{PROPER}]Internal() - outputHelpers.CloseJsonWriterIfNeededApi("[{LOWER}]", err, &opts.Globals) - - return err -} - -// EXISTING_CODE -// EXISTING_CODE diff --git a/src/dev_tools/makeClass/templates/blank_sdk2.go.tmpl b/src/dev_tools/makeClass/templates/blank_sdk2.go.tmpl deleted file mode 100644 index 4a5e7b4509..0000000000 --- a/src/dev_tools/makeClass/templates/blank_sdk2.go.tmpl +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2024 The TrueBlocks Authors. All rights reserved. -// Use of this source code is governed by a license that can -// be found in the LICENSE file. -/* - * Parts of this file were generated with makeClass --run. Edit only those parts of - * the code inside of 'EXISTING_CODE' tags. - */ - -package sdk - -import ( - // EXISTING_CODE - // EXISTING_CODE -) - -type [{PROPER}]Options struct { -[{FIELDS}]} - -// String implements the stringer interface -func (opts *[{PROPER}]Options) String() string { - bytes, _ := json.Marshal(opts) - return string(bytes) -} - -// [{PROPER}] implements the chifra [{LOWER}] command for the SDK. -func (opts *[{PROPER}]Options) [{PROPER}](w io.Writer) error { - values, err := structToValues(*opts) - if err != nil { - log.Fatalf("Error converting [{LOWER}] struct to URL values: %v", err) - } - - return [{PKG}].[{PROPER}](w, values) -} - -// [{LOWER}]ParseFunc handles specail cases such as structs and enums (if any). -func [{LOWER}]ParseFunc(target interface{}, key, value string) (bool, error) { - var found bool - opts, ok := target.(*[{PROPER}]Options) - if !ok { - return false, fmt.Errorf("parseFunc([{LOWER}]): target is not of correct type") - } - -[{ENUMS2}] - // EXISTING_CODE - // EXISTING_CODE - - return found, nil -} - -// Get[{PROPER}]Options returns a filled-in options instance given a string array of arguments. -func Get[{PROPER}]Options(args []string) (*[{PROPER}]Options, error) { - var opts [{PROPER}]Options - if err := assignValuesFromArgs(args, [{LOWER}]ParseFunc, &opts, &opts.Globals); err != nil { - return nil, err - } - - return &opts, nil -} - -[{ENUMS1}] diff --git a/src/dev_tools/makeClass/templates/help_text.go.tmpl b/src/dev_tools/makeClass/templates/help_text.go.tmpl deleted file mode 100644 index 8522d516f3..0000000000 --- a/src/dev_tools/makeClass/templates/help_text.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2021 The TrueBlocks Authors. All rights reserved. -// Use of this source code is governed by a license that can -// be found in the LICENSE file. -/* - * This file was auto generated with makeClass --gocmds. DO NOT EDIT. - */ - -package cmd - -const helpText = `[{HELP_TEXT}]` diff --git a/src/dev_tools/makeClass/templates/python.tmpl b/src/dev_tools/makeClass/templates/python.tmpl deleted file mode 100644 index 7c97cc875d..0000000000 --- a/src/dev_tools/makeClass/templates/python.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -# -# This file was generated with makeClass --sdk. Do not edit it. -# -from . import session - -[{ROUTE}]Cmd = "[{ROUTE}]" -[{ROUTE}]Pos = "[{FIRST}]" -[{ROUTE}]Fmt = "json" -[{ROUTE}]Opts = { -[{OPTIONS}][{GLOBALS}] "fmt": {"hotkey": "-x", "type": "flag"}, -} - -def [{ROUTE}](self): - ret = self.toUrl([{ROUTE}]Cmd, [{ROUTE}]Pos, [{ROUTE}]Fmt, [{ROUTE}]Opts) - url = 'http://localhost:8080/' + ret[1] - if ret[0] == 'json': - return session.get(url).json() - return session.get(url).text diff --git a/src/dev_tools/makeClass/templates/version.go.tmpl b/src/dev_tools/makeClass/templates/version.go.tmpl deleted file mode 100644 index fa186a0eb2..0000000000 --- a/src/dev_tools/makeClass/templates/version.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2021 The TrueBlocks Authors. All rights reserved. -// Use of this source code is governed by a license that can -// be found in the LICENSE file. -/* - * This file was auto generated with makeClass --gocmds. DO NOT EDIT. - */ - -package version - -const LibraryVersion = "[{VERSION}]" From 924499d73e0dfff7b292f7119351bf7aa00b3268 Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 15:34:08 -0400 Subject: [PATCH 09/20] Tidys the go.mod file in goMaker --- src/dev_tools/goMaker/go.mod | 14 ++++++++++++- src/dev_tools/goMaker/go.sum | 39 ++++++++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index 5b0f3b0a12..931d37dde4 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,4 +4,16 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/v0/sdk => ../sdk -require github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240314004354-24be97c22535 + +require ( + github.com/bykof/gostradamus v1.0.4 // indirect + github.com/ethereum/go-ethereum v1.11.5 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/panjf2000/ants/v2 v2.4.8 // indirect + github.com/spf13/cobra v1.7.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/term v0.15.0 // indirect +) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index cf31734198..4bd1ec13ef 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,2 +1,37 @@ -github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a h1:RYfmiM0zluBJOiPDJseKLEN4BapJ42uSi9SZBQ2YyiA= -github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a/go.mod h1:5YoVOkjYAQumqlV356Hj3xeYh4BdZuLE0/nRkf2NKkI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240314004354-24be97c22535 h1:kiJVq0Yhsk0P8kMo0pDawbkUrJqHXG6hhcBs5Yxw3J0= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240314004354-24be97c22535/go.mod h1:Iv96WyE9UCDvcDUxgQds8M4NrXv8Y/exv4cvyJcawUg= +github.com/bykof/gostradamus v1.0.4 h1:77iq/tANg5rZSxjoZ98zepZbv3VrotijEmlnH/WycD4= +github.com/bykof/gostradamus v1.0.4/go.mod h1:pdH0bv8yFLwr4G6EbM1j3QUb4AdCmiG7xlTjVwYyPNM= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/ethereum/go-ethereum v1.11.5 h1:3M1uan+LAUvdn+7wCEFrcMM4LJTeuxDrPTg/f31a5QQ= +github.com/ethereum/go-ethereum v1.11.5/go.mod h1:it7x0DWnTDMfVFdXcU6Ti4KEFQynLHVRarcSlPr0HBo= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/panjf2000/ants/v2 v2.4.8 h1:JgTbolX6K6RreZ4+bfctI0Ifs+3mrE5BIHudQxUDQ9k= +github.com/panjf2000/ants/v2 v2.4.8/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 3d3f62818b515a5f6b436ba8510958417da46f96 Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 15:34:30 -0400 Subject: [PATCH 10/20] Removes --sdk from build commands --- src/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fee8d84007..9c1bbf6d52 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -68,9 +68,8 @@ endfunction(ADD_GO_INSTALLABLE_PROGRAM) add_custom_target(lint COMMAND "golangci-lint" "run" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/apps/chifra") add_custom_target(format COMMAND "${BIN_DIR}/makeClass" "--format" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") add_custom_target(options COMMAND "${BIN_DIR}/makeClass" "--options --openapi" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") -add_custom_target(generate COMMAND "${BIN_DIR}/makeClass" "--all --readmes --openapi --options --gocmds --sdk --protobuf" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") +add_custom_target(generate COMMAND "${BIN_DIR}/makeClass" "--all --readmes --openapi --options --gocmds --protobuf" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") add_custom_target(generate2 COMMAND "${BIN_DIR}/goMaker" "" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/../build") -add_custom_target(sdk COMMAND "${BIN_DIR}/makeClass" "--sdk" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") add_custom_target(gocmds COMMAND "${BIN_DIR}/makeClass" "--options --gocmds" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") add_custom_target(readmes COMMAND "${BIN_DIR}/makeClass" "--readmes" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") add_custom_target(finish COMMAND "${BIN_DIR}/makeClass" "--format" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") From 8afffc3cd4f418eec79ef256e9cac1a470c4d485 Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 15:35:51 -0400 Subject: [PATCH 11/20] Cleans up (by hand) formatting using gofmt (new autogen will use gofmt) --- src/apps/chifra/sdk/abis.go | 1 - src/apps/chifra/sdk/blocks.go | 1 - src/apps/chifra/sdk/chunks.go | 1 - src/apps/chifra/sdk/config.go | 1 - src/apps/chifra/sdk/export.go | 1 - src/apps/chifra/sdk/init.go | 1 - src/apps/chifra/sdk/list.go | 1 - src/apps/chifra/sdk/logs.go | 1 - src/apps/chifra/sdk/monitors.go | 1 - src/apps/chifra/sdk/names.go | 1 - src/apps/chifra/sdk/receipts.go | 1 - src/apps/chifra/sdk/scrape.go | 1 - src/apps/chifra/sdk/slurp.go | 1 - src/apps/chifra/sdk/state.go | 1 - src/apps/chifra/sdk/status.go | 1 - src/apps/chifra/sdk/tokens.go | 1 - src/apps/chifra/sdk/traces.go | 1 - src/apps/chifra/sdk/transactions.go | 1 - src/apps/chifra/sdk/when.go | 1 - 19 files changed, 19 deletions(-) diff --git a/src/apps/chifra/sdk/abis.go b/src/apps/chifra/sdk/abis.go index 57c321009d..26af6285ba 100644 --- a/src/apps/chifra/sdk/abis.go +++ b/src/apps/chifra/sdk/abis.go @@ -32,4 +32,3 @@ func Abis(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/blocks.go b/src/apps/chifra/sdk/blocks.go index e6ff5651fa..71efcd1fef 100644 --- a/src/apps/chifra/sdk/blocks.go +++ b/src/apps/chifra/sdk/blocks.go @@ -32,4 +32,3 @@ func Blocks(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/chunks.go b/src/apps/chifra/sdk/chunks.go index 8ff68d3b17..006c7e4549 100644 --- a/src/apps/chifra/sdk/chunks.go +++ b/src/apps/chifra/sdk/chunks.go @@ -32,4 +32,3 @@ func Chunks(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/config.go b/src/apps/chifra/sdk/config.go index 5f7260ffe9..9f90c2fd26 100644 --- a/src/apps/chifra/sdk/config.go +++ b/src/apps/chifra/sdk/config.go @@ -32,4 +32,3 @@ func Config(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/export.go b/src/apps/chifra/sdk/export.go index fbaca6458e..38be8106b5 100644 --- a/src/apps/chifra/sdk/export.go +++ b/src/apps/chifra/sdk/export.go @@ -32,4 +32,3 @@ func Export(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/init.go b/src/apps/chifra/sdk/init.go index 613b048890..29f2f23b42 100644 --- a/src/apps/chifra/sdk/init.go +++ b/src/apps/chifra/sdk/init.go @@ -32,4 +32,3 @@ func Init(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/list.go b/src/apps/chifra/sdk/list.go index cb7c0ac15b..4d4cff149a 100644 --- a/src/apps/chifra/sdk/list.go +++ b/src/apps/chifra/sdk/list.go @@ -32,4 +32,3 @@ func List(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/logs.go b/src/apps/chifra/sdk/logs.go index 41aa9e9187..cdc168daf2 100644 --- a/src/apps/chifra/sdk/logs.go +++ b/src/apps/chifra/sdk/logs.go @@ -32,4 +32,3 @@ func Logs(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/monitors.go b/src/apps/chifra/sdk/monitors.go index 6c8489bf9a..054ac73d4a 100644 --- a/src/apps/chifra/sdk/monitors.go +++ b/src/apps/chifra/sdk/monitors.go @@ -32,4 +32,3 @@ func Monitors(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/names.go b/src/apps/chifra/sdk/names.go index c883311ff9..21903c3a86 100644 --- a/src/apps/chifra/sdk/names.go +++ b/src/apps/chifra/sdk/names.go @@ -32,4 +32,3 @@ func Names(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/receipts.go b/src/apps/chifra/sdk/receipts.go index 7521654d16..eef09a2332 100644 --- a/src/apps/chifra/sdk/receipts.go +++ b/src/apps/chifra/sdk/receipts.go @@ -32,4 +32,3 @@ func Receipts(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/scrape.go b/src/apps/chifra/sdk/scrape.go index ea42c2645e..e969c1318d 100644 --- a/src/apps/chifra/sdk/scrape.go +++ b/src/apps/chifra/sdk/scrape.go @@ -32,4 +32,3 @@ func Scrape(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/slurp.go b/src/apps/chifra/sdk/slurp.go index f0f39068fa..522f75e965 100644 --- a/src/apps/chifra/sdk/slurp.go +++ b/src/apps/chifra/sdk/slurp.go @@ -32,4 +32,3 @@ func Slurp(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/state.go b/src/apps/chifra/sdk/state.go index 26493a4c15..e640b978f3 100644 --- a/src/apps/chifra/sdk/state.go +++ b/src/apps/chifra/sdk/state.go @@ -32,4 +32,3 @@ func State(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/status.go b/src/apps/chifra/sdk/status.go index d80439035d..9705e136b2 100644 --- a/src/apps/chifra/sdk/status.go +++ b/src/apps/chifra/sdk/status.go @@ -32,4 +32,3 @@ func Status(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/tokens.go b/src/apps/chifra/sdk/tokens.go index 1fa3c2f1c4..41298ea266 100644 --- a/src/apps/chifra/sdk/tokens.go +++ b/src/apps/chifra/sdk/tokens.go @@ -32,4 +32,3 @@ func Tokens(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/traces.go b/src/apps/chifra/sdk/traces.go index 5b9413af44..b10888cca6 100644 --- a/src/apps/chifra/sdk/traces.go +++ b/src/apps/chifra/sdk/traces.go @@ -32,4 +32,3 @@ func Traces(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/transactions.go b/src/apps/chifra/sdk/transactions.go index fdab83d14e..005259366a 100644 --- a/src/apps/chifra/sdk/transactions.go +++ b/src/apps/chifra/sdk/transactions.go @@ -32,4 +32,3 @@ func Transactions(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/sdk/when.go b/src/apps/chifra/sdk/when.go index 915eb5aa14..8ed263ab8f 100644 --- a/src/apps/chifra/sdk/when.go +++ b/src/apps/chifra/sdk/when.go @@ -32,4 +32,3 @@ func When(w io.Writer, values url.Values) error { // EXISTING_CODE // EXISTING_CODE - From c0d735c47cbe1b7d5c25f20f17565da47cbd8510 Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 15:36:36 -0400 Subject: [PATCH 12/20] Cleans up (by hand) formatting for typescript SDK --- sdk/typescript/src/paths/abis.ts | 1 - sdk/typescript/src/paths/blocks.ts | 1 - sdk/typescript/src/paths/chunks.ts | 1 - sdk/typescript/src/paths/config.ts | 1 - sdk/typescript/src/paths/export.ts | 1 - sdk/typescript/src/paths/init.ts | 1 - sdk/typescript/src/paths/list.ts | 1 - sdk/typescript/src/paths/logs.ts | 1 - sdk/typescript/src/paths/monitors.ts | 1 - sdk/typescript/src/paths/names.ts | 1 - sdk/typescript/src/paths/receipts.ts | 1 - sdk/typescript/src/paths/scrape.ts | 1 - sdk/typescript/src/paths/slurp.ts | 1 - sdk/typescript/src/paths/state.ts | 1 - sdk/typescript/src/paths/status.ts | 1 - sdk/typescript/src/paths/tokens.ts | 1 - sdk/typescript/src/paths/traces.ts | 1 - sdk/typescript/src/paths/transactions.ts | 1 - sdk/typescript/src/paths/when.ts | 1 - 19 files changed, 19 deletions(-) diff --git a/sdk/typescript/src/paths/abis.ts b/sdk/typescript/src/paths/abis.ts index 1f159ffe22..a38a1118cb 100644 --- a/sdk/typescript/src/paths/abis.ts +++ b/sdk/typescript/src/paths/abis.ts @@ -26,4 +26,3 @@ export function getAbis( { endpoint: '/abis', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/blocks.ts b/sdk/typescript/src/paths/blocks.ts index b7fa4a362b..3227ac6755 100644 --- a/sdk/typescript/src/paths/blocks.ts +++ b/sdk/typescript/src/paths/blocks.ts @@ -35,4 +35,3 @@ export function getBlocks( { endpoint: '/blocks', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/chunks.ts b/sdk/typescript/src/paths/chunks.ts index b366603c52..0f78ce7dfe 100644 --- a/sdk/typescript/src/paths/chunks.ts +++ b/sdk/typescript/src/paths/chunks.ts @@ -32,4 +32,3 @@ export function getChunks( { endpoint: '/chunks', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/config.ts b/sdk/typescript/src/paths/config.ts index 414f0cbbee..7f09e8ac86 100644 --- a/sdk/typescript/src/paths/config.ts +++ b/sdk/typescript/src/paths/config.ts @@ -20,4 +20,3 @@ export function getConfig( { endpoint: '/config', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/export.ts b/sdk/typescript/src/paths/export.ts index cb28dea392..c8954d9bab 100644 --- a/sdk/typescript/src/paths/export.ts +++ b/sdk/typescript/src/paths/export.ts @@ -50,4 +50,3 @@ export function getExport( { endpoint: '/export', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/init.ts b/sdk/typescript/src/paths/init.ts index 8df7a50bd7..8080384e4d 100644 --- a/sdk/typescript/src/paths/init.ts +++ b/sdk/typescript/src/paths/init.ts @@ -20,4 +20,3 @@ export function getInit( { endpoint: '/init', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/list.ts b/sdk/typescript/src/paths/list.ts index f6a214097b..576d6e1c29 100644 --- a/sdk/typescript/src/paths/list.ts +++ b/sdk/typescript/src/paths/list.ts @@ -29,4 +29,3 @@ export function getList( { endpoint: '/list', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/logs.ts b/sdk/typescript/src/paths/logs.ts index 755f5236db..8ba3907a50 100644 --- a/sdk/typescript/src/paths/logs.ts +++ b/sdk/typescript/src/paths/logs.ts @@ -25,4 +25,3 @@ export function getLogs( { endpoint: '/logs', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/monitors.ts b/sdk/typescript/src/paths/monitors.ts index 5893e04ab2..ec9a6da038 100644 --- a/sdk/typescript/src/paths/monitors.ts +++ b/sdk/typescript/src/paths/monitors.ts @@ -31,4 +31,3 @@ export function getMonitors( { endpoint: '/monitors', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/names.ts b/sdk/typescript/src/paths/names.ts index ab6434df3e..36cdd36807 100644 --- a/sdk/typescript/src/paths/names.ts +++ b/sdk/typescript/src/paths/names.ts @@ -35,4 +35,3 @@ export function getNames( { endpoint: '/names', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/receipts.ts b/sdk/typescript/src/paths/receipts.ts index 7ea43f1aa0..fc54c9d188 100644 --- a/sdk/typescript/src/paths/receipts.ts +++ b/sdk/typescript/src/paths/receipts.ts @@ -23,4 +23,3 @@ export function getReceipts( { endpoint: '/receipts', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/scrape.ts b/sdk/typescript/src/paths/scrape.ts index a590005079..be4f56cfdf 100644 --- a/sdk/typescript/src/paths/scrape.ts +++ b/sdk/typescript/src/paths/scrape.ts @@ -19,4 +19,3 @@ export function getScrape( { endpoint: '/scrape', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/slurp.ts b/sdk/typescript/src/paths/slurp.ts index 29888e5b2c..fa963bf91a 100644 --- a/sdk/typescript/src/paths/slurp.ts +++ b/sdk/typescript/src/paths/slurp.ts @@ -30,4 +30,3 @@ export function getSlurp( { endpoint: '/slurp', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/state.ts b/sdk/typescript/src/paths/state.ts index a0b7b53998..37c4be7c1e 100644 --- a/sdk/typescript/src/paths/state.ts +++ b/sdk/typescript/src/paths/state.ts @@ -29,4 +29,3 @@ export function getState( { endpoint: '/state', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/status.ts b/sdk/typescript/src/paths/status.ts index 13ee4476f7..0258328e1d 100644 --- a/sdk/typescript/src/paths/status.ts +++ b/sdk/typescript/src/paths/status.ts @@ -23,4 +23,3 @@ export function getStatus( { endpoint: '/status', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/tokens.ts b/sdk/typescript/src/paths/tokens.ts index 1287fb5c37..c5c54b3dd6 100644 --- a/sdk/typescript/src/paths/tokens.ts +++ b/sdk/typescript/src/paths/tokens.ts @@ -26,4 +26,3 @@ export function getTokens( { endpoint: '/tokens', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/traces.ts b/sdk/typescript/src/paths/traces.ts index 16fa61445d..c6cfbc7277 100644 --- a/sdk/typescript/src/paths/traces.ts +++ b/sdk/typescript/src/paths/traces.ts @@ -26,4 +26,3 @@ export function getTraces( { endpoint: '/traces', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/transactions.ts b/sdk/typescript/src/paths/transactions.ts index 216a51d9aa..9311f405e4 100644 --- a/sdk/typescript/src/paths/transactions.ts +++ b/sdk/typescript/src/paths/transactions.ts @@ -30,4 +30,3 @@ export function getTransactions( { endpoint: '/transactions', method: 'get', parameters, options }, ); } - diff --git a/sdk/typescript/src/paths/when.ts b/sdk/typescript/src/paths/when.ts index 7d5c8d4f2c..b52ef7ebc7 100644 --- a/sdk/typescript/src/paths/when.ts +++ b/sdk/typescript/src/paths/when.ts @@ -28,4 +28,3 @@ export function getWhen( { endpoint: '/when', method: 'get', parameters, options }, ); } - From 384a6de0dbf0b278090e7d8ffe2ad60f4cf599a8 Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 15:37:18 -0400 Subject: [PATCH 13/20] Cleans up (by hand) python SDK. Removes redundant option. --- sdk/python/src/_abis.py | 1 - sdk/python/src/_blocks.py | 2 -- sdk/python/src/_chunks.py | 2 -- sdk/python/src/_config.py | 2 -- sdk/python/src/_daemon.py | 4 ---- sdk/python/src/_explore.py | 4 ---- sdk/python/src/_export.py | 2 -- sdk/python/src/_init.py | 1 - sdk/python/src/_list.py | 2 -- sdk/python/src/_logs.py | 2 -- sdk/python/src/_monitors.py | 2 -- sdk/python/src/_names.py | 2 -- sdk/python/src/_receipts.py | 2 -- sdk/python/src/_scrape.py | 1 - sdk/python/src/_slurp.py | 2 -- sdk/python/src/_state.py | 2 -- sdk/python/src/_status.py | 2 -- sdk/python/src/_tokens.py | 2 -- sdk/python/src/_traces.py | 2 -- sdk/python/src/_transactions.py | 2 -- sdk/python/src/_when.py | 2 -- 21 files changed, 43 deletions(-) delete mode 100644 sdk/python/src/_daemon.py delete mode 100644 sdk/python/src/_explore.py diff --git a/sdk/python/src/_abis.py b/sdk/python/src/_abis.py index 77a335b935..50570c468c 100644 --- a/sdk/python/src/_abis.py +++ b/sdk/python/src/_abis.py @@ -26,4 +26,3 @@ def abis(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_blocks.py b/sdk/python/src/_blocks.py index fcac2dd0c2..ac2fbb55ce 100644 --- a/sdk/python/src/_blocks.py +++ b/sdk/python/src/_blocks.py @@ -19,7 +19,6 @@ "articulate": {"hotkey": "-a", "type": "switch"}, "bigRange": {"hotkey": "-r", "type": "flag"}, "count": {"hotkey": "-U", "type": "switch"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "cache": {"hotkey": "-o", "type": "switch"}, @@ -35,4 +34,3 @@ def blocks(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_chunks.py b/sdk/python/src/_chunks.py index b10e976cb9..cdaaf2d608 100644 --- a/sdk/python/src/_chunks.py +++ b/sdk/python/src/_chunks.py @@ -19,7 +19,6 @@ "rewrite": {"hotkey": "-e", "type": "switch"}, "count": {"hotkey": "-U", "type": "switch"}, "sleep": {"hotkey": "-s", "type": "flag"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "fmt": {"hotkey": "-x", "type": "flag"}, @@ -31,4 +30,3 @@ def chunks(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_config.py b/sdk/python/src/_config.py index 3fc80e71b4..9f0a012f6b 100644 --- a/sdk/python/src/_config.py +++ b/sdk/python/src/_config.py @@ -8,7 +8,6 @@ configFmt = "json" configOpts = { "paths": {"hotkey": "-a", "type": "switch"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "fmt": {"hotkey": "-x", "type": "flag"}, @@ -20,4 +19,3 @@ def config(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_daemon.py b/sdk/python/src/_daemon.py deleted file mode 100644 index be1fe62606..0000000000 --- a/sdk/python/src/_daemon.py +++ /dev/null @@ -1,4 +0,0 @@ -from . import session - -# Not available in the SDK - diff --git a/sdk/python/src/_explore.py b/sdk/python/src/_explore.py deleted file mode 100644 index be1fe62606..0000000000 --- a/sdk/python/src/_explore.py +++ /dev/null @@ -1,4 +0,0 @@ -from . import session - -# Not available in the SDK - diff --git a/sdk/python/src/_export.py b/sdk/python/src/_export.py index 4ae2f69c7e..1ab79fbfce 100644 --- a/sdk/python/src/_export.py +++ b/sdk/python/src/_export.py @@ -33,7 +33,6 @@ "noZero": {"hotkey": "-z", "type": "switch"}, "firstBlock": {"hotkey": "-F", "type": "flag"}, "lastBlock": {"hotkey": "-L", "type": "flag"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "cache": {"hotkey": "-o", "type": "switch"}, @@ -48,4 +47,3 @@ def export(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_init.py b/sdk/python/src/_init.py index f0ef3843d9..4a94f58e56 100644 --- a/sdk/python/src/_init.py +++ b/sdk/python/src/_init.py @@ -21,4 +21,3 @@ def init(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_list.py b/sdk/python/src/_list.py index 8b86b885e3..d48907b352 100644 --- a/sdk/python/src/_list.py +++ b/sdk/python/src/_list.py @@ -17,7 +17,6 @@ "reversed": {"hotkey": "-E", "type": "switch"}, "firstBlock": {"hotkey": "-F", "type": "flag"}, "lastBlock": {"hotkey": "-L", "type": "flag"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "fmt": {"hotkey": "-x", "type": "flag"}, @@ -29,4 +28,3 @@ def list(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_logs.py b/sdk/python/src/_logs.py index 9ffc72fef9..7e52c7c64f 100644 --- a/sdk/python/src/_logs.py +++ b/sdk/python/src/_logs.py @@ -10,7 +10,6 @@ "emitter": {"hotkey": "-m", "type": "flag"}, "topic": {"hotkey": "-B", "type": "flag"}, "articulate": {"hotkey": "-a", "type": "switch"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "cache": {"hotkey": "-o", "type": "switch"}, @@ -25,4 +24,3 @@ def logs(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_monitors.py b/sdk/python/src/_monitors.py index 4724a9ce96..5636df6c70 100644 --- a/sdk/python/src/_monitors.py +++ b/sdk/python/src/_monitors.py @@ -17,7 +17,6 @@ "commands": {"hotkey": "-c", "type": "flag"}, "batchSize": {"hotkey": "-b", "type": "flag"}, "sleep": {"hotkey": "-s", "type": "flag"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "cache": {"hotkey": "-o", "type": "switch"}, @@ -31,4 +30,3 @@ def monitors(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_names.py b/sdk/python/src/_names.py index 15fd38dee5..b0c146370a 100644 --- a/sdk/python/src/_names.py +++ b/sdk/python/src/_names.py @@ -23,7 +23,6 @@ "delete": {"hotkey": "", "type": "switch"}, "undelete": {"hotkey": "", "type": "switch"}, "remove": {"hotkey": "", "type": "switch"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "fmt": {"hotkey": "-x", "type": "flag"}, @@ -35,4 +34,3 @@ def names(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_receipts.py b/sdk/python/src/_receipts.py index c408e6abc4..a0fc5c60cb 100644 --- a/sdk/python/src/_receipts.py +++ b/sdk/python/src/_receipts.py @@ -8,7 +8,6 @@ receiptsFmt = "json" receiptsOpts = { "articulate": {"hotkey": "-a", "type": "switch"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "cache": {"hotkey": "-o", "type": "switch"}, @@ -23,4 +22,3 @@ def receipts(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_scrape.py b/sdk/python/src/_scrape.py index ecc05ef8cf..9aad11caba 100644 --- a/sdk/python/src/_scrape.py +++ b/sdk/python/src/_scrape.py @@ -20,4 +20,3 @@ def scrape(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_slurp.py b/sdk/python/src/_slurp.py index 22ab206321..3065f54a34 100644 --- a/sdk/python/src/_slurp.py +++ b/sdk/python/src/_slurp.py @@ -13,7 +13,6 @@ "source": {"hotkey": "-S", "type": "flag"}, "count": {"hotkey": "-U", "type": "switch"}, "sleep": {"hotkey": "-s", "type": "flag"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "cache": {"hotkey": "-o", "type": "switch"}, @@ -29,4 +28,3 @@ def slurp(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_state.py b/sdk/python/src/_state.py index 1fd36a7bab..c5a7e43dd7 100644 --- a/sdk/python/src/_state.py +++ b/sdk/python/src/_state.py @@ -13,7 +13,6 @@ "call": {"hotkey": "-l", "type": "flag"}, "articulate": {"hotkey": "-a", "type": "switch"}, "proxyFor": {"hotkey": "-r", "type": "flag"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "cache": {"hotkey": "-o", "type": "switch"}, @@ -28,4 +27,3 @@ def state(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_status.py b/sdk/python/src/_status.py index 18ec45de27..4f7019d8fd 100644 --- a/sdk/python/src/_status.py +++ b/sdk/python/src/_status.py @@ -11,7 +11,6 @@ "firstRecord": {"hotkey": "-c", "type": "flag"}, "maxRecords": {"hotkey": "-e", "type": "flag"}, "chains": {"hotkey": "-a", "type": "switch"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "fmt": {"hotkey": "-x", "type": "flag"}, @@ -23,4 +22,3 @@ def status(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_tokens.py b/sdk/python/src/_tokens.py index 1b09fe4dda..b154e64d3c 100644 --- a/sdk/python/src/_tokens.py +++ b/sdk/python/src/_tokens.py @@ -11,7 +11,6 @@ "byAcct": {"hotkey": "-b", "type": "switch"}, "changes": {"hotkey": "-c", "type": "switch"}, "noZero": {"hotkey": "-z", "type": "switch"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "cache": {"hotkey": "-o", "type": "switch"}, @@ -25,4 +24,3 @@ def tokens(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_traces.py b/sdk/python/src/_traces.py index bebcd10b39..1d61f80f69 100644 --- a/sdk/python/src/_traces.py +++ b/sdk/python/src/_traces.py @@ -10,7 +10,6 @@ "articulate": {"hotkey": "-a", "type": "switch"}, "filter": {"hotkey": "-f", "type": "flag"}, "count": {"hotkey": "-U", "type": "switch"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "cache": {"hotkey": "-o", "type": "switch"}, @@ -26,4 +25,3 @@ def traces(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_transactions.py b/sdk/python/src/_transactions.py index 6eb0577477..9ee44ce02c 100644 --- a/sdk/python/src/_transactions.py +++ b/sdk/python/src/_transactions.py @@ -14,7 +14,6 @@ "logs": {"hotkey": "-l", "type": "switch"}, "emitter": {"hotkey": "-m", "type": "flag"}, "topic": {"hotkey": "-B", "type": "flag"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "cache": {"hotkey": "-o", "type": "switch"}, @@ -30,4 +29,3 @@ def transactions(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - diff --git a/sdk/python/src/_when.py b/sdk/python/src/_when.py index 3dd9fd284c..f62dd49f94 100644 --- a/sdk/python/src/_when.py +++ b/sdk/python/src/_when.py @@ -14,7 +14,6 @@ "check": {"hotkey": "-c", "type": "switch"}, "update": {"hotkey": "-u", "type": "switch"}, "deep": {"hotkey": "-d", "type": "switch"}, - "fmt": {"hotkey": "txt", "type": "flag"}, "chain": {"hotkey": "-", "type": "flag"}, "noHeader": {"hotkey": "-", "type": "switch"}, "cache": {"hotkey": "-o", "type": "switch"}, @@ -28,4 +27,3 @@ def when(self): if ret[0] == 'json': return session.get(url).json() return session.get(url).text - From e539f61be329377a13231cb33ccd143b00a53cae Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 15:37:40 -0400 Subject: [PATCH 14/20] Renames help_text.go to helpfile.go --- src/apps/chifra/cmd/{help_text.go => helpfile.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/apps/chifra/cmd/{help_text.go => helpfile.go} (100%) diff --git a/src/apps/chifra/cmd/help_text.go b/src/apps/chifra/cmd/helpfile.go similarity index 100% rename from src/apps/chifra/cmd/help_text.go rename to src/apps/chifra/cmd/helpfile.go From 55255418c98353b3142c9f79f1d729e2d34216c5 Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 16:34:33 -0400 Subject: [PATCH 15/20] Hand edits in anticipation of the new auto-gen code --- sdk/go/abis.go | 2 -- sdk/go/blocks.go | 12 +++++------- sdk/go/chunks.go | 26 ++++++++++++------------- sdk/go/config.go | 14 ++++++-------- sdk/go/export.go | 10 ++++------ sdk/go/init.go | 2 -- sdk/go/list.go | 2 -- sdk/go/logs.go | 2 -- sdk/go/monitors.go | 2 -- sdk/go/names.go | 2 -- sdk/go/receipts.go | 2 -- sdk/go/scrape.go | 1 - sdk/go/slurp.go | 35 ++++++++++++++++----------------- sdk/go/state.go | 18 ++++++++--------- sdk/go/status.go | 44 ++++++++++++++++++++---------------------- sdk/go/tokens.go | 18 ++++++++--------- sdk/go/traces.go | 2 -- sdk/go/transactions.go | 10 ++++------ sdk/go/when.go | 2 -- 19 files changed, 85 insertions(+), 121 deletions(-) diff --git a/sdk/go/abis.go b/sdk/go/abis.go index 0eaf42b004..20603cd03e 100644 --- a/sdk/go/abis.go +++ b/sdk/go/abis.go @@ -55,7 +55,6 @@ func abisParseFunc(target interface{}, key, value string) (bool, error) { } // No enums - // EXISTING_CODE if key == "proxyFor" { opts, _ := target.(*AbisOptions) @@ -78,4 +77,3 @@ func GetAbisOptions(args []string) (*AbisOptions, error) { } // No enums - diff --git a/sdk/go/blocks.go b/sdk/go/blocks.go index a4d13bc3bd..4f6ad07c8c 100644 --- a/sdk/go/blocks.go +++ b/sdk/go/blocks.go @@ -66,8 +66,7 @@ func blocksParseFunc(target interface{}, key, value string) (bool, error) { return false, fmt.Errorf("parseFunc(blocks): target is not of correct type") } - switch key { - case "flow": + if key == "flow" { var err error values := strings.Split(value, ",") if opts.Flow, err = enumFromBlocksFlow(values); err != nil { @@ -96,8 +95,8 @@ func GetBlocksOptions(args []string) (*BlocksOptions, error) { type BlocksFlow int const ( - NoBF BlocksFlow = 0 - BFFrom = 1 << iota + NoBF BlocksFlow = 0 + BFFrom = 1 << iota BFTo BFReward ) @@ -109,8 +108,8 @@ func (v BlocksFlow) String() string { } var m = map[BlocksFlow]string{ - BFFrom: "from", - BFTo: "to", + BFFrom: "from", + BFTo: "to", BFReward: "reward", } @@ -145,4 +144,3 @@ func enumFromBlocksFlow(values []string) (BlocksFlow, error) { return result, nil } - diff --git a/sdk/go/chunks.go b/sdk/go/chunks.go index d0eaa7fc66..ada4d83175 100644 --- a/sdk/go/chunks.go +++ b/sdk/go/chunks.go @@ -69,8 +69,7 @@ func chunksParseFunc(target interface{}, key, value string) (bool, error) { return false, fmt.Errorf("parseFunc(chunks): target is not of correct type") } - switch key { - case "mode": + if key == "mode" { var err error values := strings.Split(value, ",") if opts.Mode, err = enumFromChunksMode(values); err != nil { @@ -99,8 +98,8 @@ func GetChunksOptions(args []string) (*ChunksOptions, error) { type ChunksMode int const ( - NoCM2 ChunksMode = 0 - CMManifest = 1 << iota + NoCHM ChunksMode = 0 + CMManifest = 1 << iota CMIndex CMBlooms CMPins @@ -111,18 +110,18 @@ const ( func (v ChunksMode) String() string { switch v { - case NoCM2: + case NoCHM: return "none" } var m = map[ChunksMode]string{ - CMManifest: "manifest", - CMIndex: "index", - CMBlooms: "blooms", - CMPins: "pins", - CMAddresses: "addresses", + CMManifest: "manifest", + CMIndex: "index", + CMBlooms: "blooms", + CMPins: "pins", + CMAddresses: "addresses", CMAppearances: "appearances", - CMStats: "stats", + CMStats: "stats", } var ret []string @@ -137,7 +136,7 @@ func (v ChunksMode) String() string { func enumFromChunksMode(values []string) (ChunksMode, error) { if len(values) == 0 { - return NoCM2, fmt.Errorf("no value provided for mode option") + return NoCHM, fmt.Errorf("no value provided for mode option") } var result ChunksMode @@ -158,10 +157,9 @@ func enumFromChunksMode(values []string) (ChunksMode, error) { case "stats": result |= CMStats default: - return NoCM2, fmt.Errorf("unknown mode: %s", val) + return NoCHM, fmt.Errorf("unknown mode: %s", val) } } return result, nil } - diff --git a/sdk/go/config.go b/sdk/go/config.go index cc00a51fa3..cc06154b55 100644 --- a/sdk/go/config.go +++ b/sdk/go/config.go @@ -50,8 +50,7 @@ func configParseFunc(target interface{}, key, value string) (bool, error) { return false, fmt.Errorf("parseFunc(config): target is not of correct type") } - switch key { - case "mode": + if key == "mode" { var err error values := strings.Split(value, ",") if opts.Mode, err = enumFromConfigMode(values); err != nil { @@ -80,14 +79,14 @@ func GetConfigOptions(args []string) (*ConfigOptions, error) { type ConfigMode int const ( - NoCM1 ConfigMode = 0 - CMShow = 1 << iota + NoCOM ConfigMode = 0 + CMShow = 1 << iota CMEdit ) func (v ConfigMode) String() string { switch v { - case NoCM1: + case NoCOM: return "none" } @@ -108,7 +107,7 @@ func (v ConfigMode) String() string { func enumFromConfigMode(values []string) (ConfigMode, error) { if len(values) == 0 { - return NoCM1, fmt.Errorf("no value provided for mode option") + return NoCOM, fmt.Errorf("no value provided for mode option") } var result ConfigMode @@ -119,10 +118,9 @@ func enumFromConfigMode(values []string) (ConfigMode, error) { case "edit": result |= CMEdit default: - return NoCM1, fmt.Errorf("unknown mode: %s", val) + return NoCOM, fmt.Errorf("unknown mode: %s", val) } } return result, nil } - diff --git a/sdk/go/export.go b/sdk/go/export.go index a24293b769..36360a6dcd 100644 --- a/sdk/go/export.go +++ b/sdk/go/export.go @@ -79,8 +79,7 @@ func exportParseFunc(target interface{}, key, value string) (bool, error) { return false, fmt.Errorf("parseFunc(export): target is not of correct type") } - switch key { - case "flow": + if key == "flow" { var err error values := strings.Split(value, ",") if opts.Flow, err = enumFromExportFlow(values); err != nil { @@ -110,7 +109,7 @@ type ExportFlow int const ( NoEF ExportFlow = 0 - EFIn = 1 << iota + EFIn = 1 << iota EFOut EFZero ) @@ -122,8 +121,8 @@ func (v ExportFlow) String() string { } var m = map[ExportFlow]string{ - EFIn: "in", - EFOut: "out", + EFIn: "in", + EFOut: "out", EFZero: "zero", } @@ -158,4 +157,3 @@ func enumFromExportFlow(values []string) (ExportFlow, error) { return result, nil } - diff --git a/sdk/go/init.go b/sdk/go/init.go index b5008dd820..4c7cad1d7b 100644 --- a/sdk/go/init.go +++ b/sdk/go/init.go @@ -54,7 +54,6 @@ func initParseFunc(target interface{}, key, value string) (bool, error) { } // No enums - // EXISTING_CODE // EXISTING_CODE @@ -72,4 +71,3 @@ func GetInitOptions(args []string) (*InitOptions, error) { } // No enums - diff --git a/sdk/go/list.go b/sdk/go/list.go index c4ca57e71f..5282d31d80 100644 --- a/sdk/go/list.go +++ b/sdk/go/list.go @@ -61,7 +61,6 @@ func listParseFunc(target interface{}, key, value string) (bool, error) { } // No enums - // EXISTING_CODE // EXISTING_CODE @@ -79,4 +78,3 @@ func GetListOptions(args []string) (*ListOptions, error) { } // No enums - diff --git a/sdk/go/logs.go b/sdk/go/logs.go index 7aa5728115..e79d30bbcc 100644 --- a/sdk/go/logs.go +++ b/sdk/go/logs.go @@ -52,7 +52,6 @@ func logsParseFunc(target interface{}, key, value string) (bool, error) { } // No enums - // EXISTING_CODE // EXISTING_CODE @@ -70,4 +69,3 @@ func GetLogsOptions(args []string) (*LogsOptions, error) { } // No enums - diff --git a/sdk/go/monitors.go b/sdk/go/monitors.go index 4e7192be6c..305dd9e99f 100644 --- a/sdk/go/monitors.go +++ b/sdk/go/monitors.go @@ -60,7 +60,6 @@ func monitorsParseFunc(target interface{}, key, value string) (bool, error) { } // No enums - // EXISTING_CODE // EXISTING_CODE @@ -78,4 +77,3 @@ func GetMonitorsOptions(args []string) (*MonitorsOptions, error) { } // No enums - diff --git a/sdk/go/names.go b/sdk/go/names.go index 363699cd7e..9a5de7afec 100644 --- a/sdk/go/names.go +++ b/sdk/go/names.go @@ -66,7 +66,6 @@ func namesParseFunc(target interface{}, key, value string) (bool, error) { } // No enums - // EXISTING_CODE // EXISTING_CODE @@ -84,4 +83,3 @@ func GetNamesOptions(args []string) (*NamesOptions, error) { } // No enums - diff --git a/sdk/go/receipts.go b/sdk/go/receipts.go index e9d6133452..434ce39721 100644 --- a/sdk/go/receipts.go +++ b/sdk/go/receipts.go @@ -50,7 +50,6 @@ func receiptsParseFunc(target interface{}, key, value string) (bool, error) { } // No enums - // EXISTING_CODE // EXISTING_CODE @@ -68,4 +67,3 @@ func GetReceiptsOptions(args []string) (*ReceiptsOptions, error) { } // No enums - diff --git a/sdk/go/scrape.go b/sdk/go/scrape.go index e1322e62f4..d92fadab83 100644 --- a/sdk/go/scrape.go +++ b/sdk/go/scrape.go @@ -73,4 +73,3 @@ func GetScrapeOptions(args []string) (*ScrapeOptions, error) { } // No enums - diff --git a/sdk/go/slurp.go b/sdk/go/slurp.go index bb5d9c3ebb..e8ea09a9ee 100644 --- a/sdk/go/slurp.go +++ b/sdk/go/slurp.go @@ -58,8 +58,7 @@ func slurpParseFunc(target interface{}, key, value string) (bool, error) { return false, fmt.Errorf("parseFunc(slurp): target is not of correct type") } - switch key { - case "types": + if key == "types" { var err error values := strings.Split(value, ",") if opts.Types, err = enumFromSlurpTypes(values); err != nil { @@ -67,7 +66,8 @@ func slurpParseFunc(target interface{}, key, value string) (bool, error) { } else { found = true } - case "source": + } + if key == "source" { var err error values := strings.Split(value, ",") if opts.Source, err = enumFromSlurpSource(values); err != nil { @@ -96,8 +96,8 @@ func GetSlurpOptions(args []string) (*SlurpOptions, error) { type SlurpTypes int const ( - NoST SlurpTypes = 0 - STExt = 1 << iota + NoST SlurpTypes = 0 + STExt = 1 << iota STInt STToken STNfts @@ -105,8 +105,8 @@ const ( STMiner STUncles STWithdrawals - STSome = STExt | STInt | STToken | STNfts | ST1155 - STAll = STExt | STInt | STToken | STNfts | ST1155 | STMiner | STUncles | STWithdrawals + STSome = STExt | STInt | STToken | STNfts + STAll = STExt | STInt | STToken | STNfts | ST1155 | STMiner | STUncles | STWithdrawals ) func (v SlurpTypes) String() string { @@ -120,13 +120,13 @@ func (v SlurpTypes) String() string { } var m = map[SlurpTypes]string{ - STExt: "ext", - STInt: "int", - STToken: "token", - STNfts: "nfts", - ST1155: "1155", - STMiner: "miner", - STUncles: "uncles", + STExt: "ext", + STInt: "int", + STToken: "token", + STNfts: "nfts", + ST1155: "1155", + STMiner: "miner", + STUncles: "uncles", STWithdrawals: "withdrawals", } @@ -181,8 +181,8 @@ func enumFromSlurpTypes(values []string) (SlurpTypes, error) { type SlurpSource int const ( - NoSS SlurpSource = 0 - SSEtherscan = 1 << iota + NoSS SlurpSource = 0 + SSEtherscan = 1 << iota SSKey ) @@ -194,7 +194,7 @@ func (v SlurpSource) String() string { var m = map[SlurpSource]string{ SSEtherscan: "etherscan", - SSKey: "key", + SSKey: "key", } var ret []string @@ -226,4 +226,3 @@ func enumFromSlurpSource(values []string) (SlurpSource, error) { return result, nil } - diff --git a/sdk/go/state.go b/sdk/go/state.go index 974073855d..d2afdb413a 100644 --- a/sdk/go/state.go +++ b/sdk/go/state.go @@ -57,8 +57,7 @@ func stateParseFunc(target interface{}, key, value string) (bool, error) { return false, fmt.Errorf("parseFunc(state): target is not of correct type") } - switch key { - case "parts": + if key == "parts" { var err error values := strings.Split(value, ",") if opts.Parts, err = enumFromStateParts(values); err != nil { @@ -91,15 +90,15 @@ func GetStateOptions(args []string) (*StateOptions, error) { type StateParts int const ( - NoSP StateParts = 0 - SPBalance = 1 << iota + NoSP StateParts = 0 + SPBalance = 1 << iota SPNonce SPCode SPProxy SPDeployed SPAccttype SPSome = SPBalance | SPProxy | SPDeployed | SPAccttype - SPAll = SPBalance | SPNonce | SPCode | SPProxy | SPDeployed | SPAccttype + SPAll = SPBalance | SPNonce | SPCode | SPProxy | SPDeployed | SPAccttype ) func (v StateParts) String() string { @@ -113,10 +112,10 @@ func (v StateParts) String() string { } var m = map[StateParts]string{ - SPBalance: "balance", - SPNonce: "nonce", - SPCode: "code", - SPProxy: "proxy", + SPBalance: "balance", + SPNonce: "nonce", + SPCode: "code", + SPProxy: "proxy", SPDeployed: "deployed", SPAccttype: "accttype", } @@ -164,4 +163,3 @@ func enumFromStateParts(values []string) (StateParts, error) { return result, nil } - diff --git a/sdk/go/status.go b/sdk/go/status.go index 7d50772adf..e1914c401e 100644 --- a/sdk/go/status.go +++ b/sdk/go/status.go @@ -53,8 +53,7 @@ func statusParseFunc(target interface{}, key, value string) (bool, error) { return false, fmt.Errorf("parseFunc(status): target is not of correct type") } - switch key { - case "modes": + if key == "modes" { var err error values := strings.Split(value, ",") if opts.Modes, err = enumFromStatusModes(values); err != nil { @@ -83,8 +82,8 @@ func GetStatusOptions(args []string) (*StatusOptions, error) { type StatusModes int const ( - NoSM StatusModes = 0 - SMIndex = 1 << iota + NoSM StatusModes = 0 + SMIndex = 1 << iota SMBlooms SMBlocks SMTransactions @@ -101,8 +100,8 @@ const ( SMStaging SMUnripe SMMaps - SMSome = SMIndex | SMBlooms - SMAll = SMIndex | SMBlooms | SMBlocks | SMTransactions | SMTraces | SMLogs | SMStatements | SMResults | SMState | SMTokens | SMMonitors | SMNames | SMAbis | SMSlurps | SMStaging | SMUnripe | SMMaps + SMSome = SMIndex | SMBlooms | SMBlocks | SMTransactions + SMAll = SMIndex | SMBlooms | SMBlocks | SMTransactions | SMTraces | SMLogs | SMStatements | SMResults | SMState | SMTokens | SMMonitors | SMNames | SMAbis | SMSlurps | SMStaging | SMUnripe | SMMaps ) func (v StatusModes) String() string { @@ -116,23 +115,23 @@ func (v StatusModes) String() string { } var m = map[StatusModes]string{ - SMIndex: "index", - SMBlooms: "blooms", - SMBlocks: "blocks", + SMIndex: "index", + SMBlooms: "blooms", + SMBlocks: "blocks", SMTransactions: "transactions", - SMTraces: "traces", - SMLogs: "logs", - SMStatements: "statements", - SMResults: "results", - SMState: "state", - SMTokens: "tokens", - SMMonitors: "monitors", - SMNames: "names", - SMAbis: "abis", - SMSlurps: "slurps", - SMStaging: "staging", - SMUnripe: "unripe", - SMMaps: "maps", + SMTraces: "traces", + SMLogs: "logs", + SMStatements: "statements", + SMResults: "results", + SMState: "state", + SMTokens: "tokens", + SMMonitors: "monitors", + SMNames: "names", + SMAbis: "abis", + SMSlurps: "slurps", + SMStaging: "staging", + SMUnripe: "unripe", + SMMaps: "maps", } var ret []string @@ -200,4 +199,3 @@ func enumFromStatusModes(values []string) (StatusModes, error) { return result, nil } - diff --git a/sdk/go/tokens.go b/sdk/go/tokens.go index b602a4a96c..428fe92a52 100644 --- a/sdk/go/tokens.go +++ b/sdk/go/tokens.go @@ -54,8 +54,7 @@ func tokensParseFunc(target interface{}, key, value string) (bool, error) { return false, fmt.Errorf("parseFunc(tokens): target is not of correct type") } - switch key { - case "parts": + if key == "parts" { var err error values := strings.Split(value, ",") if opts.Parts, err = enumFromTokensParts(values); err != nil { @@ -84,14 +83,14 @@ func GetTokensOptions(args []string) (*TokensOptions, error) { type TokensParts int const ( - NoTP TokensParts = 0 - TPName = 1 << iota + NoTP TokensParts = 0 + TPName = 1 << iota TPSymbol TPDecimals TPTotalSupply TPVersion TPSome = TPName | TPSymbol | TPDecimals | TPTotalSupply - TPAll = TPName | TPSymbol | TPDecimals | TPTotalSupply | TPVersion + TPAll = TPName | TPSymbol | TPDecimals | TPTotalSupply | TPVersion ) func (v TokensParts) String() string { @@ -105,11 +104,11 @@ func (v TokensParts) String() string { } var m = map[TokensParts]string{ - TPName: "name", - TPSymbol: "symbol", - TPDecimals: "decimals", + TPName: "name", + TPSymbol: "symbol", + TPDecimals: "decimals", TPTotalSupply: "totalSupply", - TPVersion: "version", + TPVersion: "version", } var ret []string @@ -153,4 +152,3 @@ func enumFromTokensParts(values []string) (TokensParts, error) { return result, nil } - diff --git a/sdk/go/traces.go b/sdk/go/traces.go index 0485fec0f7..8e8e344ede 100644 --- a/sdk/go/traces.go +++ b/sdk/go/traces.go @@ -52,7 +52,6 @@ func tracesParseFunc(target interface{}, key, value string) (bool, error) { } // No enums - // EXISTING_CODE // EXISTING_CODE @@ -70,4 +69,3 @@ func GetTracesOptions(args []string) (*TracesOptions, error) { } // No enums - diff --git a/sdk/go/transactions.go b/sdk/go/transactions.go index b5975d546d..7d875bfcba 100644 --- a/sdk/go/transactions.go +++ b/sdk/go/transactions.go @@ -58,8 +58,7 @@ func transactionsParseFunc(target interface{}, key, value string) (bool, error) return false, fmt.Errorf("parseFunc(transactions): target is not of correct type") } - switch key { - case "flow": + if key == "flow" { var err error values := strings.Split(value, ",") if opts.Flow, err = enumFromTransactionsFlow(values); err != nil { @@ -88,8 +87,8 @@ func GetTransactionsOptions(args []string) (*TransactionsOptions, error) { type TransactionsFlow int const ( - NoTF TransactionsFlow = 0 - TFFrom = 1 << iota + NoTF TransactionsFlow = 0 + TFFrom = 1 << iota TFTo ) @@ -101,7 +100,7 @@ func (v TransactionsFlow) String() string { var m = map[TransactionsFlow]string{ TFFrom: "from", - TFTo: "to", + TFTo: "to", } var ret []string @@ -133,4 +132,3 @@ func enumFromTransactionsFlow(values []string) (TransactionsFlow, error) { return result, nil } - diff --git a/sdk/go/when.go b/sdk/go/when.go index 7fb2976208..926002d667 100644 --- a/sdk/go/when.go +++ b/sdk/go/when.go @@ -58,7 +58,6 @@ func whenParseFunc(target interface{}, key, value string) (bool, error) { } // No enums - // EXISTING_CODE // EXISTING_CODE @@ -76,4 +75,3 @@ func GetWhenOptions(args []string) (*WhenOptions, error) { } // No enums - From 6781d4b878d5dd40b7964e86dc2f8d754544542a Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 16:36:15 -0400 Subject: [PATCH 16/20] Hand edits in anticipation of the new auto-gen code --- src/apps/chifra/cmd/abis.go | 3 --- src/apps/chifra/cmd/blocks.go | 3 --- src/apps/chifra/cmd/chunks.go | 3 --- src/apps/chifra/cmd/config.go | 3 --- src/apps/chifra/cmd/daemon.go | 8 +------- src/apps/chifra/cmd/explore.go | 3 --- src/apps/chifra/cmd/export.go | 3 --- src/apps/chifra/cmd/init.go | 3 --- src/apps/chifra/cmd/list.go | 3 --- src/apps/chifra/cmd/logs.go | 3 --- src/apps/chifra/cmd/monitors.go | 3 --- src/apps/chifra/cmd/names.go | 3 --- src/apps/chifra/cmd/receipts.go | 3 --- src/apps/chifra/cmd/scrape.go | 3 --- src/apps/chifra/cmd/slurp.go | 3 --- src/apps/chifra/cmd/state.go | 3 --- src/apps/chifra/cmd/status.go | 3 --- src/apps/chifra/cmd/tokens.go | 3 --- src/apps/chifra/cmd/traces.go | 3 --- src/apps/chifra/cmd/transactions.go | 3 --- src/apps/chifra/cmd/when.go | 3 --- 21 files changed, 1 insertion(+), 67 deletions(-) diff --git a/src/apps/chifra/cmd/abis.go b/src/apps/chifra/cmd/abis.go index 762882dc4a..fa6337b7d6 100644 --- a/src/apps/chifra/cmd/abis.go +++ b/src/apps/chifra/cmd/abis.go @@ -54,8 +54,6 @@ func init() { var capabilities caps.Capability // capabilities for chifra abis capabilities = capabilities.Add(caps.Default) capabilities = capabilities.Add(caps.Caching) - // EXISTING_CODE - // EXISTING_CODE abisCmd.Flags().SortFlags = false @@ -74,4 +72,3 @@ func init() { chifraCmd.AddCommand(abisCmd) } - diff --git a/src/apps/chifra/cmd/blocks.go b/src/apps/chifra/cmd/blocks.go index 15c6253a52..e590d88f24 100644 --- a/src/apps/chifra/cmd/blocks.go +++ b/src/apps/chifra/cmd/blocks.go @@ -64,8 +64,6 @@ func init() { capabilities = capabilities.Add(caps.Caching) capabilities = capabilities.Add(caps.Ether) capabilities = capabilities.Add(caps.Raw) - // EXISTING_CODE - // EXISTING_CODE blocksCmd.Flags().SortFlags = false @@ -102,4 +100,3 @@ One of [ from | to | reward ]`) chifraCmd.AddCommand(blocksCmd) } - diff --git a/src/apps/chifra/cmd/chunks.go b/src/apps/chifra/cmd/chunks.go index bb87f2d5d9..8e3316d6cb 100644 --- a/src/apps/chifra/cmd/chunks.go +++ b/src/apps/chifra/cmd/chunks.go @@ -64,8 +64,6 @@ Notes: func init() { var capabilities caps.Capability // capabilities for chifra chunks capabilities = capabilities.Add(caps.Default) - // EXISTING_CODE - // EXISTING_CODE chunksCmd.Flags().SortFlags = false @@ -105,4 +103,3 @@ func init() { chifraCmd.AddCommand(chunksCmd) } - diff --git a/src/apps/chifra/cmd/config.go b/src/apps/chifra/cmd/config.go index bbda04854c..3abac375e3 100644 --- a/src/apps/chifra/cmd/config.go +++ b/src/apps/chifra/cmd/config.go @@ -52,8 +52,6 @@ const notesConfig = `` func init() { var capabilities caps.Capability // capabilities for chifra config capabilities = capabilities.Add(caps.Default) - // EXISTING_CODE - // EXISTING_CODE configCmd.Flags().SortFlags = false @@ -68,4 +66,3 @@ func init() { chifraCmd.AddCommand(configCmd) } - diff --git a/src/apps/chifra/cmd/daemon.go b/src/apps/chifra/cmd/daemon.go index 43afaf5738..194dc80adc 100644 --- a/src/apps/chifra/cmd/daemon.go +++ b/src/apps/chifra/cmd/daemon.go @@ -34,10 +34,7 @@ var daemonCmd = &cobra.Command{ PostRun: outputHelpers.PostRunWithJsonWriter(func() *globals.GlobalOptions { return &daemonPkg.GetOptions().Globals }), - Aliases: []string{ - "serve", - }, -} + Aliases: []string{"serve"}} const usageDaemon = `daemon [flags]` @@ -57,8 +54,6 @@ func init() { capabilities = capabilities.Add(caps.Version) capabilities = capabilities.Add(caps.Noop) capabilities = capabilities.Add(caps.NoColor) - // EXISTING_CODE - // EXISTING_CODE daemonCmd.Flags().SortFlags = false @@ -86,4 +81,3 @@ One of [ off | blooms | index ]`) chifraCmd.AddCommand(daemonCmd) } - diff --git a/src/apps/chifra/cmd/explore.go b/src/apps/chifra/cmd/explore.go index 3f1863ea2b..2eeae2c3fe 100644 --- a/src/apps/chifra/cmd/explore.go +++ b/src/apps/chifra/cmd/explore.go @@ -56,8 +56,6 @@ func init() { capabilities = capabilities.Add(caps.NoColor) capabilities = capabilities.Add(caps.Chain) capabilities = capabilities.Add(caps.File) - // EXISTING_CODE - // EXISTING_CODE exploreCmd.Flags().SortFlags = false @@ -75,4 +73,3 @@ func init() { chifraCmd.AddCommand(exploreCmd) } - diff --git a/src/apps/chifra/cmd/export.go b/src/apps/chifra/cmd/export.go index 4c8e4d7724..f6e4159b79 100644 --- a/src/apps/chifra/cmd/export.go +++ b/src/apps/chifra/cmd/export.go @@ -67,8 +67,6 @@ func init() { capabilities = capabilities.Add(caps.Default) capabilities = capabilities.Add(caps.Caching) capabilities = capabilities.Add(caps.Ether) - // EXISTING_CODE - // EXISTING_CODE exportCmd.Flags().SortFlags = false @@ -117,4 +115,3 @@ One of [ in | out | zero ]`) chifraCmd.AddCommand(exportCmd) } - diff --git a/src/apps/chifra/cmd/init.go b/src/apps/chifra/cmd/init.go index 4ae67466af..2f643a1e31 100644 --- a/src/apps/chifra/cmd/init.go +++ b/src/apps/chifra/cmd/init.go @@ -56,8 +56,6 @@ func init() { capabilities = capabilities.Add(caps.Noop) capabilities = capabilities.Add(caps.NoColor) capabilities = capabilities.Add(caps.Chain) - // EXISTING_CODE - // EXISTING_CODE initCmd.Flags().SortFlags = false @@ -79,4 +77,3 @@ func init() { chifraCmd.AddCommand(initCmd) } - diff --git a/src/apps/chifra/cmd/list.go b/src/apps/chifra/cmd/list.go index 7fc0f84bee..a956a42883 100644 --- a/src/apps/chifra/cmd/list.go +++ b/src/apps/chifra/cmd/list.go @@ -54,8 +54,6 @@ Notes: func init() { var capabilities caps.Capability // capabilities for chifra list capabilities = capabilities.Add(caps.Default) - // EXISTING_CODE - // EXISTING_CODE listCmd.Flags().SortFlags = false @@ -83,4 +81,3 @@ func init() { chifraCmd.AddCommand(listCmd) } - diff --git a/src/apps/chifra/cmd/logs.go b/src/apps/chifra/cmd/logs.go index 5909dfc4bc..b074545f89 100644 --- a/src/apps/chifra/cmd/logs.go +++ b/src/apps/chifra/cmd/logs.go @@ -58,8 +58,6 @@ func init() { capabilities = capabilities.Add(caps.Default) capabilities = capabilities.Add(caps.Caching) capabilities = capabilities.Add(caps.Raw) - // EXISTING_CODE - // EXISTING_CODE logsCmd.Flags().SortFlags = false @@ -76,4 +74,3 @@ func init() { chifraCmd.AddCommand(logsCmd) } - diff --git a/src/apps/chifra/cmd/monitors.go b/src/apps/chifra/cmd/monitors.go index d088d9ec4a..5c45aa9f88 100644 --- a/src/apps/chifra/cmd/monitors.go +++ b/src/apps/chifra/cmd/monitors.go @@ -58,8 +58,6 @@ func init() { var capabilities caps.Capability // capabilities for chifra monitors capabilities = capabilities.Add(caps.Default) capabilities = capabilities.Add(caps.Caching) - // EXISTING_CODE - // EXISTING_CODE monitorsCmd.Flags().SortFlags = false @@ -87,4 +85,3 @@ func init() { chifraCmd.AddCommand(monitorsCmd) } - diff --git a/src/apps/chifra/cmd/names.go b/src/apps/chifra/cmd/names.go index d62aecf36b..696558aa84 100644 --- a/src/apps/chifra/cmd/names.go +++ b/src/apps/chifra/cmd/names.go @@ -54,8 +54,6 @@ Notes: func init() { var capabilities caps.Capability // capabilities for chifra names capabilities = capabilities.Add(caps.Default) - // EXISTING_CODE - // EXISTING_CODE namesCmd.Flags().SortFlags = false @@ -92,4 +90,3 @@ func init() { chifraCmd.AddCommand(namesCmd) } - diff --git a/src/apps/chifra/cmd/receipts.go b/src/apps/chifra/cmd/receipts.go index 64412871ce..e8a4ff729a 100644 --- a/src/apps/chifra/cmd/receipts.go +++ b/src/apps/chifra/cmd/receipts.go @@ -57,8 +57,6 @@ func init() { capabilities = capabilities.Add(caps.Default) capabilities = capabilities.Add(caps.Caching) capabilities = capabilities.Add(caps.Raw) - // EXISTING_CODE - // EXISTING_CODE receiptsCmd.Flags().SortFlags = false @@ -73,4 +71,3 @@ func init() { chifraCmd.AddCommand(receiptsCmd) } - diff --git a/src/apps/chifra/cmd/scrape.go b/src/apps/chifra/cmd/scrape.go index 79c4cec6c9..5917e44ad6 100644 --- a/src/apps/chifra/cmd/scrape.go +++ b/src/apps/chifra/cmd/scrape.go @@ -54,8 +54,6 @@ func init() { capabilities = capabilities.Add(caps.Noop) capabilities = capabilities.Add(caps.NoColor) capabilities = capabilities.Add(caps.Chain) - // EXISTING_CODE - // EXISTING_CODE scrapeCmd.Flags().SortFlags = false @@ -92,4 +90,3 @@ func init() { chifraCmd.AddCommand(scrapeCmd) } - diff --git a/src/apps/chifra/cmd/slurp.go b/src/apps/chifra/cmd/slurp.go index 19cad1b6ff..13e1612f46 100644 --- a/src/apps/chifra/cmd/slurp.go +++ b/src/apps/chifra/cmd/slurp.go @@ -60,8 +60,6 @@ func init() { capabilities = capabilities.Add(caps.Caching) capabilities = capabilities.Add(caps.Ether) capabilities = capabilities.Add(caps.Raw) - // EXISTING_CODE - // EXISTING_CODE slurpCmd.Flags().SortFlags = false @@ -89,4 +87,3 @@ One of [ etherscan | key ]`) chifraCmd.AddCommand(slurpCmd) } - diff --git a/src/apps/chifra/cmd/state.go b/src/apps/chifra/cmd/state.go index a24b55fe0c..f1d6269f18 100644 --- a/src/apps/chifra/cmd/state.go +++ b/src/apps/chifra/cmd/state.go @@ -62,8 +62,6 @@ func init() { capabilities = capabilities.Add(caps.Default) capabilities = capabilities.Add(caps.Caching) capabilities = capabilities.Add(caps.Ether) - // EXISTING_CODE - // EXISTING_CODE stateCmd.Flags().SortFlags = false @@ -84,4 +82,3 @@ One or more of [ balance | nonce | code | proxy | deployed | accttype | some | a chifraCmd.AddCommand(stateCmd) } - diff --git a/src/apps/chifra/cmd/status.go b/src/apps/chifra/cmd/status.go index 249ec7e706..43376c73d9 100644 --- a/src/apps/chifra/cmd/status.go +++ b/src/apps/chifra/cmd/status.go @@ -55,8 +55,6 @@ Notes: func init() { var capabilities caps.Capability // capabilities for chifra status capabilities = capabilities.Add(caps.Default) - // EXISTING_CODE - // EXISTING_CODE statusCmd.Flags().SortFlags = false @@ -74,4 +72,3 @@ func init() { chifraCmd.AddCommand(statusCmd) } - diff --git a/src/apps/chifra/cmd/tokens.go b/src/apps/chifra/cmd/tokens.go index ecdc9fa066..829e7b5e9a 100644 --- a/src/apps/chifra/cmd/tokens.go +++ b/src/apps/chifra/cmd/tokens.go @@ -60,8 +60,6 @@ func init() { var capabilities caps.Capability // capabilities for chifra tokens capabilities = capabilities.Add(caps.Default) capabilities = capabilities.Add(caps.Caching) - // EXISTING_CODE - // EXISTING_CODE tokensCmd.Flags().SortFlags = false @@ -80,4 +78,3 @@ One or more of [ name | symbol | decimals | totalSupply | version | some | all ] chifraCmd.AddCommand(tokensCmd) } - diff --git a/src/apps/chifra/cmd/traces.go b/src/apps/chifra/cmd/traces.go index a3e305909e..1ac9f0f489 100644 --- a/src/apps/chifra/cmd/traces.go +++ b/src/apps/chifra/cmd/traces.go @@ -59,8 +59,6 @@ func init() { capabilities = capabilities.Add(caps.Caching) capabilities = capabilities.Add(caps.Ether) capabilities = capabilities.Add(caps.Raw) - // EXISTING_CODE - // EXISTING_CODE tracesCmd.Flags().SortFlags = false @@ -77,4 +75,3 @@ func init() { chifraCmd.AddCommand(tracesCmd) } - diff --git a/src/apps/chifra/cmd/transactions.go b/src/apps/chifra/cmd/transactions.go index 739d4d8091..c7cac94b15 100644 --- a/src/apps/chifra/cmd/transactions.go +++ b/src/apps/chifra/cmd/transactions.go @@ -59,8 +59,6 @@ func init() { capabilities = capabilities.Add(caps.Caching) capabilities = capabilities.Add(caps.Ether) capabilities = capabilities.Add(caps.Raw) - // EXISTING_CODE - // EXISTING_CODE transactionsCmd.Flags().SortFlags = false @@ -88,4 +86,3 @@ One of [ from | to ]`) chifraCmd.AddCommand(transactionsCmd) } - diff --git a/src/apps/chifra/cmd/when.go b/src/apps/chifra/cmd/when.go index 83e97dbfcb..091fb25f90 100644 --- a/src/apps/chifra/cmd/when.go +++ b/src/apps/chifra/cmd/when.go @@ -56,8 +56,6 @@ func init() { var capabilities caps.Capability // capabilities for chifra when capabilities = capabilities.Add(caps.Default) capabilities = capabilities.Add(caps.Caching) - // EXISTING_CODE - // EXISTING_CODE whenCmd.Flags().SortFlags = false @@ -82,4 +80,3 @@ func init() { chifraCmd.AddCommand(whenCmd) } - From 0bd9b88f425cae600969783f7d0143bd050d95cd Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 16:41:46 -0400 Subject: [PATCH 17/20] Hand edits in anticipation of the new auto-gen code --- src/apps/chifra/internal/abis/output.go | 1 - src/apps/chifra/internal/blocks/output.go | 1 - src/apps/chifra/internal/chunks/output.go | 1 - src/apps/chifra/internal/config/output.go | 1 - src/apps/chifra/internal/daemon/output.go | 1 - src/apps/chifra/internal/explore/output.go | 1 - src/apps/chifra/internal/export/output.go | 1 - src/apps/chifra/internal/init/output.go | 1 - src/apps/chifra/internal/list/output.go | 1 - src/apps/chifra/internal/logs/output.go | 1 - src/apps/chifra/internal/monitors/output.go | 1 - src/apps/chifra/internal/names/output.go | 1 - src/apps/chifra/internal/receipts/output.go | 1 - src/apps/chifra/internal/scrape/output.go | 1 - src/apps/chifra/internal/slurp/output.go | 1 - src/apps/chifra/internal/state/output.go | 1 - src/apps/chifra/internal/status/output.go | 1 - src/apps/chifra/internal/tokens/output.go | 1 - src/apps/chifra/internal/traces/output.go | 1 - src/apps/chifra/internal/transactions/output.go | 1 - src/apps/chifra/internal/when/output.go | 1 - 21 files changed, 21 deletions(-) diff --git a/src/apps/chifra/internal/abis/output.go b/src/apps/chifra/internal/abis/output.go index 97c149fc76..e707979cd8 100644 --- a/src/apps/chifra/internal/abis/output.go +++ b/src/apps/chifra/internal/abis/output.go @@ -78,4 +78,3 @@ func GetAbisOptions(args []string, g *globals.GlobalOptions) *AbisOptions { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/blocks/output.go b/src/apps/chifra/internal/blocks/output.go index 770441ab1b..c5d35b78c5 100644 --- a/src/apps/chifra/internal/blocks/output.go +++ b/src/apps/chifra/internal/blocks/output.go @@ -99,4 +99,3 @@ func GetBlocksOptions(args []string, g *globals.GlobalOptions) *BlocksOptions { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/chunks/output.go b/src/apps/chifra/internal/chunks/output.go index 0deef62621..25fb16188b 100644 --- a/src/apps/chifra/internal/chunks/output.go +++ b/src/apps/chifra/internal/chunks/output.go @@ -153,4 +153,3 @@ func FormattedTag(verbose bool, hash base.Hash) string { } // EXISTING_CODE - diff --git a/src/apps/chifra/internal/config/output.go b/src/apps/chifra/internal/config/output.go index 6395ef19d1..adca2cc99d 100644 --- a/src/apps/chifra/internal/config/output.go +++ b/src/apps/chifra/internal/config/output.go @@ -76,4 +76,3 @@ func GetConfigOptions(args []string, g *globals.GlobalOptions) *ConfigOptions { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/daemon/output.go b/src/apps/chifra/internal/daemon/output.go index 77345b791e..5ef98d067a 100644 --- a/src/apps/chifra/internal/daemon/output.go +++ b/src/apps/chifra/internal/daemon/output.go @@ -118,4 +118,3 @@ func GetDaemonOptions(args []string, g *globals.GlobalOptions) *DaemonOptions { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/explore/output.go b/src/apps/chifra/internal/explore/output.go index d0e43af147..ee6d2a9ad6 100644 --- a/src/apps/chifra/internal/explore/output.go +++ b/src/apps/chifra/internal/explore/output.go @@ -124,4 +124,3 @@ func (u *ExploreUrl) getUrl(opts *ExploreOptions) string { } // EXISTING_CODE - diff --git a/src/apps/chifra/internal/export/output.go b/src/apps/chifra/internal/export/output.go index 3a7188e12c..94465b6dfc 100644 --- a/src/apps/chifra/internal/export/output.go +++ b/src/apps/chifra/internal/export/output.go @@ -123,4 +123,3 @@ func (opts *ExportOptions) Validate() error { // TODO: In the old C++ code, the ArticulateAll routine used to identify transactions as token related. Do we still do that? Must we? Why did we do that? // EXISTING_CODE - diff --git a/src/apps/chifra/internal/init/output.go b/src/apps/chifra/internal/init/output.go index 2daedc559b..7412ee6347 100644 --- a/src/apps/chifra/internal/init/output.go +++ b/src/apps/chifra/internal/init/output.go @@ -75,4 +75,3 @@ func GetInitOptions(args []string, g *globals.GlobalOptions) *InitOptions { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/list/output.go b/src/apps/chifra/internal/list/output.go index ccd711e5c5..f265dbef2f 100644 --- a/src/apps/chifra/internal/list/output.go +++ b/src/apps/chifra/internal/list/output.go @@ -85,4 +85,3 @@ func GetListOptions(args []string, g *globals.GlobalOptions) *ListOptions { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/logs/output.go b/src/apps/chifra/internal/logs/output.go index 3bafaacacd..7fb7ddf86f 100644 --- a/src/apps/chifra/internal/logs/output.go +++ b/src/apps/chifra/internal/logs/output.go @@ -74,4 +74,3 @@ func GetLogsOptions(args []string, g *globals.GlobalOptions) *LogsOptions { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/monitors/output.go b/src/apps/chifra/internal/monitors/output.go index 3f2834d5ef..4e86fbc190 100644 --- a/src/apps/chifra/internal/monitors/output.go +++ b/src/apps/chifra/internal/monitors/output.go @@ -102,4 +102,3 @@ func GetMonitorsOptions(args []string, g *globals.GlobalOptions) *MonitorsOption // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/names/output.go b/src/apps/chifra/internal/names/output.go index 3f59467f5f..54cd32309d 100644 --- a/src/apps/chifra/internal/names/output.go +++ b/src/apps/chifra/internal/names/output.go @@ -290,4 +290,3 @@ func (opts *NamesOptions) loadCrudDataIfNeeded(request *http.Request) (err error } // EXISTING_CODE - diff --git a/src/apps/chifra/internal/receipts/output.go b/src/apps/chifra/internal/receipts/output.go index 147f9acaa4..e604647bbd 100644 --- a/src/apps/chifra/internal/receipts/output.go +++ b/src/apps/chifra/internal/receipts/output.go @@ -74,4 +74,3 @@ func GetReceiptsOptions(args []string, g *globals.GlobalOptions) *ReceiptsOption // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/scrape/output.go b/src/apps/chifra/internal/scrape/output.go index 15b925cb3d..5310f2d7f4 100644 --- a/src/apps/chifra/internal/scrape/output.go +++ b/src/apps/chifra/internal/scrape/output.go @@ -102,4 +102,3 @@ func getConfigCmdsFromArgs() map[string]string { } // EXISTING_CODE - diff --git a/src/apps/chifra/internal/slurp/output.go b/src/apps/chifra/internal/slurp/output.go index 07cfc2dd1a..0dae0e7119 100644 --- a/src/apps/chifra/internal/slurp/output.go +++ b/src/apps/chifra/internal/slurp/output.go @@ -86,4 +86,3 @@ func GetSlurpOptions(args []string, g *globals.GlobalOptions) *SlurpOptions { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/state/output.go b/src/apps/chifra/internal/state/output.go index bda448e1ef..2b88723111 100644 --- a/src/apps/chifra/internal/state/output.go +++ b/src/apps/chifra/internal/state/output.go @@ -76,4 +76,3 @@ func GetStateOptions(args []string, g *globals.GlobalOptions) *StateOptions { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/status/output.go b/src/apps/chifra/internal/status/output.go index b577e836d2..1b58fcfa6b 100644 --- a/src/apps/chifra/internal/status/output.go +++ b/src/apps/chifra/internal/status/output.go @@ -76,4 +76,3 @@ func GetStatusOptions(args []string, g *globals.GlobalOptions) *StatusOptions { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/tokens/output.go b/src/apps/chifra/internal/tokens/output.go index 763ada45c8..b921d1a468 100644 --- a/src/apps/chifra/internal/tokens/output.go +++ b/src/apps/chifra/internal/tokens/output.go @@ -76,4 +76,3 @@ func GetTokensOptions(args []string, g *globals.GlobalOptions) *TokensOptions { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/traces/output.go b/src/apps/chifra/internal/traces/output.go index afb221f9e5..34c387ad6b 100644 --- a/src/apps/chifra/internal/traces/output.go +++ b/src/apps/chifra/internal/traces/output.go @@ -78,4 +78,3 @@ func GetTracesOptions(args []string, g *globals.GlobalOptions) *TracesOptions { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/transactions/output.go b/src/apps/chifra/internal/transactions/output.go index 388e910d66..363d94cb00 100644 --- a/src/apps/chifra/internal/transactions/output.go +++ b/src/apps/chifra/internal/transactions/output.go @@ -84,4 +84,3 @@ func GetTransactionsOptions(args []string, g *globals.GlobalOptions) *Transactio // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/when/output.go b/src/apps/chifra/internal/when/output.go index 5a59cf118b..2fce793e45 100644 --- a/src/apps/chifra/internal/when/output.go +++ b/src/apps/chifra/internal/when/output.go @@ -103,4 +103,3 @@ func GetWhenOptions(args []string, g *globals.GlobalOptions) *WhenOptions { // EXISTING_CODE // EXISTING_CODE - From 712bd3763e1545491248ccd4ed31cf2a6ba53b8d Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 16:41:54 -0400 Subject: [PATCH 18/20] Hand edits in anticipation of the new auto-gen code --- src/apps/chifra/internal/abis/options.go | 3 ++- src/apps/chifra/internal/blocks/options.go | 3 ++- src/apps/chifra/internal/chunks/options.go | 3 ++- src/apps/chifra/internal/config/options.go | 3 ++- src/apps/chifra/internal/daemon/options.go | 3 ++- src/apps/chifra/internal/explore/options.go | 3 ++- src/apps/chifra/internal/export/options.go | 3 ++- src/apps/chifra/internal/init/options.go | 3 ++- src/apps/chifra/internal/list/options.go | 3 ++- src/apps/chifra/internal/logs/options.go | 3 ++- src/apps/chifra/internal/monitors/options.go | 3 ++- src/apps/chifra/internal/names/options.go | 5 ++-- src/apps/chifra/internal/receipts/options.go | 3 ++- src/apps/chifra/internal/scrape/options.go | 23 ++++++++++--------- src/apps/chifra/internal/slurp/options.go | 3 ++- src/apps/chifra/internal/state/options.go | 3 ++- src/apps/chifra/internal/status/options.go | 3 ++- src/apps/chifra/internal/tokens/options.go | 3 ++- src/apps/chifra/internal/traces/options.go | 3 ++- .../chifra/internal/transactions/options.go | 3 ++- src/apps/chifra/internal/when/options.go | 3 ++- 21 files changed, 53 insertions(+), 32 deletions(-) diff --git a/src/apps/chifra/internal/abis/options.go b/src/apps/chifra/internal/abis/options.go index d456a95f97..3b8a4ff8c1 100644 --- a/src/apps/chifra/internal/abis/options.go +++ b/src/apps/chifra/internal/abis/options.go @@ -8,6 +8,7 @@ package abisPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -20,6 +21,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // AbisOptions provides all command options for the chifra abis command. @@ -175,4 +177,3 @@ func (opts *AbisOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/blocks/options.go b/src/apps/chifra/internal/blocks/options.go index 4105a83298..cfc71708b0 100644 --- a/src/apps/chifra/internal/blocks/options.go +++ b/src/apps/chifra/internal/blocks/options.go @@ -8,6 +8,7 @@ package blocksPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -20,6 +21,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // BlocksOptions provides all command options for the chifra blocks command. @@ -228,4 +230,3 @@ func (opts *BlocksOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/chunks/options.go b/src/apps/chifra/internal/chunks/options.go index 1c0739a66b..0372dfaf0c 100644 --- a/src/apps/chifra/internal/chunks/options.go +++ b/src/apps/chifra/internal/chunks/options.go @@ -8,6 +8,7 @@ package chunksPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -23,6 +24,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // ChunksOptions provides all command options for the chifra chunks command. @@ -263,4 +265,3 @@ func (opts *ChunksOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/config/options.go b/src/apps/chifra/internal/config/options.go index 845aa1fe2d..ecd121b13c 100644 --- a/src/apps/chifra/internal/config/options.go +++ b/src/apps/chifra/internal/config/options.go @@ -8,6 +8,7 @@ package configPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -18,6 +19,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // ConfigOptions provides all command options for the chifra config command. @@ -144,4 +146,3 @@ func (opts *ConfigOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/daemon/options.go b/src/apps/chifra/internal/daemon/options.go index b600ddfa0c..b99cd723c3 100644 --- a/src/apps/chifra/internal/daemon/options.go +++ b/src/apps/chifra/internal/daemon/options.go @@ -8,6 +8,7 @@ package daemonPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -18,6 +19,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // DaemonOptions provides all command options for the chifra daemon command. @@ -168,4 +170,3 @@ func (opts *DaemonOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/explore/options.go b/src/apps/chifra/internal/explore/options.go index 00c00a34a3..3335094872 100644 --- a/src/apps/chifra/internal/explore/options.go +++ b/src/apps/chifra/internal/explore/options.go @@ -8,6 +8,7 @@ package explorePkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -19,6 +20,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // ExploreOptions provides all command options for the chifra explore command. @@ -151,4 +153,3 @@ func (opts *ExploreOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/export/options.go b/src/apps/chifra/internal/export/options.go index 59823deaeb..429fa8fa25 100644 --- a/src/apps/chifra/internal/export/options.go +++ b/src/apps/chifra/internal/export/options.go @@ -8,6 +8,7 @@ package exportPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -20,6 +21,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // ExportOptions provides all command options for the chifra export command. @@ -312,4 +314,3 @@ func (opts *ExportOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/init/options.go b/src/apps/chifra/internal/init/options.go index 9d36204058..637bef8ff0 100644 --- a/src/apps/chifra/internal/init/options.go +++ b/src/apps/chifra/internal/init/options.go @@ -8,6 +8,7 @@ package initPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -20,6 +21,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // InitOptions provides all command options for the chifra init command. @@ -163,4 +165,3 @@ func (opts *InitOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/list/options.go b/src/apps/chifra/internal/list/options.go index 4c1428599d..020c8ccdb0 100644 --- a/src/apps/chifra/internal/list/options.go +++ b/src/apps/chifra/internal/list/options.go @@ -8,6 +8,7 @@ package listPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -22,6 +23,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // ListOptions provides all command options for the chifra list command. @@ -201,4 +203,3 @@ func (opts *ListOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/logs/options.go b/src/apps/chifra/internal/logs/options.go index 9b9df12d65..e8f234be9a 100644 --- a/src/apps/chifra/internal/logs/options.go +++ b/src/apps/chifra/internal/logs/options.go @@ -8,6 +8,7 @@ package logsPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -20,6 +21,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // LogsOptions provides all command options for the chifra logs command. @@ -163,4 +165,3 @@ func (opts *LogsOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/monitors/options.go b/src/apps/chifra/internal/monitors/options.go index d301c39fca..7d4b168df6 100644 --- a/src/apps/chifra/internal/monitors/options.go +++ b/src/apps/chifra/internal/monitors/options.go @@ -8,6 +8,7 @@ package monitorsPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -20,6 +21,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // MonitorsOptions provides all command options for the chifra monitors command. @@ -193,4 +195,3 @@ func (opts *MonitorsOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/names/options.go b/src/apps/chifra/internal/names/options.go index fed0a2b423..4902a2849f 100644 --- a/src/apps/chifra/internal/names/options.go +++ b/src/apps/chifra/internal/names/options.go @@ -8,6 +8,7 @@ package namesPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -20,6 +21,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // NamesOptions provides all command options for the chifra names command. @@ -45,7 +47,7 @@ type NamesOptions struct { Conn *rpc.Connection `json:"conn,omitempty"` // The connection to the RPC server BadFlag error `json:"badFlag,omitempty"` // An error flag if needed // EXISTING_CODE - crudData *CrudData + crudData *CrudData AutonameAddr base.Address `json:"-"` // EXISTING_CODE } @@ -209,4 +211,3 @@ func (opts *NamesOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/receipts/options.go b/src/apps/chifra/internal/receipts/options.go index 3bca3edc2f..c329214b43 100644 --- a/src/apps/chifra/internal/receipts/options.go +++ b/src/apps/chifra/internal/receipts/options.go @@ -8,6 +8,7 @@ package receiptsPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -20,6 +21,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // ReceiptsOptions provides all command options for the chifra receipts command. @@ -147,4 +149,3 @@ func (opts *ReceiptsOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/scrape/options.go b/src/apps/chifra/internal/scrape/options.go index aceb06c1ef..002231862e 100644 --- a/src/apps/chifra/internal/scrape/options.go +++ b/src/apps/chifra/internal/scrape/options.go @@ -8,6 +8,7 @@ package scrapePkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -20,20 +21,21 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // ScrapeOptions provides all command options for the chifra scrape command. type ScrapeOptions struct { - BlockCnt uint64 `json:"blockCnt,omitempty"` // Maximum number of blocks to process per pass - Sleep float64 `json:"sleep,omitempty"` // Seconds to sleep between scraper passes - Touch uint64 `json:"touch,omitempty"` // First block to visit when scraping (snapped back to most recent snap_to_grid mark) - RunCount uint64 `json:"runCount,omitempty"` // Run the scraper this many times, then quit - Publisher string `json:"publisher,omitempty"` // For some query options, the publisher of the index - DryRun bool `json:"dryRun,omitempty"` // Show the configuration that would be applied if run,no changes are made - Settings config.ScrapeSettings `json:"settings,omitempty"` // Configuration items for the scrape - Globals globals.GlobalOptions `json:"globals,omitempty"` // The global options - Conn *rpc.Connection `json:"conn,omitempty"` // The connection to the RPC server - BadFlag error `json:"badFlag,omitempty"` // An error flag if needed + BlockCnt uint64 `json:"blockCnt,omitempty"` // Maximum number of blocks to process per pass + Sleep float64 `json:"sleep,omitempty"` // Seconds to sleep between scraper passes + Touch uint64 `json:"touch,omitempty"` // First block to visit when scraping (snapped back to most recent snap_to_grid mark) + RunCount uint64 `json:"runCount,omitempty"` // Run the scraper this many times, then quit + Publisher string `json:"publisher,omitempty"` // For some query options, the publisher of the index + DryRun bool `json:"dryRun,omitempty"` // Show the configuration that would be applied if run,no changes are made + Settings config.ScrapeSettings `json:"settings,omitempty"` // Configuration items for the scrape + Globals globals.GlobalOptions `json:"globals,omitempty"` // The global options + Conn *rpc.Connection `json:"conn,omitempty"` // The connection to the RPC server + BadFlag error `json:"badFlag,omitempty"` // An error flag if needed // EXISTING_CODE PublisherAddr base.Address `json:"-"` // EXISTING_CODE @@ -196,4 +198,3 @@ func (opts *ScrapeOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/slurp/options.go b/src/apps/chifra/internal/slurp/options.go index 9452e30558..32e2cdb030 100644 --- a/src/apps/chifra/internal/slurp/options.go +++ b/src/apps/chifra/internal/slurp/options.go @@ -8,6 +8,7 @@ package slurpPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -21,6 +22,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // SlurpOptions provides all command options for the chifra slurp command. @@ -219,4 +221,3 @@ func (opts *SlurpOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/state/options.go b/src/apps/chifra/internal/state/options.go index 5b064f65f7..83f2bac053 100644 --- a/src/apps/chifra/internal/state/options.go +++ b/src/apps/chifra/internal/state/options.go @@ -8,6 +8,7 @@ package statePkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -21,6 +22,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // StateOptions provides all command options for the chifra state command. @@ -208,4 +210,3 @@ func (opts *StateOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/status/options.go b/src/apps/chifra/internal/status/options.go index 4812213fe0..b1f636a892 100644 --- a/src/apps/chifra/internal/status/options.go +++ b/src/apps/chifra/internal/status/options.go @@ -8,6 +8,7 @@ package statusPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -20,6 +21,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" + // EXISTING_CODE ) // StatusOptions provides all command options for the chifra status command. @@ -169,4 +171,3 @@ func (opts *StatusOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/tokens/options.go b/src/apps/chifra/internal/tokens/options.go index 7113b240cf..b71ab086fd 100644 --- a/src/apps/chifra/internal/tokens/options.go +++ b/src/apps/chifra/internal/tokens/options.go @@ -8,6 +8,7 @@ package tokensPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -21,6 +22,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // TokensOptions provides all command options for the chifra tokens command. @@ -208,4 +210,3 @@ func (opts *TokensOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/traces/options.go b/src/apps/chifra/internal/traces/options.go index dfe860cd66..5500b4ef46 100644 --- a/src/apps/chifra/internal/traces/options.go +++ b/src/apps/chifra/internal/traces/options.go @@ -8,6 +8,7 @@ package tracesPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -20,6 +21,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // TracesOptions provides all command options for the chifra traces command. @@ -157,4 +159,3 @@ func (opts *TracesOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/transactions/options.go b/src/apps/chifra/internal/transactions/options.go index f7df4bdc88..0eccba14c1 100644 --- a/src/apps/chifra/internal/transactions/options.go +++ b/src/apps/chifra/internal/transactions/options.go @@ -8,6 +8,7 @@ package transactionsPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -21,6 +22,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // TransactionsOptions provides all command options for the chifra transactions command. @@ -191,4 +193,3 @@ func (opts *TransactionsOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - diff --git a/src/apps/chifra/internal/when/options.go b/src/apps/chifra/internal/when/options.go index 5b9f8eba95..a8ef612eaf 100644 --- a/src/apps/chifra/internal/when/options.go +++ b/src/apps/chifra/internal/when/options.go @@ -8,6 +8,7 @@ package whenPkg import ( + // EXISTING_CODE "encoding/json" "io" "net/http" @@ -21,6 +22,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" + // EXISTING_CODE ) // WhenOptions provides all command options for the chifra when command. @@ -183,4 +185,3 @@ func (opts *WhenOptions) getCaches() (m map[string]bool) { // EXISTING_CODE // EXISTING_CODE - From a46e453aa29b449d190ab7d874e84542eba057a3 Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 16:44:27 -0400 Subject: [PATCH 19/20] Removes all GoLang generation (other than data structures) from C++ code. --- src/dev_tools/makeClass/handle_gocmds.cpp | 302 ------------------ src/dev_tools/makeClass/options.h | 5 - .../makeClass/templates/blank.go.tmpl | 51 --- .../makeClass/templates/blank_options.go.tmpl | 128 -------- .../makeClass/templates/blank_output.go.tmpl | 62 ---- 5 files changed, 548 deletions(-) delete mode 100644 src/dev_tools/makeClass/templates/blank.go.tmpl delete mode 100644 src/dev_tools/makeClass/templates/blank_options.go.tmpl delete mode 100644 src/dev_tools/makeClass/templates/blank_output.go.tmpl diff --git a/src/dev_tools/makeClass/handle_gocmds.cpp b/src/dev_tools/makeClass/handle_gocmds.cpp index 46db29c0c3..033c906ea1 100644 --- a/src/dev_tools/makeClass/handle_gocmds.cpp +++ b/src/dev_tools/makeClass/handle_gocmds.cpp @@ -12,9 +12,6 @@ *-------------------------------------------------------------------------------------------*/ #include "options.h" -extern string_q get_hidden(const CCommandOption& cmd); -extern string_q get_notes2(const CCommandOption& cmd); -extern string_q get_aliases(const CCommandOption& cmd); extern string_q get_optfields(const CCommandOption& cmd); extern string_q get_requestopts(const CCommandOption& cmd); extern string_q get_defaults_apis(const CCommandOption& cmd); @@ -26,47 +23,12 @@ extern string_q get_walk_package(const CCommandOption& cmd); extern string_q get_os_package(const string_q& fn); extern string_q get_base_package(const string_q& fn); extern string_q get_index_package(const string_q& fn); -extern string_q get_setopts(const CCommandOption& cmd); extern string_q get_testlogs(const CCommandOption& cmd); extern string_q get_godefaults(const CCommandOption& cmd); -extern string_q get_use(const CCommandOption& cmd); extern string_q clean_go_positionals(const string_q& in, bool hasRpc); -extern string_q clean_positionals(const string& progName, const string_q& strIn); extern const char* STR_REQUEST_CASE1; extern const char* STR_REQUEST_CASE2; -extern const char* STR_CHIFRA_HELP_END; - -//--------------------------------------------------------------------------------------------------- -bool COptions::handle_gocmds_cmd(const CCommandOption& ep) { - string_q source = asciiFileToString(getPathToTemplates("blank.go.tmpl")); - - replaceAll(source, "[{CAPABILITIES}]", get_capabilities(ep)); - replaceAll(source, "[{LONG}]", "Purpose:\n " + ep.description); - replaceAll(source, "[{OPT_DEF}]", ""); - replaceAll(source, "validate[{PROPER}]Args", "[{ROUTE}]Pkg.Validate"); - replaceAll(source, "[{SET_OPTS}]", get_setopts(ep)); - replaceAll(source, "[{HIDDEN}]", get_hidden(ep)); - replaceAll(source, "[{USE}]", get_use(ep)); - replaceAll(source, "[{ROUTE}]", toLower(ep.api_route)); - replaceAll(source, "[{LOWER}]", toLower(ep.api_route)); - replaceAll(source, "[{PROPER}]", toProper(ep.api_route)); - replaceAll(source, "[{POSTNOTES}]", get_notes2(ep)); - replaceAll(source, "[{ALIASES}]", get_aliases(ep)); - string_q descr = firstLower(ep.description); - if (endsWith(descr, ".")) - replaceReverse(descr, ".", ""); - replaceAll(source, "[{SHORT}]", descr); - - string_q fn = getPathToSource("apps/chifra/cmd/" + ep.api_route + ".go"); - codewrite_t cw(fn, source); - cw.nSpaces = 0; - cw.stripEOFNL = false; - counter.nProcessed += writeCodeIn(this, cw); - counter.nVisited++; - - return true; -} //--------------------------------------------------------------------------------------------------- bool hasValidator(const string_q& route, const string_q& str) { @@ -181,36 +143,12 @@ bool COptions::handle_gocmds_options(const CCommandOption& ep) { return true; } -//--------------------------------------------------------------------------------------------------- -bool COptions::handle_gocmds_output(const CCommandOption& ep) { - string_q source = asciiFileToString(getPathToTemplates("blank_output.go.tmpl")); - replaceAll(source, "[{ROUTE}]", ep.api_route); - replaceAll(source, "[{LOWER}]", toLower(ep.api_route)); - source = substitute(source, "[]string", "++SAVED++"); - source = ep.Format(source); - replaceAll(source, "++SAVED++", "[]string"); - - string_q fn = getPathToSource("apps/chifra/internal/" + ep.api_route + "/output.go"); - - establishFolder(fn); - codewrite_t cw(fn, source); - cw.nSpaces = 0; - cw.stripEOFNL = false; - counter.nProcessed += writeCodeIn(this, cw); - counter.nVisited++; - - return true; -} - //--------------------------------------------------------------------------------------------------- bool COptions::handle_gocmds(void) { LOG_INFO(cYellow, "handling go commands...", string_q(50, ' '), cOff); counter = CCounter(); // reset for (auto ep : endpointArray) { - if (!ep.is_visible) { - continue; - } CCommandOptionArray members; CCommandOptionArray notes; for (auto option : routeOptionArray) { @@ -229,9 +167,7 @@ bool COptions::handle_gocmds(void) { ep.members = &members; ep.notes = ¬es; - handle_gocmds_cmd(ep); handle_gocmds_options(ep); - handle_gocmds_output(ep); handle_gocmds_docfile(ep); } @@ -241,92 +177,6 @@ bool COptions::handle_gocmds(void) { return true; } -bool visitEnumItem2(string_q& item, void* data) { - ostringstream* osp = (ostringstream*)data; - if (osp->str().empty()) - *osp << endl << "One of [ "; - else - *osp << " | "; - *osp << item; - return true; -} - -string_q get_use(const CCommandOption& cmd) { - ostringstream arguments; - for (auto member : *((CCommandOptionArray*)cmd.members)) { - if (member.option_type == "positional") { - if (arguments.str().empty()) - arguments << endl << "Arguments:" << endl; - else - arguments << endl; - arguments << member.Format(" [{LONGNAME}] - [{DESCRIPTION}]"); - if (member.is_required) - arguments << " (required)"; - if (contains(member.data_type, "enum")) { - ostringstream os; - forEveryEnum(visitEnumItem2, member.data_type, &os); - os << " ]"; - string_q str = substitute(os.str(), "One of", - contains(member.data_type, "list") ? "\tOne or more of" : "\tOne of"); - // replace(str, "", ""); - arguments << str; - } - } - } - - ostringstream positionals; - for (auto member : *((CCommandOptionArray*)cmd.members)) { - if (member.option_type == "positional") { - if (!positionals.str().empty()) - positionals << " "; - positionals << member.data_type; - } - } - - string_q ret = "[{ROUTE}] [flags][{TYPES}][{POSITIONALS}]"; - if (contains(toLower(cmd.tool), "scrape")) { - ret = "[{ROUTE}] [flags]"; - } - replace(ret, "[{TYPES}]", clean_positionals(cmd.api_route, positionals.str())); - replace(ret, "[{POSITIONALS}]", arguments.str()); - replace(ret, "enum[show*|edit]", " \n"); - replace(ret, "[flags] [blocks...]", " [flags] [blocks...]"); - replace(ret, "[flags] [mode...]", " [mode...] [flags]"); - replace(ret, "[flags] ", " [flags]"); - return ret; -} - -string_q get_notes2(const CCommandOption& cmd) { - ostringstream os; - for (auto note : *((CCommandOptionArray*)cmd.notes)) { - if (os.str().empty()) { - os << endl; - os << "Notes:" << endl; - } else { - os << endl; - } - os << " - " << substitute(note.description, "`", ""); - // TODO: Coloring in notes (search in makeClass for this note) - // os << " - " << substitute(note.description, "`", "++"); - } - - return trim(substitute(os.str(), "|", "\n ")); -} - -string_q get_aliases(const CCommandOption& cmd) { - if (cmd.aliases.size() == 0) { - return ""; - } - - ostringstream os; - os << "\tAliases: []string{" << endl; - for (auto a : cmd.aliases) { - os << "\t\t\"" << a << "\"," << endl; - } - os << "\t}," << endl; - return os.str(); -} - string_q noUnderbars(const string_q& in) { return substitute(toProper(in), "_", ""); } @@ -666,55 +516,6 @@ string_q get_requestopts(const CCommandOption& cmd) { return os.str(); } -string_q get_goDefault(const CCommandOption& p) { - if (p.go_intype == "[]string") { - return "nil"; - } else if (p.go_intype == "float64") { - if (contains(p.def_val, "NOPOS")) { - return "0.0"; - } else if (!p.def_val.empty()) - return p.def_val; - return "0.0"; - } else if (p.go_intype == "string") { - if (contains(p.def_val, ".eth")) { // an address - return "\"" + p.def_val + "\""; - } else { - return p.def_val; - } - } else if (p.go_intype == "uint64") { - if (contains(p.def_val, "NOPOS")) { - return "0"; - } else if (!p.def_val.empty() && !startsWith(p.def_val, "(")) { - return p.def_val; - } - return "0"; - } - return "false"; -} - -string_q get_goDescription(const CCommandOption& cmd) { - string_q addendum; - if (contains(cmd.data_type, "enum")) { - ostringstream os; - forEveryEnum(visitEnumItem2, cmd.data_type, &os); - os << " ]"; - addendum += substitute(os.str(), "One of", contains(cmd.data_type, "list") ? "One or more of" : "One of"); - } - - string_q fmt = "[{DESCRIPTION}]"; - string_q ret = cmd.Format(fmt); - if (contains(ret, " (default")) { - replace(ret, " (default", "#"); - ret = nextTokenClear(ret, '#'); - } - ret += cmd.is_visible ? "" : " (hidden)"; - ret += addendum; - ret = "\"" + ret + "\""; - if (!addendum.empty()) - replaceAll(ret, "\"", "`"); - return ret; -} - //--------------------------------------------------------------------------------------------------- string_q clean_go_positionals(const string_q& in, bool hasRpc) { string_q ret = in; @@ -729,103 +530,6 @@ string_q clean_go_positionals(const string_q& in, bool hasRpc) { return ret; } -string_q get_hidden(const CCommandOption& cmd) { - ostringstream os; - for (auto p : *((CCommandOptionArray*)cmd.members)) { - if (!p.is_visible) { - os << "\t\t[{ROUTE}]Cmd.Flags().MarkHidden(\"" + p.Format("[{LONGNAME}]") + "\")" << endl; - } - } - ostringstream hide; - if (os.str().empty()) { - return ""; - } - - ostringstream ret; - ret << "\tif os.Getenv(\"TEST_MODE\") != \"true\" {" << endl; - ret << os.str(); - ret << "\t}" << endl; - return ret.str(); -} - -string_q get_setopts(const CCommandOption& cmd) { - ostringstream os; - for (auto p : *((CCommandOptionArray*)cmd.members)) { - if (p.option_type != "positional") { - os << "\t[{ROUTE}]Cmd.Flags()."; - os << p.go_flagtype; - os << "(&[{ROUTE}]Pkg.GetOptions()."; - if (p.isConfig) { - os << "Settings." + p.Format("[{VARIABLE}]") << ", "; - } else { - os << p.Format("[{VARIABLE}]") << ", "; - } - os << p.Format("\"[{LONGNAME}]\", "); - os << p.Format("\"[{HOTKEY}]\", "); - os << get_goDefault(p) << ", "; - os << get_goDescription(p); - os << ")" << endl; - } - } - return os.str(); -} - -//-------------------------------------------------------------------------------- -string_q clean_positionals(const string_q& progName, const string_q& strIn) { - if (contains(strIn, "<")) { - ostringstream os; - os << (strIn == "list" ? "
[address...]" : ""); - os << (strIn == "list" ? " [block...]" : ""); - os << (strIn == "list" ? " [tx_id...]" : ""); - os << (startsWith(strIn, "list list list") - ? "
[address...] [topics...] [fourbytes...]" - : ""); - os << (startsWith(strIn, "list [mode...]" : ""); - - if (contains(toLower(progName), "tokens")) { - os << (strIn == "list list" ? "
[address...] [block...]" : ""); - - } else if (contains(toLower(progName), "chunks")) { - os << (strIn == "enum[manifest|index|blooms|pins|addresses|appearances|stats] list" - ? " [blocks...] [address...]" - : ""); - - } else { - os << (strIn == "list list" ? "
[address...] [block...]" : ""); - } - - if (contains(toLower(progName), "when")) - os << (strIn == "list" ? "< block | date > [ block... | date... ]" : ""); - else if (contains(toLower(progName), "explore")) - os << (strIn == "list" ? "[terms...]" : ""); - else - os << (strIn == "list" ? " [term...]" : ""); - - if (os.str().empty()) { - cerr << "Could not convert " << strIn << " for tool " << progName << endl; - os << strIn; - } - - os << endl; - return " " + os.str(); - } - string_q strOut = strIn; - replaceAll(strOut, "addrs blocks", "
[address...] [block...]"); - replaceAll(strOut, "transactions", " [tx_id...]"); - if (contains(progName, "when")) - replaceAll(strOut, "blocks", "< block | date > [ block... | date... ]"); - else - replaceAll(strOut, "blocks", " [block...]"); - replaceAll(strOut, "addrs topics fourbytes", "
[address...] [topics] [fourbytes]"); - replaceAll(strOut, "addrs", "
[address...]"); - replaceAll(strOut, "files", " [file...]"); - if (contains(toLower(progName), "explore")) - replaceAll(strOut, "terms", "[terms...]"); - else - replaceAll(strOut, "modes", " [mode...]"); - return trim(strOut); -} - const char* STR_REQUEST_CASE1 = "\t\tcase \"++LOWER++\":\n" "\t\t\topts.[{VARIABLE}] = [{ASSIGN}]"; @@ -836,9 +540,3 @@ const char* STR_REQUEST_CASE2 = "\t\t\t\ts := strings.Split(val, \" \") // may contain space separated items\n" "\t\t\t\topts.[{VARIABLE}] = append(opts.[{VARIABLE}], s...)\n" "\t\t\t}"; - -const char* STR_CHIFRA_HELP_END = - " Flags:\n" - " -h, --help display this help screen\n" - "\n" - " Use \"chifra [command] --help\" for more information about a command.\n"; diff --git a/src/dev_tools/makeClass/options.h b/src/dev_tools/makeClass/options.h index 0aded38264..9ca619266f 100644 --- a/src/dev_tools/makeClass/options.h +++ b/src/dev_tools/makeClass/options.h @@ -70,10 +70,8 @@ class COptions : public COptionsBase { bool handle_format(void); bool handle_datamodel(void); - bool handle_gocmds_cmd(const CCommandOption& ep); bool handle_gocmds_options(const CCommandOption& ep); bool handle_gocmds_docfile(const CCommandOption& ep); - bool handle_gocmds_output(const CCommandOption& ep); void verifyGoEnumValidators(void); bool writeOpenApiFile(void); @@ -139,9 +137,6 @@ extern bool forEveryEnum(APPLYFUNC func, const string_q& enumStr, void* data); extern string_q type_2_ModelName(const string_q& type, bool raw); extern string_q getAliases(COptions* opts, const string_q& group, const string_q& route); -//--------------------------------------------------------------------------------------------------- -#define sdkPath string_q("../sdk/") - //--------------------------------------------------------------------------------------------------- extern void reportOneOption(const string_q& route, const string_q& option, const string_q& codebase); extern string_q get_corrected_caps(const string_q& capsIn); diff --git a/src/dev_tools/makeClass/templates/blank.go.tmpl b/src/dev_tools/makeClass/templates/blank.go.tmpl deleted file mode 100644 index dff80d27b6..0000000000 --- a/src/dev_tools/makeClass/templates/blank.go.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2021 The TrueBlocks Authors. All rights reserved. -// Use of this source code is governed by a license that can -// be found in the LICENSE file. -/* - * This file was auto generated with makeClass --gocmds. DO NOT EDIT. - */ - -package cmd - -// EXISTING_CODE -// EXISTING_CODE - -// [{ROUTE}]Cmd represents the [{ROUTE}] command -var [{ROUTE}]Cmd = &cobra.Command{ - Use: usage[{PROPER}], - Short: short[{PROPER}], - Long: long[{PROPER}], - Version: versionText, - PreRun: outputHelpers.PreRunWithJsonWriter("[{ROUTE}]", func() *globals.GlobalOptions { - return &[{ROUTE}]Pkg.GetOptions().Globals - }), - RunE: file.RunWithFileSupport("[{ROUTE}]", [{ROUTE}]Pkg.Run[{PROPER}], [{ROUTE}]Pkg.ResetOptions), - PostRun: outputHelpers.PostRunWithJsonWriter(func() *globals.GlobalOptions { - return &[{ROUTE}]Pkg.GetOptions().Globals - }), -[{ALIASES}]} - -const usage[{PROPER}] = `[{USE}]` - -const short[{PROPER}] = "[{SHORT}]" - -const long[{PROPER}] = `[{LONG}]` - -const notes[{PROPER}] = `[{POSTNOTES}]` - -[{OPT_DEF}]func init() { - [{CAPABILITIES}] // EXISTING_CODE - // EXISTING_CODE - - [{ROUTE}]Cmd.Flags().SortFlags = false - -[{SET_OPTS}][{HIDDEN}] globals.InitGlobals("[{ROUTE}]", [{ROUTE}]Cmd, &[{ROUTE}]Pkg.GetOptions().Globals, capabilities) - - [{ROUTE}]Cmd.SetUsageTemplate(UsageWithNotes(notes[{PROPER}])) - [{ROUTE}]Cmd.SetOut(os.Stderr) - - // EXISTING_CODE - // EXISTING_CODE - - chifraCmd.AddCommand([{ROUTE}]Cmd) -} diff --git a/src/dev_tools/makeClass/templates/blank_options.go.tmpl b/src/dev_tools/makeClass/templates/blank_options.go.tmpl deleted file mode 100644 index 4180800327..0000000000 --- a/src/dev_tools/makeClass/templates/blank_options.go.tmpl +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2021 The TrueBlocks Authors. All rights reserved. -// Use of this source code is governed by a license that can -// be found in the LICENSE file. -/* - * This file was auto generated with makeClass --gocmds. DO NOT EDIT. - */ - -package [{ROUTE}]Pkg - -import ( - "encoding/json" - "fmt" - "io" - "net/http" - "net/url" -[{OS}] "strings" - - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/globals" -[{BASEPKG}] "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/caps" -[{CONFIGPKG}][{INDEXPKG}] "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/identifiers" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" -[{WALKPKG}]) - -// [{PROPER}]Options provides all command options for the chifra [{LOWER}] command. -type [{PROPER}]Options struct { -[{OPT_FIELDS}] // EXISTING_CODE - // EXISTING_CODE -} - -var default[{PROPER}]Options = [{PROPER}]Options{[{GODEFS}]} - -// testLog is used only during testing to export the options for this test case. -func (opts *[{PROPER}]Options) testLog() { -[{TEST_LOGS}] opts.Conn.TestLog(opts.getCaches()) - opts.Globals.TestLog() -} - -// String implements the Stringer interface -func (opts *[{PROPER}]Options) String() string { - b, _ := json.MarshalIndent(opts, "", " ") - return string(b) -} - -// [{LOWER}]FinishParseApi finishes the parsing for server invocations. Returns a new [{PROPER}]Options. -func [{LOWER}]FinishParseApi(w http.ResponseWriter, r *http.Request) *[{PROPER}]Options { - values := r.URL.Query() - if r.Header.Get("User-Agent") == "testRunner" { - values.Set("testRunner", "true") - } - return [{PROPER}]FinishParseInternal(w, values) -} - -func [{PROPER}]FinishParseInternal(w io.Writer, values url.Values) *[{PROPER}]Options { - copy := default[{PROPER}]Options - opts := © -[{DEFAULTS_API}] for key, value := range values { - switch key { -[{REQUEST_OPTS}] default: - if !copy.Globals.Caps.HasKey(key) { - opts.BadFlag = validate.Usage("Invalid key ({0}) in {1} route.", key, "[{ROUTE}]") - } - } - } - opts.Conn = opts.Globals.FinishParseApi(w, values, opts.getCaches()) -[{ENS_CONVERT1}] - // EXISTING_CODE - // EXISTING_CODE -[{ENS_CONVERT2}] - return opts -} - -// [{LOWER}]FinishParse finishes the parsing for command line invocations. Returns a new [{PROPER}]Options. -func [{LOWER}]FinishParse(args []string) *[{PROPER}]Options { - // remove duplicates from args if any (not needed in api mode because the server does it). - dedup := map[string]int{} - if len(args) > 0 { - tmp := []string{} - for _, arg := range args { - if value := dedup[arg]; value == 0 { - tmp = append(tmp, arg) - } - dedup[arg]++ - } - args = tmp - } - - defFmt := "txt" - opts := GetOptions() - opts.Conn = opts.Globals.FinishParse(args, opts.getCaches()) -[{ENS_CONVERT1}] - // EXISTING_CODE - // EXISTING_CODE -[{ENS_CONVERT2}] if len(opts.Globals.Format) == 0 || opts.Globals.Format == "none" { - opts.Globals.Format = defFmt - } - - return opts -} - -func GetOptions() *[{PROPER}]Options { - // EXISTING_CODE - // EXISTING_CODE - return &default[{PROPER}]Options -} - -func ResetOptions(testMode bool) { - // We want to keep writer between command file calls - w := GetOptions().Globals.Writer - default[{PROPER}]Options = [{PROPER}]Options{} - globals.SetDefaults(&default[{PROPER}]Options.Globals) - default[{PROPER}]Options.Globals.TestMode = testMode - default[{PROPER}]Options.Globals.Writer = w - [{CAPABILITIES}] // EXISTING_CODE - // EXISTING_CODE - default[{PROPER}]Options.Globals.Caps = capabilities -} - -func (opts *[{PROPER}]Options) getCaches() (m map[string]bool) { - // EXISTING_CODE - // EXISTING_CODE - return -} - -// EXISTING_CODE -// EXISTING_CODE diff --git a/src/dev_tools/makeClass/templates/blank_output.go.tmpl b/src/dev_tools/makeClass/templates/blank_output.go.tmpl deleted file mode 100644 index d1789d39ab..0000000000 --- a/src/dev_tools/makeClass/templates/blank_output.go.tmpl +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2021 The TrueBlocks Authors. All rights reserved. -// Use of this source code is governed by a license that can -// be found in the LICENSE file. -/* - * Parts of this file were generated with makeClass --run. Edit only those parts of - * the code inside of 'EXISTING_CODE' tags. - */ - -package [{API_ROUTE}]Pkg - -// EXISTING_CODE -// EXISTING_CODE - -// Run[{PROPER}] handles the [{ROUTE}] command for the command line. Returns error only as per cobra. -func Run[{PROPER}](cmd *cobra.Command, args []string) error { - opts := [{LOWER}]FinishParse(args) - outputHelpers.EnableCommand("[{ROUTE}]", true) - // EXISTING_CODE - // EXISTING_CODE - outputHelpers.SetWriterForCommand("[{ROUTE}]", &opts.Globals) - return opts.[{PROPER}]Internal() -} - -// Serve[{PROPER}] handles the [{ROUTE}] command for the API. Returns an error. -func Serve[{PROPER}](w http.ResponseWriter, r *http.Request) error { - opts := [{LOWER}]FinishParseApi(w, r) - outputHelpers.EnableCommand("[{ROUTE}]", true) - // EXISTING_CODE - // EXISTING_CODE - outputHelpers.InitJsonWriterApi("[{ROUTE}]", w, &opts.Globals) - err := opts.[{PROPER}]Internal() - outputHelpers.CloseJsonWriterIfNeededApi("[{ROUTE}]", err, &opts.Globals) - return err -} - -// [{PROPER}]Internal handles the internal workings of the [{ROUTE}] command. Returns an error. -func (opts *[{PROPER}]Options) [{PROPER}]Internal() error { - var err error - if err = opts.validate[{PROPER}](); err != nil { - return err - } - - timer := logger.NewTimer() - msg := "chifra [{ROUTE}]" - // EXISTING_CODE - // EXISTING_CODE - timer.Report(msg) - - return err -} - -// Get[{PROPER}]Options returns the options for this tool so other tools may use it. -func Get[{PROPER}]Options(args []string, g *globals.GlobalOptions) *[{PROPER}]Options { - ret := [{ROUTE}]FinishParse(args) - if g != nil { - ret.Globals = *g - } - return ret -} - -// EXISTING_CODE -// EXISTING_CODE From 67acadb59a54c99d335f399f61338cf1b130c4da Mon Sep 17 00:00:00 2001 From: tjayrush Date: Wed, 20 Mar 2024 16:45:33 -0400 Subject: [PATCH 20/20] Touching --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d5fbd396a..1a6cb3602b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ - [Introduction](#introduction) - [Installing](#installing) -- [Command line](#command-line) +- [Command Line](#command-line) - [Chifra Serve](#chifra-serve) - [Troubleshooting](#troubleshooting) - [The unchained index](#the-unchained-index)