The PlainWalletApi class provides a Java interface for interacting with wallet functions in an Android application.
Initializes the wallet using the specified address.
public native String initWithAddress(String address, String workingDir, int logLevel);- Parameters:
address: The address to initialize the wallet with (e.g.,http://127.0.0.1:2222).workingDir: The working directory for the wallet.logLevel: The logging level.
Initializes the wallet using the specified IP address and port.
public native String initWithIp(String ip, String port, String workingDir, int logLevel);- Parameters:
ip: The IP address to initialize the wallet with.port: The port number.workingDir: The working directory for the wallet.logLevel: The logging level.
Resets the wallet.
public native String reset();Sets the logging level for the wallet.
public native String setLogLevel(int logLevel);- Parameters:
logLevel: The logging level.
Retrieves the version of the wallet API.
public native String getVersion();Retrieves information about wallet files.
public native String getWalletFiles();Exports private information to the specified directory.
public native String getExportPrivateInfo(String targetDir);- Parameters:
targetDir: The directory to export private information to.
Deletes the wallet with the specified file name.
public native String deleteWallet(String fileName);- Parameters:
fileName: The name of the wallet file to delete.
Retrieves information about a specific address.
public native String getAddressInfo(String addr);- Parameters:
addr: The address to retrieve information for.
Retrieves the application configuration using the specified encryption key.
public native String getAppConfig(String encryptionKey);- Parameters:
encryptionKey: The encryption key to decrypt the configuration.
Sets the application configuration using the specified configuration string and encryption key.
public native String setAppConfig(String confStr, String encryptionKey);- Parameters:
confStr: The configuration string.encryptionKey: The encryption key to encrypt the configuration.
Generates a random key of the specified length.
public native String generateRandomKey(long length);- Parameters:
length: The length of the random key.
Retrieves the logs buffer for debugging.
public native String getLogsBuffer();Truncates the log.
public native String truncateLog();Retrieves the connectivity status.
public native String getConnectivityStatus();Opens a wallet from the specified path using the provided password.
public native String open(String path, String password);- Parameters:
path: The path to the wallet file.password: The password to open the wallet.
Restores a wallet using the provided seed, path, password, and optional seed password.
public native String restore(String seed, String path, String password, String seedPassword);- Parameters:
seed: The seed for the wallet.path: The path to restore the wallet to.password: The password for the wallet.seedPassword: The optional seed password.
Generates a new wallet at the specified path with the provided password.
public native String generate(String path, String password);- Parameters:
path: The path to generate the wallet.password: The password for the wallet.
Retrieves information about opened wallets.
public native String getOpenedWallets();Retrieves the status of the wallet with the specified handle.
public native String getWalletStatus(long h);- Parameters:
h: The handle of the wallet.
Closes the wallet with the specified handle.
public native String closeWallet(long h);- Parameters:
h: The handle of the wallet.
Invokes a JSON RPC on the wallet with the specified handle and parameters.
public native String invoke(long h, String params);- Parameters:
h: The handle of the wallet.params: The parameters for the JSON RPC.
Initiates an asynchronous RPC call to a method with the specified name, instance ID, and parameters.
public native String asyncCall(String methodName, long instanceId, String params);- Parameters:
methodName: The name of the method.instanceId: The instance ID.params: The parameters for the method.
Tries to pull the result of a previous asynchronous call.
public native String tryPullResult(long instanceId);- Parameters:
instanceId: The instance ID.
Initiates a synchronous RPC call to a method with the specified name, instance ID, and parameters.
public native String syncCall(String methodName, long instanceId, String params);- Parameters:
methodName: The name of the method.instanceId: The instance ID.params: The parameters for the method.
Checks if a wallet exists at the specified path.
public native boolean isWalletExist(String path);- Parameters:
path: The path to the wallet file.
Retrieves information about the wallet with the specified handle.
public native String getWalletInfo(long h);- Parameters:
h: The handle of the wallet.
Resets the password of the wallet with the specified handle.
public native String resetWalletPassword(long h, String password);- Parameters:
h: The handle of the wallet.password: The new password for the wallet.
Retrieves the current transaction fee based on priority.
public native long getCurrentTxFee(long priority);- Parameters:
priority: The priority of the transaction fee.