Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .autodoc/docs/data/args.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"space":"cosine","numDimensions":1536}
1 change: 1 addition & 0 deletions .autodoc/docs/data/docstore.json

Large diffs are not rendered by default.

Binary file added .autodoc/docs/data/hnswlib.index
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"fileName": "RestApiErgoClient.java",
"filePath": "appkit/src/main/java/org/ergoplatform/appkit/RestApiErgoClient.java",
"url": "https://github.com/ergoplatform/ergo-appkit/appkit/src/main/java/org/ergoplatform/appkit/RestApiErgoClient.java",
"summary": "The `RestApiErgoClient` class is an implementation of the `ErgoClient` interface that uses the REST API of an Ergo node for communication. It provides methods for creating instances of the `ErgoClient` interface that are connected to a given node of the Ergo network, with or without an explorer connection.\n\nThe `RestApiErgoClient` constructor takes in the following parameters:\n- `nodeUrl`: the http url to the Ergo node REST API endpoint\n- `networkType`: the type of network (mainnet, testnet) the Ergo node is part of\n- `apiKey`: the api key to authenticate the client\n- `explorerUrl`: an optional http url to the Ergo Explorer REST API endpoint. If null or empty, the client works in the `node only` mode.\n- `httpClientBuilder`: an optional builder used to construct http client instances. If null, a new `OkHttpClient` with default parameters is used.\n\nThe `execute` method takes in a `Function` that operates on a `BlockchainContext` and returns a result of type `T`. It creates a `BlockchainContext` using a `BlockchainContextBuilderImpl` instance that takes in the `NodeAndExplorerDataSourceImpl` instance created by the constructor and the `networkType`. It then applies the given `Function` to the `BlockchainContext` and returns the result.\n\nThe `RestApiErgoClient` class also provides several static factory methods for creating instances of the `ErgoClient` interface:\n- `createWithoutExplorer`: creates a new instance of `ErgoClient` in the `node-only` mode, i.e. connected to a given node of the given network type and not connected to explorer.\n- `create`: creates a new instance of `ErgoClient` connected to a given node of the given network type.\n- `createWithHttpClientBuilder`: creates a new instance of `ErgoClient` connected to a given node of the given network type, with an optional `httpClientBuilder`.\n- `create`: creates a new instance of `ErgoClient` using node configuration parameters and an optional explorerUrl.\n- `createWithHttpClientBuilder`: creates a new instance of `ErgoClient` using node configuration parameters, an optional explorerUrl, and an optional `httpClientBuilder`.\n\nThe `RestApiErgoClient` class also provides a `getDataSource` method that returns the `NodeAndExplorerDataSourceImpl` instance created by the constructor.\n\nOverall, the `RestApiErgoClient` class provides a convenient way to create instances of the `ErgoClient` interface that are connected to a given node of the Ergo network, with or without an explorer connection. It abstracts away the details of creating and configuring the necessary API clients and provides a simple interface for executing operations on the Ergo blockchain.",
"questions": "1. What is the purpose of this code?\n- This code provides an implementation of the ErgoClient interface that uses the REST API of an Ergo node for communication.\n\n2. What are the parameters required to create a new instance of RestApiErgoClient?\n- To create a new instance of RestApiErgoClient, you need to provide the http url to the Ergo node REST API endpoint, the type of network the Ergo node is part of, an api key to authenticate the client, and an optional http url to the Ergo Explorer REST API endpoint.\n\n3. What is the purpose of the execute method in RestApiErgoClient?\n- The execute method in RestApiErgoClient takes a function that operates on a BlockchainContext and returns a result of type T. It creates a new BlockchainContext using the NodeAndExplorerDataSourceImpl and the network type, and applies the function to this context to obtain the result."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"fileName": "ApiConfig.java",
"filePath": "appkit/src/main/java/org/ergoplatform/appkit/config/ApiConfig.java",
"url": "https://github.com/ergoplatform/ergo-appkit/appkit/src/main/java/org/ergoplatform/appkit/config/ApiConfig.java",
"summary": "The `ApiConfig` class in the `org.ergoplatform.appkit.config` package is responsible for storing the connection parameters for the Ergo node API. It has two private instance variables, `apiUrl` and `apiKey`, which are accessed through public getter methods.\n\nThe `getApiUrl()` method returns the URL of the Ergo node API endpoint. This URL is used to connect to the Ergo node and send requests to it. An example usage of this method would be to retrieve the current block height of the Ergo blockchain:\n\n```java\nApiConfig apiConfig = new ApiConfig();\napiConfig.setApiUrl(\"http://localhost:9052\");\nErgoClient ergoClient = RestApiErgoClient.create(apiConfig);\nint currentHeight = ergoClient.execute(ctx -> ctx.getHeaders().getHeight());\n```\n\nIn this example, an instance of `ApiConfig` is created and its `apiUrl` variable is set to the URL of the Ergo node API endpoint. An `ErgoClient` is then created using the `RestApiErgoClient.create()` method, which takes an instance of `ApiConfig` as an argument. Finally, the `execute()` method is called on the `ErgoClient` instance to retrieve the current block height of the Ergo blockchain.\n\nThe `getApiKey()` method returns the API key used for authentication with the Ergo node API. This key is a secret key whose hash was used in the Ergo node configuration. An example usage of this method would be to authenticate with the Ergo node API:\n\n```java\nApiConfig apiConfig = new ApiConfig();\napiConfig.setApiUrl(\"http://localhost:9052\");\napiConfig.setApiKey(\"mySecretApiKey\");\nErgoClient ergoClient = RestApiErgoClient.create(apiConfig);\nergoClient.execute(ctx -> ctx.getBoxesUnspent());\n```\n\nIn this example, an instance of `ApiConfig` is created and its `apiUrl` and `apiKey` variables are set to the URL of the Ergo node API endpoint and the secret API key, respectively. An `ErgoClient` is then created using the `RestApiErgoClient.create()` method, which takes an instance of `ApiConfig` as an argument. Finally, the `execute()` method is called on the `ErgoClient` instance to retrieve the unspent boxes on the Ergo blockchain, using the authenticated API key.",
"questions": "1. What is the purpose of this class?\n This class defines the connection parameters for the Ergo node API, including the API URL and API key for authentication.\n\n2. How are the API URL and API key set?\n The values for the API URL and API key are set through the private instance variables `apiUrl` and `apiKey`, respectively.\n\n3. Can the API URL and API key be modified?\n It is not clear from this code whether the API URL and API key can be modified after they are initially set. The class only provides getter methods for these values, indicating that they may be read-only."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"fileName": "ErgoNodeConfig.java",
"filePath": "appkit/src/main/java/org/ergoplatform/appkit/config/ErgoNodeConfig.java",
"url": "https://github.com/ergoplatform/ergo-appkit/appkit/src/main/java/org/ergoplatform/appkit/config/ErgoNodeConfig.java",
"summary": "The `ErgoNodeConfig` class is a part of the `ergo-appkit` project and is used to define the parameters of an Ergo node that will be used by the `ErgoClient`. The `ErgoClient` is a Java library that provides a high-level API for interacting with the Ergo blockchain. \n\nThe `ErgoNodeConfig` class has three private fields: `nodeApi`, `wallet`, and `networkType`. The `nodeApi` field is an instance of the `ApiConfig` class, which defines the connection parameters for the Ergo node's API. The `wallet` field is an instance of the `WalletConfig` class, which defines the parameters for working with the wallet. The `networkType` field is an instance of the `NetworkType` enum, which specifies the expected network type (Mainnet or Testnet).\n\nThe class has three public methods: `getNodeApi()`, `getWallet()`, and `getNetworkType()`. These methods return the values of the corresponding private fields. \n\nThis class can be used to configure an instance of the `ErgoClient` class. For example, to create an instance of the `ErgoClient` that connects to the Testnet Ergo node with the specified API and wallet configurations, the following code can be used:\n\n```\nApiConfig apiConfig = new ApiConfig(\"http://localhost:9053\");\nWalletConfig walletConfig = new WalletConfig(\"testnet\", \"password\");\nErgoNodeConfig nodeConfig = new ErgoNodeConfig(apiConfig, walletConfig, NetworkType.TESTNET);\nErgoClient client = ErgoClient.create(nodeConfig);\n```\n\nIn this example, the `ApiConfig` and `WalletConfig` instances are created with the necessary parameters, and then an instance of the `ErgoNodeConfig` class is created with these instances and the `NetworkType.TESTNET` enum value. Finally, an instance of the `ErgoClient` class is created with the `ErgoNodeConfig` instance. \n\nOverall, the `ErgoNodeConfig` class is an important part of the `ergo-appkit` project that allows developers to configure an instance of the `ErgoClient` class with the necessary parameters to interact with the Ergo blockchain.",
"questions": "1. What is the purpose of this code?\n- This code defines a class called `ErgoNodeConfig` that contains parameters for connecting to an Ergo node and working with its wallet.\n\n2. What other classes or files does this code interact with?\n- This code imports the `org.ergoplatform.appkit.NetworkType` class and uses it as a parameter type for the `networkType` field.\n\n3. How can this code be used in a larger project?\n- This code can be used to configure and connect to an Ergo node in a Java-based project that interacts with the Ergo blockchain. Other classes in the `org.ergoplatform.appkit` package may also be used in conjunction with this class."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"fileName": "ErgoToolConfig.java",
"filePath": "appkit/src/main/java/org/ergoplatform/appkit/config/ErgoToolConfig.java",
"url": "https://github.com/ergoplatform/ergo-appkit/appkit/src/main/java/org/ergoplatform/appkit/config/ErgoToolConfig.java",
"summary": "The `ErgoToolConfig` class is responsible for managing the configuration parameters of the ErgoTool utility. It contains two fields: `node` and `parameters`, which represent the configuration of the Ergo node and the tool parameters, respectively. \n\nThe `getNode()` method returns the `ErgoNodeConfig` object, which contains the configuration parameters of the Ergo node. \n\nThe `getParameters()` method returns a `ToolParameters` object, which is a HashMap of name-value pairs representing the tool parameters. \n\nThe class provides three methods for loading the configuration from a file: `load(Reader reader)`, `load(File file)`, and `load(String fileName)`. The `load(Reader reader)` method takes a `Reader` object as input and returns an `ErgoToolConfig` object created from the file content. The `load(File file)` method takes a `File` object as input and returns an `ErgoToolConfig` object created from the file content. The `load(String fileName)` method takes a `String` object as input, which is the name of the file relative to the current directory. It then resolves the file using `File#getAbsolutePath()` and returns an `ErgoToolConfig` object created from the file content. \n\nThis class can be used in the larger project to manage the configuration parameters of the ErgoTool utility. Developers can use the `load()` methods to load the configuration from a file and then access the configuration parameters using the `getNode()` and `getParameters()` methods. For example, the following code loads the configuration from a file named `config.json` and then gets the node configuration:\n\n```\nErgoToolConfig config = ErgoToolConfig.load(\"config.json\");\nErgoNodeConfig nodeConfig = config.getNode();\n```",
"questions": "1. What is the purpose of the `ErgoToolConfig` class?\n \n The `ErgoToolConfig` class is responsible for holding configuration parameters for the ErgoTool utility.\n\n2. What is the purpose of the `load` methods?\n \n The `load` methods are used to load configuration data from a file or reader and create an instance of `ErgoToolConfig` with the file content.\n\n3. What is the purpose of the `ToolParameters` class?\n \n The `ToolParameters` class represents a section of the configuration with named parameters in the form of a HashMap of Name-Value pairs."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"fileName": "ToolParameters.java",
"filePath": "appkit/src/main/java/org/ergoplatform/appkit/config/ToolParameters.java",
"url": "https://github.com/ergoplatform/ergo-appkit/appkit/src/main/java/org/ergoplatform/appkit/config/ToolParameters.java",
"summary": "The `ToolParameters` class is a subclass of the `HashMap` class and is used to store key-value pairs of tool parameters. This class overrides the `equals`, `hashCode`, and `toString` methods of the `HashMap` class to provide custom implementations.\n\nThe `equals` method checks if the given object is equal to the current object by comparing their classes and calling the `equals` method of the superclass.\n\nThe `hashCode` method returns the hash code of the superclass.\n\nThe `toString` method returns a string representation of the object by calling the `toIndentedString` method and appending it to a string builder.\n\nThe `toIndentedString` method is a private helper method that converts the given object to a string with each line indented by 4 spaces (except the first line).\n\nThis class can be used to store tool parameters in a key-value format and to compare them with other instances of the `ToolParameters` class. For example, if we have two instances of `ToolParameters` called `params1` and `params2`, we can compare them using the `equals` method like this:\n\n```\nif (params1.equals(params2)) {\n // do something\n}\n```\n\nWe can also print the contents of a `ToolParameters` object using the `toString` method like this:\n\n```\nToolParameters params = new ToolParameters();\nparams.put(\"param1\", \"value1\");\nparams.put(\"param2\", \"value2\");\nSystem.out.println(params.toString());\n```\n\nThis will output:\n\n```\nclass Parameters {\n {param1=value1, param2=value2}\n}\n```\n\nOverall, the `ToolParameters` class provides a convenient way to store and compare tool parameters in a key-value format.",
"questions": "1. What is the purpose of the `ToolParameters` class?\n \n The `ToolParameters` class extends `HashMap<String, String>` and provides methods for overriding `equals`, `hashCode`, and `toString` methods.\n\n2. Why does the `equals` method check if the object is of the same class?\n \n The `equals` method checks if the object is of the same class to ensure that the comparison is only done between objects of the same type.\n\n3. What is the purpose of the `toIndentedString` method?\n \n The `toIndentedString` method is a private helper method that converts an object to a string with each line indented by 4 spaces, except the first line. It is used by the `toString` method to format the output."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"fileName": "WalletConfig.java",
"filePath": "appkit/src/main/java/org/ergoplatform/appkit/config/WalletConfig.java",
"url": "https://github.com/ergoplatform/ergo-appkit/appkit/src/main/java/org/ergoplatform/appkit/config/WalletConfig.java",
"summary": "The `WalletConfig` class is a part of the `ergo-appkit` project and provides parameters for working with a wallet. The purpose of this class is to store the mnemonic, password, and mnemonic password used for generating keys in the wallet. \n\nThe `getMnemonic()` method returns the mnemonic used for generating keys in the wallet. It is important that this value is the same as the one used by the wallet of the node specified in `ErgoNodeConfig#getNodeApi()`. This ensures that the keys generated by the wallet are compatible with the node's wallet.\n\nThe `getPassword()` method returns the password used by the Ergo node wallet to protect wallet data. An empty or null string value means that no password is set.\n\nThe `getMnemonicPassword()` method returns the password used to protect the mnemonic. By default, this value is the same as the `password` value returned by the `getPassword()` method. \n\nThis class can be used in the larger project to configure the wallet used by the Ergo node. For example, a developer could create an instance of the `WalletConfig` class and set the mnemonic, password, and mnemonic password values to match the values used by the node's wallet. This instance could then be passed to other classes or methods that require access to the wallet configuration. \n\nHere is an example of how the `WalletConfig` class could be used in the larger project:\n\n```\nErgoNodeConfig nodeConfig = new ErgoNodeConfig(...);\nWalletConfig walletConfig = new WalletConfig();\nwalletConfig.setMnemonic(\"example mnemonic\");\nwalletConfig.setPassword(\"example password\");\nwalletConfig.setMnemonicPassword(\"example mnemonic password\");\nnodeConfig.setWalletConfig(walletConfig);\n```\n\nIn this example, an instance of the `ErgoNodeConfig` class is created with some unspecified parameters. An instance of the `WalletConfig` class is also created and its mnemonic, password, and mnemonic password values are set. Finally, the `WalletConfig` instance is passed to the `setWalletConfig()` method of the `ErgoNodeConfig` instance, which configures the node's wallet with the specified values.",
"questions": "1. What is the purpose of this class?\n - This class contains parameters for working with a wallet in the Ergo platform.\n2. What are the three private variables declared in this class?\n - The three private variables declared in this class are `mnemonic`, `password`, and `mnemonicPassword`.\n3. What is the difference between `password` and `mnemonicPassword`?\n - `password` is used to protect wallet data, while `mnemonicPassword` is used to protect the mnemonic (which is used for generation of keys in the wallet). By default, `mnemonicPassword` is the same as `password`."
}
Loading