diff --git a/lbcwallet.go b/lbcwallet.go index b36ed2e..71f0520 100644 --- a/lbcwallet.go +++ b/lbcwallet.go @@ -75,7 +75,7 @@ func walletMain() error { // Create and start HTTP server to serve wallet client connections. // This will be updated with the wallet and chain server RPC client // created below after each is created. - rpcs, legacyRPCServer, err := startRPCServers(loader) + legacyRPCServer, err := startRPCServers(loader) if err != nil { log.Errorf("Unable to create RPC servers: %v", err) return err @@ -88,7 +88,7 @@ func walletMain() error { } loader.RunAfterLoad(func(w *wallet.Wallet) { - startWalletRPCServices(w, rpcs, legacyRPCServer) + startWalletRPCServices(w, legacyRPCServer) }) if !cfg.NoInitialLoad { @@ -110,15 +110,6 @@ func walletMain() error { log.Errorf("Failed to close wallet: %v", err) } }) - if rpcs != nil { - addInterruptHandler(func() { - // TODO: Does this need to wait for the grpc server to - // finish up any requests? - log.Warn("Stopping RPC server...") - rpcs.Stop() - log.Info("RPC server shutdown") - }) - } if legacyRPCServer != nil { addInterruptHandler(func() { log.Warn("Stopping legacy RPC server...") diff --git a/log.go b/log.go index 2bb0795..a169b39 100644 --- a/log.go +++ b/log.go @@ -15,7 +15,6 @@ import ( "github.com/lbryio/lbcd/rpcclient" "github.com/lbryio/lbcwallet/chain" "github.com/lbryio/lbcwallet/rpc/legacyrpc" - "github.com/lbryio/lbcwallet/rpc/rpcserver" "github.com/lbryio/lbcwallet/wallet" "github.com/lbryio/lbcwallet/wtxmgr" ) @@ -67,7 +66,6 @@ func init() { wtxmgr.UseLogger(txmgrLog) chain.UseLogger(chainLog) rpcclient.UseLogger(chainLog) - rpcserver.UseLogger(grpcLog) legacyrpc.UseLogger(legacyRPCLog) } diff --git a/rpc/api.proto b/rpc/api.proto deleted file mode 100644 index 5dfec9e..0000000 --- a/rpc/api.proto +++ /dev/null @@ -1,319 +0,0 @@ -syntax = "proto3"; - -package walletrpc; - -service VersionService { - rpc Version (VersionRequest) returns (VersionResponse); -} - -message VersionRequest {} -message VersionResponse { - string version_string = 1; - uint32 major = 2; - uint32 minor = 3; - uint32 patch = 4; - string prerelease = 5; - string build_metadata = 6; -} - -service WalletService { - // Queries - rpc Ping (PingRequest) returns (PingResponse); - rpc Network (NetworkRequest) returns (NetworkResponse); - rpc AccountNumber (AccountNumberRequest) returns (AccountNumberResponse); - rpc Accounts (AccountsRequest) returns (AccountsResponse); - rpc Balance (BalanceRequest) returns (BalanceResponse); - rpc GetTransactions (GetTransactionsRequest) returns (GetTransactionsResponse); - - // Notifications - rpc TransactionNotifications (TransactionNotificationsRequest) returns (stream TransactionNotificationsResponse); - rpc SpentnessNotifications (SpentnessNotificationsRequest) returns (stream SpentnessNotificationsResponse); - rpc AccountNotifications (AccountNotificationsRequest) returns (stream AccountNotificationsResponse); - - // Control - rpc ChangePassphrase (ChangePassphraseRequest) returns (ChangePassphraseResponse); - rpc RenameAccount (RenameAccountRequest) returns (RenameAccountResponse); - rpc NextAccount (NextAccountRequest) returns (NextAccountResponse); - rpc NextAddress (NextAddressRequest) returns (NextAddressResponse); - rpc ImportPrivateKey (ImportPrivateKeyRequest) returns (ImportPrivateKeyResponse); - rpc FundTransaction (FundTransactionRequest) returns (FundTransactionResponse); - rpc SignTransaction (SignTransactionRequest) returns (SignTransactionResponse); - rpc PublishTransaction (PublishTransactionRequest) returns (PublishTransactionResponse); -} - -service WalletLoaderService { - rpc WalletExists (WalletExistsRequest) returns (WalletExistsResponse); - rpc CreateWallet (CreateWalletRequest) returns (CreateWalletResponse); - rpc OpenWallet (OpenWalletRequest) returns (OpenWalletResponse); - rpc CloseWallet (CloseWalletRequest) returns (CloseWalletResponse); - rpc StartConsensusRpc (StartConsensusRpcRequest) returns (StartConsensusRpcResponse); -} - -message TransactionDetails { - message Input { - uint32 index = 1; - uint32 previous_account = 2; - int64 previous_amount = 3; - } - message Output { - uint32 index = 1; - uint32 account = 2; - bool internal = 3; - } - bytes hash = 1; - bytes transaction = 2; - repeated Input debits = 3; - repeated Output credits = 4; - int64 fee = 5; - int64 timestamp = 6; // May be earlier than a block timestamp, but never later. -} - -message BlockDetails { - bytes hash = 1; - int32 height = 2; - int64 timestamp = 3; - repeated TransactionDetails transactions = 4; -} - -message AccountBalance { - uint32 account = 1; - int64 total_balance = 2; -} - -message PingRequest {} -message PingResponse {} - -message NetworkRequest {} -message NetworkResponse { - uint32 active_network = 1; -} - -message AccountNumberRequest { - string account_name = 1; -} -message AccountNumberResponse { - uint32 account_number = 1; -} - -message AccountsRequest {} -message AccountsResponse { - message Account { - uint32 account_number = 1; - string account_name = 2; - int64 total_balance = 3; - uint32 external_key_count = 4; - uint32 internal_key_count = 5; - uint32 imported_key_count = 6; - } - repeated Account accounts = 1; - bytes current_block_hash = 2; - int32 current_block_height = 3; -} - -message RenameAccountRequest { - uint32 account_number = 1; - string new_name = 2; -} -message RenameAccountResponse {} - -message NextAccountRequest { - bytes passphrase = 1; - string account_name = 2; -} -message NextAccountResponse { - uint32 account_number = 1; -} - -message NextAddressRequest { - uint32 account = 1; - enum Kind { - BIP0044_EXTERNAL = 0; - BIP0044_INTERNAL = 1; - } - Kind kind = 2; -} -message NextAddressResponse { - string address = 1; -} - -message ImportPrivateKeyRequest { - bytes passphrase = 1; - uint32 account = 2; - string private_key_wif = 3; - bool rescan = 4; -} -message ImportPrivateKeyResponse { -} - -message BalanceRequest { - uint32 account_number = 1; - int32 required_confirmations = 2; -} -message BalanceResponse { - int64 total = 1; - int64 spendable = 2; - int64 immature_reward = 3; -} - -message GetTransactionsRequest { - // Optionally specify the starting block from which to begin including all transactions. - // Either the starting block hash or height may be specified, but not both. - // If a block height is specified and is negative, the absolute value becomes the number of - // last blocks to include. That is, given a current chain height of 1000 and a starting block - // height of -3, transaction notifications will be created for blocks 998, 999, and 1000. - // If both options are excluded, transaction results are created for transactions since the - // genesis block. - bytes starting_block_hash = 1; - sint32 starting_block_height = 2; - - // Optionally specify the last block that transaction results may appear in. - // Either the ending block hash or height may be specified, but not both. - // If both are excluded, transaction results are created for all transactions - // through the best block, and include all unmined transactions. - bytes ending_block_hash = 3; - int32 ending_block_height = 4; - - // Include at least this many of the newest transactions if they exist. - // Cannot be used when the ending block hash is specified. - // - // TODO: remove until spec adds it back in some way. - int32 minimum_recent_transactions = 5; - - // TODO: limit max number of txs? -} -message GetTransactionsResponse { - repeated BlockDetails mined_transactions = 1; - repeated TransactionDetails unmined_transactions = 2; -} - -message ChangePassphraseRequest { - enum Key { - PRIVATE = 0; - PUBLIC = 1; - } - Key key = 1; - bytes old_passphrase = 2; - bytes new_passphrase = 3; -} -message ChangePassphraseResponse {} - -message FundTransactionRequest { - uint32 account = 1; - int64 target_amount = 2; - int32 required_confirmations = 3; - bool include_immature_coinbases = 4; - bool include_change_script = 5; - bool include_stakes = 6; -} -message FundTransactionResponse { - message PreviousOutput { - bytes transaction_hash = 1; - uint32 output_index = 2; - int64 amount = 3; - bytes pk_script = 4; - int64 receive_time = 5; - bool from_coinbase = 6; - } - repeated PreviousOutput selected_outputs = 1; - int64 total_amount = 2; - bytes change_pk_script = 3; -} - -message SignTransactionRequest { - bytes passphrase = 1; - - bytes serialized_transaction = 2; - - // If no indexes are specified, signatures scripts will be added for - // every input. If any input indexes are specified, only those inputs - // will be signed. Rather than returning an incompletely signed - // transaction if any of the inputs to be signed can not be, the RPC - // immediately errors. - repeated uint32 input_indexes = 3; -} -message SignTransactionResponse { - bytes transaction = 1; - repeated uint32 unsigned_input_indexes = 2; -} - -message PublishTransactionRequest { - bytes signed_transaction = 1; -} -message PublishTransactionResponse {} - -message TransactionNotificationsRequest {} -message TransactionNotificationsResponse { - // Sorted by increasing height. This is a repeated field so many new blocks - // in a new best chain can be notified at once during a reorganize. - repeated BlockDetails attached_blocks = 1; - - // If there was a chain reorganize, there may have been blocks with wallet - // transactions that are no longer in the best chain. These are those - // block's hashes. - repeated bytes detached_blocks = 2; - - // Any new unmined transactions are included here. These unmined transactions - // refer to the current best chain, so transactions from detached blocks may - // be moved to mempool and included here if they are not mined or double spent - // in the new chain. Additonally, if no new blocks were attached but a relevant - // unmined transaction is seen by the wallet, it will be reported here. - repeated TransactionDetails unmined_transactions = 3; - - // Instead of notifying all of the removed unmined transactions, - // just send all of the current hashes. - repeated bytes unmined_transaction_hashes = 4; -} - -message SpentnessNotificationsRequest { - uint32 account = 1; - bool no_notify_unspent = 2; - bool no_notify_spent = 3; -} - -message SpentnessNotificationsResponse { - bytes transaction_hash = 1; - uint32 output_index = 2; - message Spender { - bytes transaction_hash = 1; - uint32 input_index = 2; - } - Spender spender = 3; -} - -message AccountNotificationsRequest {} -message AccountNotificationsResponse { - uint32 account_number = 1; - string account_name = 2; - uint32 external_key_count = 3; - uint32 internal_key_count = 4; - uint32 imported_key_count = 5; -} - -message CreateWalletRequest { - bytes public_passphrase = 1; - bytes private_passphrase = 2; - bytes seed = 3; -} -message CreateWalletResponse {} - -message OpenWalletRequest { - bytes public_passphrase = 1; -} -message OpenWalletResponse {} - -message CloseWalletRequest {} -message CloseWalletResponse {} - -message WalletExistsRequest {} -message WalletExistsResponse { - bool exists = 1; -} - -message StartConsensusRpcRequest { - string network_address = 1; - string username = 2; - bytes password = 3; - bytes certificate = 4; - bool skipverify = 5; -} -message StartConsensusRpcResponse {} diff --git a/rpc/documentation/README.md b/rpc/documentation/README.md deleted file mode 100644 index 7d57afb..0000000 --- a/rpc/documentation/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# RPC Documentation - -This project provides a [gRPC](http://www.grpc.io/) server for Remote Procedure -Call (RPC) access from other processes. This is intended to be the primary -means by which users, through other client programs, interact with the wallet. - -These documents cover the documentation for both consumers of the server and -developers who must make changes or additions to the API and server -implementation: - -- [API specification](./api.md) -- [Client usage](./clientusage.md) -- [Making API changes](./serverchanges.md) - -A legacy RPC server based on the JSON-RPC API of Bitcoin Core's wallet is also -available, but documenting its usage is out of scope for these documents. diff --git a/rpc/documentation/api.md b/rpc/documentation/api.md deleted file mode 100644 index d6ed8cc..0000000 --- a/rpc/documentation/api.md +++ /dev/null @@ -1,999 +0,0 @@ -# RPC API Specification - -Version: 2.0.1 -======= - -**Note:** This document assumes the reader is familiar with gRPC concepts. -Refer to the [gRPC Concepts documentation](http://www.grpc.io/docs/guides/concepts.html) -for any unfamiliar terms. - -**Note:** The naming style used for autogenerated identifiers may differ -depending on the language being used. This document follows the naming style -used by Google in their Protocol Buffers and gRPC documentation as well as this -project's `.proto` files. That is, CamelCase is used for services, methods, and -messages, lower_snake_case for message fields, and SCREAMING_SNAKE_CASE for -enums. - -**Note:** The entierty of the RPC API is currently considered unstable and may -change anytime. Stability will be gradually added based on correctness, -perceived usefulness and ease-of-use over alternatives, and user feedback. - -This document is the authoritative source on the RPC API's definitions and -semantics. Any divergence from this document is an implementation error. API -fixes and additions require a version increase according to the rules of -[Semantic Versioning 2.0.0](http://semver.org/). - -Only optional proto3 message fields are used (the `required` keyword is never -used in the `.proto` file). If a message field must be set to something other -than the default value, or any other values are invalid, the error must occur in -the application's message handling. This prevents accidentally introducing -parsing errors if a previously optional field is missing or a new required field -is added. - -Functionality is grouped into gRPC services. Depending on what functions are -currently callable, different services will be running. As an example, the -server may be running without a loaded wallet, in which case the Wallet service -is not running and the Loader service must be used to create a new or load an -existing wallet. - -- [`VersionService`](#versionservice) -- [`LoaderService`](#loaderservice) -- [`WalletService`](#walletservice) - -## `VersionService` - -The `VersionService` service provides the caller with versioning information -regarding the RPC server. It has no dependencies and is always running. - -**Methods:** - -- [`Version`](#version) - -### Methods - -#### `Version` - -The `Version` method returns the RPC server version. Versioning follows the -rules of Semantic Versioning (SemVer) 2.0.0. - -**Request:** `VersionRequest` - -**Response:** `VersionResponse` - -- `string version_string`: The version encoded as a string. - -- `uint32 major`: The SemVer major version number. - -- `uint32 minor`: The SemVer minor version number. - -- `uint32 patch`: The SemVer patch version number. - -- `string prerelease`: The SemVer pre-release version identifier, if any. - -- `string build_metadata`: Extra SemVer build metadata, if any. - -**Expected errors:** None - -**Stability:** Stable - -## `LoaderService` - -The `LoaderService` service provides the caller with functions related to the -management of the wallet and its connection to the Bitcoin network. It has no -dependencies and is always running. - -**Methods:** - -- [`WalletExists`](#walletexists) -- [`CreateWallet`](#createwallet) -- [`OpenWallet`](#openwallet) -- [`CloseWallet`](#closewallet) -- [`StartConsensusRpc`](#startconsensusrpc) - -**Shared messages:** - -- [`BlockDetails`](#blockdetails) -- [`TransactionDetails`](#transactiondetails) - -### Methods - -#### `WalletExists` - -The `WalletExists` method returns whether a file at the wallet database's file -path exists. Clients that must load wallets with this service are expected to -call this RPC to query whether `OpenWallet` should be used to open an existing -wallet, or `CreateWallet` to create a new wallet. - -**Request:** `WalletExistsRequest` - -**Response:** `WalletExistsResponse` - -- `bool exists`: Whether the wallet file exists. - -**Expected errors:** None - -**Stability:** Unstable - -___ - -#### `CreateWallet` - -The `CreateWallet` method is used to create a wallet that is protected by two -levels of encryption: the public passphrase (for data that is made public on the -blockchain) and the private passphrase (for private keys). Since the seed is -not saved in the wallet database and clients should make their users backup the -seed, it needs to be passed as part of the request. - -After creating a wallet, the `WalletService` service begins running. - -**Request:** `CreateWalletRequest` - -- `bytes public_passphrase`: The passphrase used for the outer wallet - encryption. This passphrase protects data that is made public on the - blockchain. If this passphrase has zero length, an insecure default is used - instead. - -- `bytes private_passphrase`: The passphrase used for the inner wallet - encryption. This is the passphrase used for data that must always remain - private, such as private keys. The length of this field must not be zero. - -- `bytes seed`: The BIP0032 seed used to derive all wallet keys. The length of - this field must be between 16 and 64 bytes, inclusive. - -**Response:** `CreateWalletReponse` - -**Expected errors:** - -- `FailedPrecondition`: The wallet is currently open. - -- `AlreadyExists`: A file already exists at the wallet database file path. - -- `InvalidArgument`: A private passphrase was not included in the request, or - the seed is of incorrect length. - -**Stability:** Unstable: There needs to be a way to recover all keys and - transactions of a wallet being recovered by its seed. It is unclear whether - it should be part of this method or a `WalletService` method. - -___ - -#### `OpenWallet` - -The `OpenWallet` method is used to open an existing wallet database. If the -wallet is protected by a public passphrase, it can not be successfully opened if -the public passphrase parameter is missing or incorrect. - -After opening a wallet, the `WalletService` service begins running. - -**Request:** `OpenWalletRequest` - -- `bytes public_passphrase`: The passphrase used for the outer wallet - encryption. This passphrase protects data that is made public on the - blockchain. If this passphrase has zero length, an insecure default is used - instead. - -**Response:** `OpenWalletResponse` - -**Expected errors:** - -- `FailedPrecondition`: The wallet is currently open. - -- `NotFound`: The wallet database file does not exist. - -- `InvalidArgument`: The public encryption passphrase was missing or incorrect. - -**Stability:** Unstable - -___ - -#### `CloseWallet` - -The `CloseWallet` method is used to cleanly stop all wallet operations on a -loaded wallet and close the database. After closing, the `WalletService` -service will remain running but any operations that require the database will be -unusable. - -**Request:** `CloseWalletRequest` - -**Response:** `CloseWalletResponse` - -**Expected errors:** - -- `FailedPrecondition`: The wallet is not currently open. - -**Stability:** Unstable: It would be preferable to stop the `WalletService` - after closing, but there does not appear to be any way to do so currently. It - may also be a good idea to limit under what conditions a wallet can be closed, - such as only closing wallets loaded by `LoaderService` and/or using a secret - to authenticate the operation. - -___ - -#### `StartConsensusRpc` - -The `StartConsensusRpc` method is used to provide clients the ability to dynamically -start the RPC client. This RPC client is used for wallet syncing and -publishing transactions to the Bitcoin network. - -**Request:** `StartConsensusRpcRequest` - -- `string network_address`: The host/IP and optional port of the RPC server to - connect to. IP addresses may be IPv4 or IPv6. If the port is missing, a - default port is chosen corresponding to the default RPC port of the - active Bitcoin network. - -- `string username`: The RPC username required to authenticate to the RPC - server. - -- `bytes password`: The RPC password required to authenticate to the RPC server. - -- `bytes certificate`: The consensus RPC server's TLS certificate. If this - field has zero length and the network address describes a loopback connection - (`localhost`, `127.0.0.1`, or `::1`) TLS will be disabled. - -**Response:** `StartConsensusRpcResponse` - -**Expected errors:** - -- `FailedPrecondition`: A consensus RPC client is already active. - -- `InvalidArgument`: The network address is ill-formatted or does not contain a - valid IP address. - -- `NotFound`: The consensus RPC server is unreachable. This condition may not - return `Unavailable` as that refers to `LoaderService` itself being - unavailable. - -- `InvalidArgument`: The username, password, or certificate are invalid. This - condition may not be return `Unauthenticated` as that refers to the client not - having the credentials to call this method. - -**Stability:** Unstable: It is unknown if the consensus RPC client will remain - used after the project gains SPV support. - -## `WalletService` - -The WalletService service provides RPCs for the wallet itself. The service -depends on a loaded wallet and does not run when the wallet has not been created -or opened yet. - -The service provides the following methods: - -- [RPC API Specification](#rpc-api-specification) -- [Version: 2.0.1](#version-201) - - [`VersionService`](#versionservice) - - [Methods](#methods) - - [`Version`](#version) - - [`LoaderService`](#loaderservice) - - [Methods](#methods-1) - - [`WalletExists`](#walletexists) - - [`CreateWallet`](#createwallet) - - [`OpenWallet`](#openwallet) - - [`CloseWallet`](#closewallet) - - [`StartConsensusRpc`](#startconsensusrpc) - - [`WalletService`](#walletservice) - - [`Ping`](#ping) - - [`Network`](#network) - - [`AccountNumber`](#accountnumber) - - [`Accounts`](#accounts) - - [`Balance`](#balance) - - [`GetTransactions`](#gettransactions) - - [`ChangePassphrase`](#changepassphrase) - - [`RenameAccount`](#renameaccount) - - [`NextAccount`](#nextaccount) - - [`NextAddress`](#nextaddress) - - [`ImportPrivateKey`](#importprivatekey) - - [`FundTransaction`](#fundtransaction) - - [`SignTransaction`](#signtransaction) - - [`PublishTransaction`](#publishtransaction) - - [`TransactionNotifications`](#transactionnotifications) - - [`SpentnessNotifications`](#spentnessnotifications) - - [`AccountNotifications`](#accountnotifications) - - [Shared messages](#shared-messages) - - [`BlockDetails`](#blockdetails) - - [`TransactionDetails`](#transactiondetails) - -#### `Ping` - -The `Ping` method checks whether the service is active. - -**Request:** `PingRequest` - -**Response:** `PingResponse` - -**Expected errors:** None - -**Stability:** Unstable: This may be moved to another service as it does not - depend on the wallet. - -___ - -#### `Network` - -The `Network` method returns the network identifier constant describing the -server's active network. - -**Request:** `NetworkRequest` - -**Response:** `NetworkResponse` - -- `uint32 active_network`: The network identifier. - -**Expected errors:** None - -**Stability:** Unstable: This may be moved to another service as it does not - depend on the wallet. - -___ - -#### `AccountNumber` - -The `AccountNumber` method looks up a BIP0044 account number by an account's -unique name. - -**Request:** `AccountNumberRequest` - -- `string account_name`: The name of the account being queried. - -**Response:** `AccountNumberResponse` - -- `uint32 account_number`: The BIP0044 account number. - -**Expected errors:** - -- `Aborted`: The wallet database is closed. - -- `NotFound`: No accounts exist by the name in the request. - -**Stability:** Unstable - -___ - -#### `Accounts` - -The `Accounts` method returns the current properties of all accounts managed in -the wallet. - -**Request:** `AccountsRequest` - -**Response:** `AccountsResponse` - -- `repeated Account accounts`: Account properties grouped into `Account` nested - message types, one per account, ordered by increasing account numbers. - - **Nested message:** `Account` - - - `uint32 account_number`: The BIP0044 account number. - - - `string account_name`: The name of the account. - - - `int64 total_balance`: The total (zero-conf and immature) balance, counted - in Satoshis. - - - `uint32 external_key_count`: The number of derived keys in the external - key chain. - - - `uint32 internal_key_count`: The number of derived keys in the internal - key chain. - - - `uint32 imported_key_count`: The number of imported keys. - -- `bytes current_block_hash`: The hash of the block wallet is considered to - be synced with. - -- `int32 current_block_height`: The height of the block wallet is considered - to be synced with. - -**Expected errors:** - -- `Aborted`: The wallet database is closed. - -**Stability:** Unstable - -___ - -#### `Balance` - -The `Balance` method queries the wallet for an account's balance. Balances are -returned as combination of total, spendable (by consensus and request policy), -and unspendable immature coinbase balances. - -**Request:** `BalanceRequest` - -- `uint32 account_number`: The account number to query. - -- `int32 required_confirmations`: The number of confirmations required before an - unspent transaction output's value is included in the spendable balance. This - may not be negative. - -**Response:** `BalanceResponse` - -- `int64 total`: The total (zero-conf and immature) balance, counted in - Satoshis. - -- `int64 spendable`: The spendable balance, given some number of required - confirmations, counted in Satoshis. This equals the total balance when the - required number of confirmations is zero and there are no immature coinbase - outputs. - -- `int64 immature_reward`: The total value of all immature coinbase outputs, - counted in Satoshis. - -**Expected errors:** - -- `InvalidArgument`: The required number of confirmations is negative. - -- `Aborted`: The wallet database is closed. - -- `NotFound`: The account does not exist. - -**Stability:** Unstable: It may prove useful to modify this RPC to query - multiple accounts together. - -___ - -#### `GetTransactions` - -The `GetTransactions` method queries the wallet for relevant transactions. The -query set may be specified using a block range, inclusive, with the heights or -hashes of the minimum and maximum block. Transaction results are grouped -grouped by the block they are mined in, or grouped together with other unmined -transactions. - -**Request:** `GetTransactionsRequest` - -- `bytes starting_block_hash`: The block hash of the block to begin including - transactions from. If this field is set to the default, the - `starting_block_height` field is used instead. If changed, the byte array - must have length 32 and `starting_block_height` must be zero. - -- `sint32 starting_block_height`: The block height to begin including - transactions from. If this field is non-zero, `starting_block_hash` must be - set to its default value to avoid ambiguity. If positive, the field is - interpreted as a block height. If negative, the height is subtracted from the - block wallet considers itself in sync with. - -- `bytes ending_block_hash`: The block hash of the last block to include - transactions from. If this default is set to the default, the - `ending_block_height` field is used instead. If changed, the byte array must - have length 32 and `ending_block_height` must be zero. - -- `int32 ending_block_height`: The block height of the last block to include - transactions from. If non-zero, the `ending_block_hash` field must be set to - its default value to avoid ambiguity. If both this field and - `ending_block_hash` are set to their default values, no upper block limit is - used and transactions through the best block and all unmined transactions are - included. - -**Response:** `GetTransactionsResponse` - -- `repeated BlockDetails mined_transactions`: All mined transactions, organized - by blocks in the order they appear in the blockchain. - - The `BlockDetails` message is used by other methods and is documented - [here](#blockdetails). - -- `repeated TransactionDetails unmined_transactions`: All unmined transactions. - The ordering is unspecified. - - The `TransactionDetails` message is used by other methods and is documented - [here](#transactiondetails). - -**Expected errors:** - -- `InvalidArgument`: A non-default block hash field did not have the correct length. - -- `Aborted`: The wallet database is closed. - -- `NotFound`: A block, specified by its height or hash, is unknown to the - wallet. - -**Stability:** Unstable - -- There is currently no way to get only unmined transactions due to the way - the block range is specified. - -- It would be useful to ignore the block range and return some minimum number of - the most recent transaction, but it is unclear if that should be added to this - method's request object, or to make a new method. - -- A specified ordering (such as dependency order) for all returned unmined - transactions would be useful. - -___ - -#### `ChangePassphrase` - -The `ChangePassphrase` method requests a change to either the public (outer) or -private (inner) encryption passphrases. - -**Request:** `ChangePassphraseRequest` - -- `Key key`: The key being changed. - - **Nested enum:** `Key` - - - `PRIVATE`: The request specifies to change the private (inner) encryption - passphrase. - - - `PUBLIC`: The request specifies to change the public (outer) encryption - passphrase. - -- `bytes old_passphrase`: The current passphrase for the encryption key. This - is the value being modified. If the public passphrase is being modified and - this value is the default value, an insecure default is used instead. - -- `bytes new_passphrase`: The replacement passphrase. This field may only have - zero length if the public passphrase is being changed, in which case an - insecure default will be used instead. - -**Response:** `ChangePassphraseResponse` - -**Expected errors:** - -- `InvalidArgument`: A zero length passphrase was specified when changing the - private passphrase, or the old passphrase was incorrect. - -- `Aborted`: The wallet database is closed. - -**Stability:** Unstable - -___ - -#### `RenameAccount` - -The `RenameAccount` method requests a change to an account's name property. - -**Request:** `RenameAccountRequest` - -- `uint32 account_number`: The number of the account being modified. - -- `string new_name`: The new name for the account. - -**Response:** `RenameAccountResponse` - -**Expected errors:** - -- `Aborted`: The wallet database is closed. - -- `InvalidArgument`: The new account name is a reserved name. - -- `NotFound`: The account does not exist. - -- `AlreadyExists`: An account by the same name already exists. - -**Stability:** Unstable: There should be a way to specify a starting block or - time to begin the rescan at. Additionally, since the client is expected to be - able to do asynchronous RPC, it may be useful for the response to block on the - rescan finishing before returning. - -___ - -#### `NextAccount` - -The `NextAccount` method generates the next BIP0044 account for the wallet. - -**Request:** `NextAccountRequest` - -- `bytes passphrase`: The private passphrase required to derive the next - account's key. - -- `string account_name`: The name to give the new account. - -**Response:** `NextAccountResponse` - -- `uint32 account_number`: The number of the newly-created account. - -**Expected errors:** - -- `Aborted`: The wallet database is closed. - -- `InvalidArgument`: The private passphrase is incorrect. - -- `InvalidArgument`: The new account name is a reserved name. - -- `AlreadyExists`: An account by the same name already exists. - -**Stability:** Unstable - -___ - -#### `NextAddress` - -The `NextAddress` method generates the next deterministic address for the -wallet. - -**Request:** `NextAddressRequest` - -- `uint32 account`: The number of the account to derive the next address for. - -- `Kind kind`: The type of address to generate. - - **Nested enum:** `Kind` - - - `BIP0044_EXTERNAL`: The request specifies to generate the next address for - the account's BIP0044 external key chain. - - - `BIP0044_INTERNAL`: The request specifies to generate the next address for - the account's BIP0044 internal key chain. - -**Response:** `NextAddressResponse` - -- `string address`: The payment address string. - -**Expected errors:** - -- `Aborted`: The wallet database is closed. - -- `NotFound`: The account does not exist. - -**Stability:** Unstable - -___ - -#### `ImportPrivateKey` - -The `ImportPrivateKey` method imports a private key in Wallet Import Format -(WIF) encoding to a wallet account. A rescan may optionally be started to -search for transactions involving the private key's associated payment address. - -**Request:** `ImportPrivateKeyRequest` - -- `bytes passphrase`: The wallet's private passphrase. - -- `uint32 account`: The account number to associate the imported key with. - -- `string private_key_wif`: The private key, encoded using WIF. - -- `bool rescan`: Whether or not to perform a blockchain rescan for the imported - key. - -**Response:** `ImportPrivateKeyResponse` - -**Expected errors:** - -- `InvalidArgument`: The private key WIF string is not a valid WIF encoding. - -- `Aborted`: The wallet database is closed. - -- `InvalidArgument`: The private passphrase is incorrect. - -- `NotFound`: The account does not exist. - -**Stability:** Unstable - -___ - -#### `FundTransaction` - -The `FundTransaction` method queries the wallet for unspent transaction outputs -controlled by some account. Results may be refined by setting a target output -amount and limiting the required confirmations. The selection algorithm is -unspecified. - -Output results are always created even if a minimum target output amount could -not be reached. This allows this method to behave similar to the `Balance` -method while also including the outputs that make up that balance. - -Change outputs can optionally be returned by this method as well. This can -provide the caller with everything necessary to construct an unsigned -transaction paying to already known addresses or scripts. - -**Request:** `FundTransactionRequest` - -- `uint32 account`: Account number containing the keys controlling the output - set to query. - -- `int64 target_amount`: If positive, the service may limit output results to - those that sum to at least this amount (counted in Satoshis). If zero, all - outputs not excluded by other arguments are returned. This may not be - negative. - -- `int32 required_confirmations`: The minimum number of block confirmations - needed to consider including an output in the return set. This may not be - negative. - -- `bool include_immature_coinbases`: If true, immature coinbase outputs will - also be included. - -- `bool include_change_script`: If true, a change script is included in the - response object. - -**Response:** `FundTransactionResponse` - -- `repeated PreviousOutput selected_outputs`: The output set returned as a list - of `PreviousOutput` nested message objects. - - **Nested message:** `PreviousOutput` - - - `bytes transaction_hash`: The hash of the transaction this output originates - from. - - - `uint32 output_index`: The output index of the transaction this output - originates from. - - - `int64 amount`: The output value (counted in Satoshis) of the unspent - transaction output. - - - `bytes pk_script`: The output script of the unspent transaction output. - - - `int64 receive_time`: The earliest Unix time the wallet became aware of the - transaction containing this output. - - - `bool from_coinbase`: Whether the output is a coinbase output. - -- `int64 total_amount`: The sum of all returned output amounts. This may be - less than a positive target amount if there were not enough eligible outputs - available. - -- `bytes change_pk_script`: A transaction output script used to pay the - remaining amount to a newly-generated change address for the account. This is - null if `include_change_script` was false or the target amount was not - exceeded. - -**Expected errors:** - -- `InvalidArgument`: The target amount is negative. - -- `InvalidArgument`: The required confirmations is negative. - -- `Aborted`: The wallet database is closed. - -- `NotFound`: The account does not exist. - -**Stability:** Unstable - -___ - -#### `SignTransaction` - -The `SignTransaction` method adds transaction input signatures to a serialized -transaction using a wallet private keys. - -**Request:** `SignTransactionRequest` - -- `bytes passphrase`: The wallet's private passphrase. - -- `bytes serialized_transaction`: The transaction to add input signatures to. - -- `repeated uint32 input_indexes`: The input indexes that signature scripts must - be created for. If there are no indexes, input scripts are created for every - input that is missing an input script. - -**Response:** `SignTransactionResponse` - -- `bytes transaction`: The serialized transaction with added input scripts. - -- `repeated uint32 unsigned_input_indexes`: The indexes of every input that an - input script could not be created for. - -**Expected errors:** - -- `InvalidArgument`: The serialized transaction can not be decoded. - -- `Aborted`: The wallet database is closed. - -- `InvalidArgument`: The private passphrase is incorrect. - -**Stability:** Unstable: It is unclear if the request should include an account, - and only secrets of that account are used when creating input scripts. It's - also missing options similar to Core's signrawtransaction, such as the sighash - flags and additional keys. - -___ - -#### `PublishTransaction` - -The `PublishTransaction` method publishes a signed, serialized transaction to -the Bitcoin network. If the transaction spends any of the wallet's unspent -outputs or creates a new output controlled by the wallet, it is saved by the -wallet and republished later if it or a double spend are not mined. - -**Request:** `PublishTransactionRequest` - -- `bytes signed_transaction`: The signed transaction to publish. - -**Response:** `PublishTransactionResponse` - -**Expected errors:** - -- `InvalidArgument`: The serialized transaction can not be decoded or is missing - input scripts. - -- `Aborted`: The wallet database is closed. - -**Stability:** Unstable - -___ - -#### `TransactionNotifications` - -The `TransactionNotifications` method returns a stream of notifications -regarding changes to the blockchain and transactions relevant to the wallet. - -**Request:** `TransactionNotificationsRequest` - -**Response:** `stream TransactionNotificationsResponse` - -- `repeated BlockDetails attached_blocks`: A list of blocks attached to the main - chain, sorted by increasing height. All newly mined transactions are included - in these messages, in the message corresponding to the block that contains - them. If this field has zero length, the notification is due to an unmined - transaction being added to the wallet. - - The `BlockDetails` message is used by other methods and is documented - [here](#blockdetails). - -- `repeated bytes detached_blocks`: The hashes of every block that was - reorganized out of the main chain. These are sorted by heights in decreasing - order (newest blocks first). - -- `repeated TransactionDetails unmined_transactions`: All newly added unmined - transactions. When relevant transactions are reorganized out and not included - in (or double-spent by) the new chain, they are included here. - - The `TransactionDetails` message is used by other methods and is documented - [here](#transactiondetails). - -- `repeated bytes unmined_transaction_hashes`: The hashes of every - currently-unmined transaction. This differs from the `unmined_transactions` - field by including every unmined transaction, rather than those newly added to - the unmined set. - -**Expected errors:** - -- `Aborted`: The wallet database is closed. - -**Stability:** Unstable: This method could use a better name. - -___ - -#### `SpentnessNotifications` - -The `SpentnessNotifications` method returns a stream of notifications regarding -the spending of unspent outputs and/or the discovery of new unspent outputs for -an account. - -**Request:** `SpentnessNotificationsRequest` - -- `uint32 account`: The account to create notifications for. - -- `bool no_notify_unspent`: If true, do not send any notifications for - newly-discovered unspent outputs controlled by the account. - -- `bool no_notify_spent`: If true, do not send any notifications for newly-spent - transactions controlled by the account. - -**Response:** `stream SpentnessNotificationsResponse` - -- `bytes transaction_hash`: The hash of the serialized transaction containing - the output being reported. - -- `uint32 output_index`: The output index of the output being reported. - -- `Spender spender`: If null, the output is a newly-discovered unspent output. - If not null, the message records the transaction input that spends the - previously-unspent output. - - **Nested message:** `Spender` - - - `bytes transaction_hash`: The hash of the serialized transaction that spends - the reported output. - - - `uint32 input_index`: The index of the input that spends the reported - output. - -**Expected errors:** - -- `InvalidArgument`: The `no_notify_unspent` and `no_notify_spent` request - fields are both true. - -- `Aborted`: The wallet database is closed. - -**Stability:** Unstable - -___ - -#### `AccountNotifications` - -The `AccountNotifications` method returns a stream of notifications for account -property changes, such as name and key counts. - -**Request:** `AccountNotificationsRequest` - -**Response:** `stream AccountNotificationsResponse` - -- `uint32 account_number`: The BIP0044 account being reported. - -- `string account_name`: The current account name. - -- `uint32 external_key_count`: The current number of BIP0032 external keys - derived for the account. - -- `uint32 internal_key_count`: The current number of BIP0032 internal keys - derived for the account. - -- `uint32 imported_key_count`: The current number of private keys imported into - the account. - -**Expected errors:** - -- `Aborted`: The wallet database is closed. - -**Stability:** Unstable: This should probably share a message with the - `Accounts` method. - -___ - -### Shared messages - -The following messages are used by multiple methods. To avoid unnecessary -duplication, they are documented once here. - -#### `BlockDetails` - -The `BlockDetails` message is included in responses to report a block and the -wallet's relevant transactions contained therein. - -- `bytes hash`: The hash of the block being reported. - -- `int32 height`: The height of the block being reported. - -- `int64 timestamp`: The Unix time included in the block header. - -- `repeated TransactionDetails transactions`: All transactions relevant to the - wallet that are mined in this block. Transactions are sorted by their block - index in increasing order. - - The `TransactionDetails` message is used by other methods and is documented - [here](#transactiondetails). - -**Stability**: Unstable: This should probably include the block version. - -___ - -#### `TransactionDetails` - -The `TransactionDetails` message is included in responses to report transactions -relevant to the wallet. The message includes details such as which previous -wallet inputs are spent by this transaction, whether each output is controlled -by the wallet or not, the total fee (if calculable), and the earlist time the -transaction was seen. - -- `bytes hash`: The hash of the serialized transaction. - -- `bytes transaction`: The serialized transaction. - -- `repeated Input debits`: Properties for every previously-unspent wallet output - spent by this transaction. - - **Nested message:** `Input` - - - `uint32 index`: The transaction input index of the input being reported. - - - `uint32 previous_account`: The account that controlled the now-spent output. - - - `int64 previous_amount`: The previous output value. - -- `repeated Output credits`: Properties for every output controlled by the wallet. - - **Nested message:** `Output` - - - `uint32 index`: The transaction output index of the output being reported. - - - `uint32 account`: The account number of the controlled output. - - - `bool internal`: Whether the output pays to an address derived from the - account's internal key series. This often means the output is a change - output. - -- `int64 fee`: The transaction fee, if calculable. The fee is only calculable - when every previous output spent by this transaction is also recorded by - wallet. Otherwise, this field is zero. - -- `int64 timestamp`: The Unix time of the earliest time this transaction was - seen. - -**Stability**: Unstable: Since the caller is expected to decode the serialized - transaction, and would have access to every output script, the output - properties could be changed to only include outputs controlled by the wallet. diff --git a/rpc/documentation/clientusage.md b/rpc/documentation/clientusage.md deleted file mode 100644 index 3ef1f22..0000000 --- a/rpc/documentation/clientusage.md +++ /dev/null @@ -1,439 +0,0 @@ -# Client usage - -Clients use RPC to interact with the wallet. A client may be implemented in any -language directly supported by [gRPC](http://www.grpc.io/), languages capable of -performing [FFI](https://en.wikipedia.org/wiki/Foreign_function_interface) with -these, and languages that share a common runtime (e.g. Scala, Kotlin, and Ceylon -for the JVM, F# for the CLR, etc.). Exact instructions differ slightly -depending on the language being used, but the general process is the same for -each. In short summary, to call RPC server methods, a client must: - -1. Generate client bindings specific for the [wallet RPC server API](./api.md) -2. Import or include the gRPC dependency -3. (Optional) Wrap the client bindings with application-specific types -4. Open a gRPC channel using the wallet server's self-signed TLS certificate - -The only exception to these steps is if the client is being written in Go. In -that case, the first step may be omitted by importing the bindings from -lbcwallet itself. - -The rest of this document provides short examples of how to quickly get started -by implementing a basic client that fetches the balance of the default account -(account 0) from a testnet3 wallet listening on `localhost:19244` in several -different languages: - -- [Client usage](#client-usage) - - [Go](#go) - - [C++](#c) - - [C#](#c-1) - - [Node.js](#nodejs) - - [Python](#python) - -Unless otherwise stated under the language example, it is assumed that -gRPC is already already installed. The gRPC installation procedure -can vary greatly depending on the operating system being used and -whether a gRPC source install is required. Follow the [gRPC install -instructions](https://github.com/grpc/grpc/blob/master/INSTALL) if -gRPC is not already installed. A full gRPC install also includes -[Protocol Buffers](https://github.com/google/protobuf) (compiled with -support for the proto3 language version), which contains the protoc -tool and language plugins used to compile this project's `.proto` -files to language-specific bindings. - -## Go - -The native gRPC library (gRPC Core) is not required for Go clients (a -pure Go implementation is used instead) and no additional setup is -required to generate Go bindings. - -```Go -package main - -import ( - "fmt" - "path/filepath" - - pb "github.com/lbryio/lbcwallet/rpc/walletrpc" - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - - btcutil "github.com/lbryio/lbcutil" -) - -var certificateFile = filepath.Join(btcutil.AppDataDir("lbcwallet", false), "rpc.cert") - -func main() { - creds, err := credentials.NewClientTLSFromFile(certificateFile, "localhost") - if err != nil { - fmt.Println(err) - return - } - conn, err := grpc.Dial("localhost:19244", grpc.WithTransportCredentials(creds)) - if err != nil { - fmt.Println(err) - return - } - defer conn.Close() - c := pb.NewWalletServiceClient(conn) - - balanceRequest := &pb.BalanceRequest{ - AccountNumber: 0, - RequiredConfirmations: 1, - } - balanceResponse, err := c.Balance(context.Background(), balanceRequest) - if err != nil { - fmt.Println(err) - return - } - - fmt.Println("Spendable balance: ", btcutil.Amount(balanceResponse.Spendable)) -} -``` - - -## C++ - -**Note:** Protocol Buffers and gRPC require at least C++11. The example client -is written using C++14. - -**Note:** The following instructions assume the client is being written on a -Unix-like platform (with instructions using the `sh` shell and Unix-isms in the -example source code) with a source gRPC install in `/usr/local`. - -First, generate the C++ language bindings by compiling the `.proto`: - -```bash -$ protoc -I/path/to/lbcwallet/rpc --cpp_out=. --grpc_out=. \ - --plugin=protoc-gen-grpc=$(which grpc_cpp_plugin) \ - /path/to/lbcwallet/rpc/api.proto -``` - -Once the `.proto` file has been compiled, the example client can be completed. -Note that the following code uses synchronous calls which will block the main -thread on all gRPC IO. - -```C++ -// example.cc -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include "api.grpc.pb.h" - -using namespace std::string_literals; - -struct NoHomeDirectoryException : std::exception { - char const* what() const noexcept override { - return "Failed to lookup home directory"; - } -}; - -auto read_file(std::string const& file_path) -> std::string { - std::ifstream in{file_path}; - std::stringstream ss{}; - ss << in.rdbuf(); - return ss.str(); -} - -auto main() -> int { - // Before the gRPC native library (gRPC Core) is lazily loaded and - // initialized, an environment variable must be set so BoringSSL is - // configured to use ECDSA TLS certificates (required by lbcwallet). - setenv("GRPC_SSL_CIPHER_SUITES", "HIGH+ECDSA", 1); - - // Note: This path is operating system-dependent. This can be created - // portably using boost::filesystem or the experimental filesystem class - // expected to ship in C++17. - auto wallet_tls_cert_file = []{ - auto pw = getpwuid(getuid()); - if (pw == nullptr || pw->pw_dir == nullptr) { - throw NoHomeDirectoryException{}; - } - return pw->pw_dir + "/.lbcwallet/rpc.cert"s; - }(); - - grpc::SslCredentialsOptions cred_options{ - .pem_root_certs = read_file(wallet_tls_cert_file), - }; - auto creds = grpc::SslCredentials(cred_options); - auto channel = grpc::CreateChannel("localhost:19244", creds); - auto stub = walletrpc::WalletService::NewStub(channel); - - grpc::ClientContext context{}; - - walletrpc::BalanceRequest request{}; - request.set_account_number(0); - request.set_required_confirmations(1); - - walletrpc::BalanceResponse response{}; - auto status = stub->Balance(&context, request, &response); - if (!status.ok()) { - std::cout << status.error_message() << std::endl; - } else { - std::cout << "Spendable balance: " << response.spendable() << " Satoshis" << std::endl; - } -} -``` - -The example can then be built with the following commands: - -```bash -$ c++ -std=c++14 -I/usr/local/include -pthread -c -o api.pb.o api.pb.cc -$ c++ -std=c++14 -I/usr/local/include -pthread -c -o api.grpc.pb.o api.grpc.pb.cc -$ c++ -std=c++14 -I/usr/local/include -pthread -c -o example.o example.cc -$ c++ *.o -L/usr/local/lib -lgrpc++ -lgrpc -lgpr -lprotobuf -lpthread -ldl -o example -``` - - -## C# - -The quickest way of generating client bindings in a Windows .NET environment is -by using the protoc binary included in the gRPC NuGet package. From the NuGet -package manager PowerShell console, this can be performed with: - -``` -PM> Install-Package Grpc -``` - -The protoc and C# plugin binaries can then be found in the packages directory. -For example, `.\packages\Google.Protobuf.x.x.x\tools\protoc.exe` and -`.\packages\Grpc.Tools.x.x.x\tools\grpc_csharp_plugin.exe`. - -When writing a client on other platforms (e.g. Mono on OS X), or when doing a -full gRPC source install on Windows, protoc and the C# plugin must be installed -by other means. Consult the [official documentation](https://github.com/grpc/grpc/blob/master/src/csharp/README.md) -for these steps. - -Once protoc and the C# plugin have been obtained, client bindings can be -generated. The following command generates the files `Api.cs` and `ApiGrpc.cs` -in the `Example` project directory using the `Walletrpc` namespace: - -```PowerShell -PS> & protoc.exe -I \Path\To\lbcwallet\rpc --csharp_out=Example --grpc_out=Example ` - --plugin=protoc-gen-grpc=\Path\To\grpc_csharp_plugin.exe ` - \Path\To\lbcwallet\rpc\api.proto -``` - -Once references have been added to the project for the `Google.Protobuf` and -`Grpc.Core` assemblies, the example client can be implemented. - -```C# -using Grpc.Core; -using System; -using System.IO; -using System.Text; -using System.Threading.Tasks; -using Walletrpc; - -namespace Example -{ - static class Program - { - static void Main(string[] args) - { - ExampleAsync().Wait(); - } - - static async Task ExampleAsync() - { - // Before the gRPC native library (gRPC Core) is lazily loaded and initialized, - // an environment variable must be set so BoringSSL is configured to use ECDSA TLS - // certificates (required by lbcwallet). - Environment.SetEnvironmentVariable("GRPC_SSL_CIPHER_SUITES", "HIGH+ECDSA"); - - var walletAppData = Portability.LocalAppData(Environment.OSVersion.Platform, "lbcwallet"); - var walletTlsCertFile = Path.Combine(walletAppData, "rpc.cert"); - var cert = await FileUtils.ReadFileAsync(walletTlsCertFile); - var channel = new Channel("localhost:19244", new SslCredentials(cert)); - try - { - var c = WalletService.NewClient(channel); - var balanceRequest = new BalanceRequest - { - AccountNumber = 0, - RequiredConfirmations = 1, - }; - var balanceResponse = await c.BalanceAsync(balanceRequest); - Console.WriteLine($"Spendable balance: {balanceResponse.Spendable} Satoshis"); - } - finally - { - await channel.ShutdownAsync(); - } - } - } - - static class FileUtils - { - public static async Task ReadFileAsync(string filePath) - { - using (var r = new StreamReader(filePath, Encoding.UTF8)) - { - return await r.ReadToEndAsync(); - } - } - } - - static class Portability - { - public static string LocalAppData(PlatformID platform, string processName) - { - if (processName == null) - throw new ArgumentNullException(nameof(processName)); - if (processName.Length == 0) - throw new ArgumentException(nameof(processName) + " may not have zero length"); - - switch (platform) - { - case PlatformID.Win32NT: - return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), - ToUpper(processName)); - case PlatformID.MacOSX: - return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), - "Library", "Application Support", ToUpper(processName)); - case PlatformID.Unix: - return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), - ToDotLower(processName)); - default: - throw new PlatformNotSupportedException($"PlatformID={platform}"); - } - } - - private static string ToUpper(string value) - { - var firstChar = value[0]; - if (char.IsUpper(firstChar)) - return value; - else - return char.ToUpper(firstChar) + value.Substring(1); - } - - private static string ToDotLower(string value) - { - var firstChar = value[0]; - return "." + char.ToLower(firstChar) + value.Substring(1); - } - } -} -``` - -## Node.js - -First, install gRPC (either by building the latest source release, or -by installing a gRPC binary development package through your operating -system's package manager). This is required to install the npm module -as it wraps the native C library (gRPC Core) with C++ bindings. -Installing the [grpc module](https://www.npmjs.com/package/grpc) to -your project can then be done by executing: - -``` -npm install grpc -``` - -A Node.js client does not require generating JavaScript stub files for -the wallet's API from the `.proto`. Instead, a call to `grpc.load` -with the `.proto` file path dynamically loads the Protobuf descriptor -and generates bindings for each service. Either copy the `.proto` to -the client project directory, or reference the file from the -`lbcwallet` project directory. - -```JavaScript -// Before the gRPC native library (gRPC Core) is lazily loaded and -// initialized, an environment variable must be set so BoringSSL is -// configured to use ECDSA TLS certificates (required by lbcwallet). -process.env['GRPC_SSL_CIPHER_SUITES'] = 'HIGH+ECDSA'; - -var fs = require('fs'); -var path = require('path'); -var os = require('os'); -var grpc = require('grpc'); -var protoDescriptor = grpc.load('./api.proto'); -var walletrpc = protoDescriptor.walletrpc; - -var certPath = path.join(process.env.HOME, '.lbcwallet', 'rpc.cert'); -if (os.platform == 'win32') { - certPath = path.join(process.env.LOCALAPPDATA, 'lbcwallet', 'rpc.cert'); -} else if (os.platform == 'darwin') { - certPath = path.join(process.env.HOME, 'Library', 'Application Support', - 'lbcwallet', 'rpc.cert'); -} - -var cert = fs.readFileSync(certPath); -var creds = grpc.credentials.createSsl(cert); -var client = new walletrpc.WalletService('localhost:19244', creds); - -var request = { - account_number: 0, - required_confirmations: 1 -}; -client.balance(request, function(err, response) { - if (err) { - console.error(err); - } else { - console.log('Spendable balance:', response.spendable, 'Satoshis'); - } -}); -``` - -## Python - -**Note:** gRPC requires Python 2.7. - -After installing gRPC Core and Python development headers, `pip` -should be used to install the `grpc` module and its dependencies. -Full instructions for this procedure can be found -[here](https://github.com/grpc/grpc/blob/master/src/python/README.md). - -Generate Python stubs from the `.proto`: - -```bash -$ protoc -I /path/to/lbryio/lbcwallet/rpc --python_out=. --grpc_out=. \ - --plugin=protoc-gen-grpc=$(which grpc_python_plugin) \ - /path/to/lbcwallet/rpc/api.proto -``` - -Implement the client: - -```Python -import os -import platform -from grpc.beta import implementations - -import api_pb2 as walletrpc - -timeout = 1 # seconds - -def main(): - # Before the gRPC native library (gRPC Core) is lazily loaded and - # initialized, an environment variable must be set so BoringSSL is - # configured to use ECDSA TLS certificates (required by lbcwallet). - os.environ['GRPC_SSL_CIPHER_SUITES'] = 'HIGH+ECDSA' - - cert_file_path = os.path.join(os.environ['HOME'], '.lbcwallet', 'rpc.cert') - if platform.system() == 'Windows': - cert_file_path = os.path.join(os.environ['LOCALAPPDATA'], "lbcwallet", "rpc.cert") - elif platform.system() == 'Darwin': - cert_file_path = os.path.join(os.environ['HOME'], 'Library', 'Application Support', - 'lbcwallet', 'rpc.cert') - - with open(cert_file_path, 'r') as f: - cert = f.read() - creds = implementations.ssl_client_credentials(cert, None, None) - channel = implementations.secure_channel('localhost', 19244, creds) - stub = walletrpc.beta_create_WalletService_stub(channel) - - request = walletrpc.BalanceRequest(account_number = 0, required_confirmations = 1) - response = stub.Balance(request, timeout) - print 'Spendable balance: %d Satoshis' % response.spendable - -if __name__ == '__main__': - main() -``` diff --git a/rpc/documentation/serverchanges.md b/rpc/documentation/serverchanges.md deleted file mode 100644 index e77e843..0000000 --- a/rpc/documentation/serverchanges.md +++ /dev/null @@ -1,94 +0,0 @@ -# Making API Changes - -This document describes the process of how lbcwallet developers must make -changes to the RPC API and server. Due to the use of gRPC and Protocol Buffers -for the RPC implementation, changes to this API require extra dependencies and -steps before changes to the server can be implemented. - -## Requirements - -- The Protocol Buffer compiler `protoc` installed with support for the `proto3` - language - - The `protoc` tool is part of the Protocol Buffers project. This can be - installed [from source](https://github.com/google/protobuf/blob/master/INSTALL.txt), - from an [official binary release](https://github.com/google/protobuf/releases), - or through an operating system's package manager. - -- The gRPC `protoc` plugin for Go - - This plugin is written in Go and can be installed using `go get`: - - ``` - go get github.com/golang/protobuf/protoc-gen-go - ``` - -- Knowledge of Protocol Buffers version 3 (proto3) - -Note that a full installation of gRPC Core is not required, and only the -`protoc` compiler and Go plugins are necessary. This is due to the project -using a pure Go gRPC implementation instead of wrapping the C library from gRPC -Core. - -## Step 1: Modify the `.proto` - -Once the developer dependencies have been met, changes can be made to the API by -modifying the Protocol Buffers descriptor file [`api.proto`](../api.proto). - -The API is versioned according to the rules of [Semantic Versioning -2.0](http://semver.org/). After any changes, bump the API version in the [API -specification](./api.md) and add the changes to the spec. - -Unless backwards compatibility is broken (and the version is bumped to represent -this change), message fields must never be removed or changed, and new fields -must always be appended. - -It is forbidden to use the `required` attribute on a message field as this can -cause errors during parsing when the new API is used by an older client. -Instead, the (implicit) optional attribute is used, and the server -implementation must return an appropriate error if the new request field is not -set to a valid value. - -## Step 2: Compile the `.proto` - -Once changes to the descriptor file and API specification have been made, the -`protoc` compiler must be used to compile the descriptor into a Go package. -This code contains interfaces (stubs) for each service (to be implemented by the -wallet) and message types used for each RPC. This same code can also be -imported by a Go client that then calls same interface methods to perform RPC -with the wallet. - -By committing the autogenerated package to the project repo, the `proto3` -compiler and plugin are not needed by users installing the project by source or -by other developers not making changes to the RPC API. - -A `sh` shell script is included to compile the Protocol Buffers descriptor. It -must be run from the `rpc` directory. - -```bash -$ sh regen.sh -``` - -If a `sh` shell is unavailable, the command can be run manually instead (again -from the `rpc` directory). - -``` -protoc -I. api.proto --go_out=plugins=grpc:walletrpc -``` - -TODO(jrick): This step could be simplified and be more portable by putting the -commands in a Go source file and executing them with `go generate`. It should, -however, only be run when API changes are performed (not with `go generate -./...` in the project root) since not all developers are expected to have -`protoc` installed. - -## Step 3: Implement the API change in the RPC server - -After the Go code for the API has been regenated, the necessary changes can be -implemented in the [`rpcserver`](../rpcserver/) package. - -## Additional Resources - -- [Protocol Buffers Language Guide (proto3)](https://developers.google.com/protocol-buffers/docs/proto3) -- [Protocol Buffers Basics: Go](https://developers.google.com/protocol-buffers/docs/gotutorial) -- [gRPC Basics: Go](http://www.grpc.io/docs/tutorials/basic/go.html) diff --git a/rpc/regen.sh b/rpc/regen.sh deleted file mode 100644 index 79c6169..0000000 --- a/rpc/regen.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -protoc -I. api.proto --go_out=plugins=grpc:walletrpc diff --git a/rpc/rpcserver/log.go b/rpc/rpcserver/log.go deleted file mode 100644 index 36e3566..0000000 --- a/rpc/rpcserver/log.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2015-2016 The btcsuite developers -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -package rpcserver - -import ( - "os" - "strings" - - "google.golang.org/grpc/grpclog" - - "github.com/btcsuite/btclog" -) - -// UseLogger sets the logger to use for the gRPC server. -func UseLogger(l btclog.Logger) { - grpclog.SetLogger(logger{l}) // nolint:staticcheck -} - -// logger uses a btclog.Logger to implement the grpclog.Logger interface. -type logger struct { - btclog.Logger -} - -// stripGrpcPrefix removes the package prefix for all logs made to the grpc -// logger, since these are already included as the btclog subsystem name. -func stripGrpcPrefix(logstr string) string { - return strings.TrimPrefix(logstr, "grpc: ") -} - -// stripGrpcPrefixArgs removes the package prefix from the first argument, if it -// exists and is a string, returning the same arg slice after reassigning the -// first arg. -func stripGrpcPrefixArgs(args ...interface{}) []interface{} { - if len(args) == 0 { - return args - } - firstArgStr, ok := args[0].(string) - if ok { - args[0] = stripGrpcPrefix(firstArgStr) - } - return args -} - -func (l logger) Fatal(args ...interface{}) { - l.Critical(stripGrpcPrefixArgs(args)...) - os.Exit(1) -} - -func (l logger) Fatalf(format string, args ...interface{}) { - l.Criticalf(stripGrpcPrefix(format), args...) - os.Exit(1) -} - -func (l logger) Fatalln(args ...interface{}) { - l.Critical(stripGrpcPrefixArgs(args)...) - os.Exit(1) -} - -func (l logger) Print(args ...interface{}) { - l.Info(stripGrpcPrefixArgs(args)...) -} - -func (l logger) Printf(format string, args ...interface{}) { - l.Infof(stripGrpcPrefix(format), args...) -} - -func (l logger) Println(args ...interface{}) { - l.Info(stripGrpcPrefixArgs(args)...) -} diff --git a/rpc/rpcserver/server.go b/rpc/rpcserver/server.go deleted file mode 100644 index d63ec1c..0000000 --- a/rpc/rpcserver/server.go +++ /dev/null @@ -1,810 +0,0 @@ -// Copyright (c) 2015-2016 The btcsuite developers -// Use of this source code is governed by an ISC -// license that can be found in the LICENSE file. - -// Package rpcserver implements the RPC API and is used by the main package to -// start gRPC services. -// -// Full documentation of the API implemented by this package is maintained in a -// language-agnostic document: -// -// https://github.com/lbryio/lbcwallet/blob/master/rpc/documentation/api.md -// -// Any API changes must be performed according to the steps listed here: -// -// https://github.com/lbryio/lbcwallet/blob/master/rpc/documentation/serverchanges.md -package rpcserver - -import ( - "bytes" - "errors" - "sync" - "time" - - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/lbryio/lbcd/chaincfg/chainhash" - "github.com/lbryio/lbcd/rpcclient" - "github.com/lbryio/lbcd/txscript" - "github.com/lbryio/lbcd/wire" - btcutil "github.com/lbryio/lbcutil" - "github.com/lbryio/lbcutil/hdkeychain" - "github.com/lbryio/lbcwallet/chain" - "github.com/lbryio/lbcwallet/internal/cfgutil" - "github.com/lbryio/lbcwallet/internal/zero" - "github.com/lbryio/lbcwallet/netparams" - pb "github.com/lbryio/lbcwallet/rpc/walletrpc" - "github.com/lbryio/lbcwallet/waddrmgr" - "github.com/lbryio/lbcwallet/wallet" - "github.com/lbryio/lbcwallet/walletdb" -) - -// Public API version constants -const ( - semverString = "2.0.1" - semverMajor = 2 - semverMinor = 0 - semverPatch = 1 -) - -// translateError creates a new gRPC error with an appropriate error code for -// recognized errors. -// -// This function is by no means complete and should be expanded based on other -// known errors. Any RPC handler not returning a gRPC error (with grpc.Errorf) -// should return this result instead. -func translateError(err error) error { - code := errorCode(err) - return status.Errorf(code, "%s", err.Error()) -} - -func errorCode(err error) codes.Code { - // waddrmgr.IsError is convenient, but not granular enough when the - // underlying error has to be checked. Unwrap the underlying error - // if it exists. - if e, ok := err.(waddrmgr.ManagerError); ok { - // For these waddrmgr error codes, the underlying error isn't - // needed to determine the grpc error code. - switch e.ErrorCode { - case waddrmgr.ErrWrongPassphrase: // public and private - return codes.InvalidArgument - case waddrmgr.ErrAccountNotFound: - return codes.NotFound - case waddrmgr.ErrInvalidAccount: // reserved account - return codes.InvalidArgument - case waddrmgr.ErrDuplicateAccount: - return codes.AlreadyExists - } - - err = e.Err - } - - switch err { - case wallet.ErrLoaded: - return codes.FailedPrecondition - case walletdb.ErrDbNotOpen: - return codes.Aborted - case walletdb.ErrDbExists: - return codes.AlreadyExists - case walletdb.ErrDbDoesNotExist: - return codes.NotFound - case hdkeychain.ErrInvalidSeedLen: - return codes.InvalidArgument - default: - return codes.Unknown - } -} - -// versionServer provides RPC clients with the ability to query the RPC server -// version. -type versionServer struct { -} - -// walletServer provides wallet services for RPC clients. -type walletServer struct { - wallet *wallet.Wallet -} - -// loaderServer provides RPC clients with the ability to load and close wallets, -// as well as establishing a RPC connection to a consensus server. -type loaderServer struct { - loader *wallet.Loader - activeNet *netparams.Params - rpcClient *chain.RPCClient - mu sync.Mutex -} - -// StartVersionService creates an implementation of the VersionService and -// registers it with the gRPC server. -func StartVersionService(server *grpc.Server) { - pb.RegisterVersionServiceServer(server, &versionServer{}) -} - -func (*versionServer) Version(ctx context.Context, req *pb.VersionRequest) (*pb.VersionResponse, error) { - return &pb.VersionResponse{ - VersionString: semverString, - Major: semverMajor, - Minor: semverMinor, - Patch: semverPatch, - }, nil -} - -// StartWalletService creates an implementation of the WalletService and -// registers it with the gRPC server. -func StartWalletService(server *grpc.Server, wallet *wallet.Wallet) { - service := &walletServer{wallet} - pb.RegisterWalletServiceServer(server, service) -} - -func (s *walletServer) Ping(ctx context.Context, req *pb.PingRequest) (*pb.PingResponse, error) { - return &pb.PingResponse{}, nil -} - -func (s *walletServer) Network(ctx context.Context, req *pb.NetworkRequest) ( - *pb.NetworkResponse, error) { - - return &pb.NetworkResponse{ActiveNetwork: uint32(s.wallet.ChainParams().Net)}, nil -} - -func (s *walletServer) AccountNumber(ctx context.Context, req *pb.AccountNumberRequest) ( - *pb.AccountNumberResponse, error) { - - accountNum, err := s.wallet.AccountNumber(waddrmgr.KeyScopeBIP0044, req.AccountName) - if err != nil { - return nil, translateError(err) - } - - return &pb.AccountNumberResponse{AccountNumber: accountNum}, nil -} - -func (s *walletServer) Accounts(ctx context.Context, req *pb.AccountsRequest) ( - *pb.AccountsResponse, error) { - - resp, err := s.wallet.Accounts(waddrmgr.KeyScopeBIP0044) - if err != nil { - return nil, translateError(err) - } - accounts := make([]*pb.AccountsResponse_Account, len(resp.Accounts)) - for i := range resp.Accounts { - a := &resp.Accounts[i] - accounts[i] = &pb.AccountsResponse_Account{ - AccountNumber: a.AccountNumber, - AccountName: a.AccountName, - TotalBalance: int64(a.TotalBalance), - ExternalKeyCount: a.ExternalKeyCount, - InternalKeyCount: a.InternalKeyCount, - ImportedKeyCount: a.ImportedKeyCount, - } - } - return &pb.AccountsResponse{ - Accounts: accounts, - CurrentBlockHash: resp.CurrentBlockHash[:], - CurrentBlockHeight: resp.CurrentBlockHeight, - }, nil -} - -func (s *walletServer) RenameAccount(ctx context.Context, req *pb.RenameAccountRequest) ( - *pb.RenameAccountResponse, error) { - - err := s.wallet.RenameAccount(waddrmgr.KeyScopeBIP0044, req.AccountNumber, req.NewName) - if err != nil { - return nil, translateError(err) - } - - return &pb.RenameAccountResponse{}, nil -} - -func (s *walletServer) NextAccount(ctx context.Context, req *pb.NextAccountRequest) ( - *pb.NextAccountResponse, error) { - - defer zero.Bytes(req.Passphrase) - - if req.AccountName == "" { - return nil, status.Errorf(codes.InvalidArgument, "account name may not be empty") - } - - lock := make(chan time.Time, 1) - defer func() { - lock <- time.Time{} // send matters, not the value - }() - err := s.wallet.Unlock(req.Passphrase, lock) - if err != nil { - return nil, translateError(err) - } - - account, err := s.wallet.NextAccount(waddrmgr.KeyScopeBIP0044, req.AccountName) - if err != nil { - return nil, translateError(err) - } - - return &pb.NextAccountResponse{AccountNumber: account}, nil -} - -func (s *walletServer) NextAddress(ctx context.Context, req *pb.NextAddressRequest) ( - *pb.NextAddressResponse, error) { - - var ( - addr btcutil.Address - err error - ) - switch req.Kind { - case pb.NextAddressRequest_BIP0044_EXTERNAL: - addr, err = s.wallet.NewAddress(req.Account, waddrmgr.KeyScopeBIP0044) - case pb.NextAddressRequest_BIP0044_INTERNAL: - addr, err = s.wallet.NewChangeAddress(req.Account, waddrmgr.KeyScopeBIP0044) - default: - return nil, status.Errorf(codes.InvalidArgument, "kind=%v", req.Kind) - } - if err != nil { - return nil, translateError(err) - } - - return &pb.NextAddressResponse{Address: addr.EncodeAddress()}, nil -} - -func (s *walletServer) ImportPrivateKey(ctx context.Context, req *pb.ImportPrivateKeyRequest) ( - *pb.ImportPrivateKeyResponse, error) { - - defer zero.Bytes(req.Passphrase) - - wif, err := btcutil.DecodeWIF(req.PrivateKeyWif) - if err != nil { - return nil, status.Errorf(codes.InvalidArgument, - "Invalid WIF-encoded private key: %v", err) - } - - lock := make(chan time.Time, 1) - defer func() { - lock <- time.Time{} // send matters, not the value - }() - err = s.wallet.Unlock(req.Passphrase, lock) - if err != nil { - return nil, translateError(err) - } - - // At the moment, only the special-cased import account can be used to - // import keys. - if req.Account != waddrmgr.ImportedAddrAccount { - return nil, status.Errorf(codes.InvalidArgument, - "Only the imported account accepts private key imports") - } - - _, err = s.wallet.ImportPrivateKey(waddrmgr.KeyScopeBIP0044, wif, nil, req.Rescan) - if err != nil { - return nil, translateError(err) - } - - return &pb.ImportPrivateKeyResponse{}, nil -} - -func (s *walletServer) Balance(ctx context.Context, req *pb.BalanceRequest) ( - *pb.BalanceResponse, error) { - - account := req.AccountNumber - reqConfs := req.RequiredConfirmations - bals, err := s.wallet.CalculateAccountBalances(account, reqConfs) - if err != nil { - return nil, translateError(err) - } - - // TODO: Spendable currently includes multisig outputs that may not - // actually be spendable without additional keys. - resp := &pb.BalanceResponse{ - Total: int64(bals.Total), - Spendable: int64(bals.Spendable), - ImmatureReward: int64(bals.ImmatureReward), - } - return resp, nil -} - -func (s *walletServer) FundTransaction(ctx context.Context, req *pb.FundTransactionRequest) ( - *pb.FundTransactionResponse, error) { - - policy := wallet.OutputSelectionPolicy{ - Account: req.Account, - RequiredConfirmations: req.RequiredConfirmations, - IncludeStakes: req.IncludeStakes, - } - unspentOutputs, err := s.wallet.UnspentOutputs(policy) - if err != nil { - return nil, translateError(err) - } - - selectedOutputs := make([]*pb.FundTransactionResponse_PreviousOutput, 0, len(unspentOutputs)) - var totalAmount btcutil.Amount - for _, output := range unspentOutputs { - selectedOutputs = append(selectedOutputs, &pb.FundTransactionResponse_PreviousOutput{ - TransactionHash: output.OutPoint.Hash[:], - OutputIndex: output.OutPoint.Index, - Amount: output.Output.Value, - PkScript: output.Output.PkScript, - ReceiveTime: output.ReceiveTime.Unix(), - FromCoinbase: output.OutputKind == wallet.OutputKindCoinbase, - }) - totalAmount += btcutil.Amount(output.Output.Value) - - if req.TargetAmount != 0 && totalAmount > btcutil.Amount(req.TargetAmount) { - break - } - } - - var changeScript []byte - if req.IncludeChangeScript && totalAmount > btcutil.Amount(req.TargetAmount) { - changeAddr, err := s.wallet.NewChangeAddress(req.Account, waddrmgr.KeyScopeBIP0044) - if err != nil { - return nil, translateError(err) - } - changeScript, err = txscript.PayToAddrScript(changeAddr) - if err != nil { - return nil, translateError(err) - } - } - - return &pb.FundTransactionResponse{ - SelectedOutputs: selectedOutputs, - TotalAmount: int64(totalAmount), - ChangePkScript: changeScript, - }, nil -} - -func marshalGetTransactionsResult(wresp *wallet.GetTransactionsResult) ( - *pb.GetTransactionsResponse, error) { - - resp := &pb.GetTransactionsResponse{ - MinedTransactions: marshalBlocks(wresp.MinedTransactions), - UnminedTransactions: marshalTransactionDetails(wresp.UnminedTransactions), - } - return resp, nil -} - -// BUGS: -// - MinimumRecentTransactions is ignored. -// - Wrong error codes when a block height or hash is not recognized -func (s *walletServer) GetTransactions(ctx context.Context, req *pb.GetTransactionsRequest) ( - resp *pb.GetTransactionsResponse, err error) { - - var startBlock, endBlock *wallet.BlockIdentifier - if req.StartingBlockHash != nil && req.StartingBlockHeight != 0 { // nolint:gocritic - return nil, errors.New( - "starting block hash and height may not be specified simultaneously") - } else if req.StartingBlockHash != nil { - startBlockHash, err := chainhash.NewHash(req.StartingBlockHash) - if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error()) - } - startBlock = wallet.NewBlockIdentifierFromHash(startBlockHash) - } else if req.StartingBlockHeight != 0 { - startBlock = wallet.NewBlockIdentifierFromHeight(req.StartingBlockHeight) - } - - if req.EndingBlockHash != nil && req.EndingBlockHeight != 0 { // nolint:gocritic - return nil, status.Errorf(codes.InvalidArgument, - "ending block hash and height may not be specified simultaneously") - } else if req.EndingBlockHash != nil { - endBlockHash, err := chainhash.NewHash(req.EndingBlockHash) - if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error()) - } - endBlock = wallet.NewBlockIdentifierFromHash(endBlockHash) - } else if req.EndingBlockHeight != 0 { - endBlock = wallet.NewBlockIdentifierFromHeight(req.EndingBlockHeight) - } - - var minRecentTxs int - if req.MinimumRecentTransactions != 0 { - if endBlock != nil { - return nil, status.Errorf(codes.InvalidArgument, - "ending block and minimum number of recent transactions "+ - "may not be specified simultaneously") - } - minRecentTxs = int(req.MinimumRecentTransactions) - if minRecentTxs < 0 { - return nil, status.Errorf(codes.InvalidArgument, - "minimum number of recent transactions may not be negative") - } - } - - _ = minRecentTxs - - gtr, err := s.wallet.GetTransactions(startBlock, endBlock, "", ctx.Done()) - if err != nil { - return nil, translateError(err) - } - return marshalGetTransactionsResult(gtr) -} - -func (s *walletServer) ChangePassphrase(ctx context.Context, req *pb.ChangePassphraseRequest) ( - *pb.ChangePassphraseResponse, error) { - - defer func() { - zero.Bytes(req.OldPassphrase) - zero.Bytes(req.NewPassphrase) - }() - - var err error - switch req.Key { - case pb.ChangePassphraseRequest_PRIVATE: - err = s.wallet.ChangePrivatePassphrase(req.OldPassphrase, req.NewPassphrase) - case pb.ChangePassphraseRequest_PUBLIC: - err = s.wallet.ChangePublicPassphrase(req.OldPassphrase, req.NewPassphrase) - default: - return nil, status.Errorf(codes.InvalidArgument, "Unknown key type (%d)", req.Key) - } - if err != nil { - return nil, translateError(err) - } - return &pb.ChangePassphraseResponse{}, nil -} - -// BUGS: -// - InputIndexes request field is ignored. -func (s *walletServer) SignTransaction(ctx context.Context, req *pb.SignTransactionRequest) ( - *pb.SignTransactionResponse, error) { - - defer zero.Bytes(req.Passphrase) - - var tx wire.MsgTx - err := tx.Deserialize(bytes.NewReader(req.SerializedTransaction)) - if err != nil { - return nil, status.Errorf(codes.InvalidArgument, - "Bytes do not represent a valid raw transaction: %v", err) - } - - lock := make(chan time.Time, 1) - defer func() { - lock <- time.Time{} // send matters, not the value - }() - err = s.wallet.Unlock(req.Passphrase, lock) - if err != nil { - return nil, translateError(err) - } - - invalidSigs, err := s.wallet.SignTransaction(&tx, txscript.SigHashAll, nil, nil, nil) - if err != nil { - return nil, translateError(err) - } - - invalidInputIndexes := make([]uint32, len(invalidSigs)) - for i, e := range invalidSigs { - invalidInputIndexes[i] = e.InputIndex - } - - var serializedTransaction bytes.Buffer - serializedTransaction.Grow(tx.SerializeSize()) - err = tx.Serialize(&serializedTransaction) - if err != nil { - return nil, translateError(err) - } - - resp := &pb.SignTransactionResponse{ - Transaction: serializedTransaction.Bytes(), - UnsignedInputIndexes: invalidInputIndexes, - } - return resp, nil -} - -// BUGS: -// - The transaction is not inspected to be relevant before publishing using -// sendrawtransaction, so connection errors to could result in the tx -// never being added to the wallet database. -// - Once the above bug is fixed, wallet will require a way to purge invalid -// transactions from the database when they are rejected by the network, other -// than double spending them. -func (s *walletServer) PublishTransaction(ctx context.Context, req *pb.PublishTransactionRequest) ( - *pb.PublishTransactionResponse, error) { - - var msgTx wire.MsgTx - err := msgTx.Deserialize(bytes.NewReader(req.SignedTransaction)) - if err != nil { - return nil, status.Errorf(codes.InvalidArgument, - "Bytes do not represent a valid raw transaction: %v", err) - } - - err = s.wallet.PublishTransaction(&msgTx, "") - if err != nil { - return nil, translateError(err) - } - - return &pb.PublishTransactionResponse{}, nil -} - -func marshalTransactionInputs(v []wallet.TransactionSummaryInput) []*pb.TransactionDetails_Input { - inputs := make([]*pb.TransactionDetails_Input, len(v)) - for i := range v { - input := &v[i] - inputs[i] = &pb.TransactionDetails_Input{ - Index: input.Index, - PreviousAccount: input.PreviousAccount, - PreviousAmount: int64(input.PreviousAmount), - } - } - return inputs -} - -func marshalTransactionOutputs(v []wallet.TransactionSummaryOutput) []*pb.TransactionDetails_Output { - outputs := make([]*pb.TransactionDetails_Output, len(v)) - for i := range v { - output := &v[i] - outputs[i] = &pb.TransactionDetails_Output{ - Index: output.Index, - Account: output.Account, - Internal: output.Internal, - } - } - return outputs -} - -func marshalTransactionDetails(v []wallet.TransactionSummary) []*pb.TransactionDetails { - txs := make([]*pb.TransactionDetails, len(v)) - for i := range v { - tx := &v[i] - txs[i] = &pb.TransactionDetails{ - Hash: tx.Hash[:], - Transaction: tx.Transaction, - Debits: marshalTransactionInputs(tx.MyInputs), - Credits: marshalTransactionOutputs(tx.MyOutputs), - Fee: int64(tx.Fee), - Timestamp: tx.Timestamp, - } - } - return txs -} - -func marshalBlocks(v []wallet.Block) []*pb.BlockDetails { - blocks := make([]*pb.BlockDetails, len(v)) - for i := range v { - block := &v[i] - blocks[i] = &pb.BlockDetails{ - Hash: block.Hash[:], - Height: block.Height, - Timestamp: block.Timestamp, - Transactions: marshalTransactionDetails(block.Transactions), - } - } - return blocks -} - -func marshalHashes(v []*chainhash.Hash) [][]byte { - hashes := make([][]byte, len(v)) - for i, hash := range v { - hashes[i] = hash[:] - } - return hashes -} - -func (s *walletServer) TransactionNotifications(req *pb.TransactionNotificationsRequest, - svr pb.WalletService_TransactionNotificationsServer) error { - - n := s.wallet.NtfnServer.TransactionNotifications() - defer n.Done() - - ctxDone := svr.Context().Done() - for { - select { - case v := <-n.C: - resp := pb.TransactionNotificationsResponse{ - AttachedBlocks: marshalBlocks(v.AttachedBlocks), - DetachedBlocks: marshalHashes(v.DetachedBlocks), - UnminedTransactions: marshalTransactionDetails(v.UnminedTransactions), - UnminedTransactionHashes: marshalHashes(v.UnminedTransactionHashes), - } - err := svr.Send(&resp) - if err != nil { - return translateError(err) - } - - case <-ctxDone: - return nil - } - } -} - -func (s *walletServer) SpentnessNotifications(req *pb.SpentnessNotificationsRequest, - svr pb.WalletService_SpentnessNotificationsServer) error { - - if req.NoNotifyUnspent && req.NoNotifySpent { - return status.Errorf(codes.InvalidArgument, - "no_notify_unspent and no_notify_spent may not both be true") - } - - n := s.wallet.NtfnServer.AccountSpentnessNotifications(req.Account) - defer n.Done() - - ctxDone := svr.Context().Done() - for { - select { - case v := <-n.C: - spenderHash, spenderIndex, spent := v.Spender() - if (spent && req.NoNotifySpent) || (!spent && req.NoNotifyUnspent) { - continue - } - index := v.Index() - resp := pb.SpentnessNotificationsResponse{ - TransactionHash: v.Hash()[:], - OutputIndex: index, - } - if spent { - resp.Spender = &pb.SpentnessNotificationsResponse_Spender{ - TransactionHash: spenderHash[:], - InputIndex: spenderIndex, - } - } - err := svr.Send(&resp) - if err != nil { - return translateError(err) - } - - case <-ctxDone: - return nil - } - } -} - -func (s *walletServer) AccountNotifications(req *pb.AccountNotificationsRequest, - svr pb.WalletService_AccountNotificationsServer) error { - - n := s.wallet.NtfnServer.AccountNotifications() - defer n.Done() - - ctxDone := svr.Context().Done() - for { - select { - case v := <-n.C: - resp := pb.AccountNotificationsResponse{ - AccountNumber: v.AccountNumber, - AccountName: v.AccountName, - ExternalKeyCount: v.ExternalKeyCount, - InternalKeyCount: v.InternalKeyCount, - ImportedKeyCount: v.ImportedKeyCount, - } - err := svr.Send(&resp) - if err != nil { - return translateError(err) - } - - case <-ctxDone: - return nil - } - } -} - -// StartWalletLoaderService creates an implementation of the WalletLoaderService -// and registers it with the gRPC server. -func StartWalletLoaderService(server *grpc.Server, loader *wallet.Loader, - activeNet *netparams.Params) { - - service := &loaderServer{loader: loader, activeNet: activeNet} - pb.RegisterWalletLoaderServiceServer(server, service) -} - -func (s *loaderServer) CreateWallet(ctx context.Context, req *pb.CreateWalletRequest) ( - *pb.CreateWalletResponse, error) { - - defer func() { - zero.Bytes(req.PrivatePassphrase) - zero.Bytes(req.Seed) - }() - - // Use an insecure public passphrase when the request's is empty. - pubPassphrase := req.PublicPassphrase - if len(pubPassphrase) == 0 { - pubPassphrase = []byte(wallet.InsecurePubPassphrase) - } - - wallet, err := s.loader.CreateNewWallet( - pubPassphrase, req.PrivatePassphrase, req.Seed, time.Now(), - ) - if err != nil { - return nil, translateError(err) - } - - s.mu.Lock() - if s.rpcClient != nil { - wallet.SynchronizeRPC(s.rpcClient) - } - s.mu.Unlock() - - return &pb.CreateWalletResponse{}, nil -} - -func (s *loaderServer) OpenWallet(ctx context.Context, req *pb.OpenWalletRequest) ( - *pb.OpenWalletResponse, error) { - - // Use an insecure public passphrase when the request's is empty. - pubPassphrase := req.PublicPassphrase - if len(pubPassphrase) == 0 { - pubPassphrase = []byte(wallet.InsecurePubPassphrase) - } - - wallet, err := s.loader.OpenExistingWallet(pubPassphrase, false) - if err != nil { - return nil, translateError(err) - } - - s.mu.Lock() - if s.rpcClient != nil { - wallet.SynchronizeRPC(s.rpcClient) - } - s.mu.Unlock() - - return &pb.OpenWalletResponse{}, nil -} - -func (s *loaderServer) WalletExists(ctx context.Context, req *pb.WalletExistsRequest) ( - *pb.WalletExistsResponse, error) { - - exists, err := s.loader.WalletExists() - if err != nil { - return nil, translateError(err) - } - return &pb.WalletExistsResponse{Exists: exists}, nil -} - -func (s *loaderServer) CloseWallet(ctx context.Context, req *pb.CloseWalletRequest) ( - *pb.CloseWalletResponse, error) { - - err := s.loader.UnloadWallet() - if err == wallet.ErrNotLoaded { - return nil, status.Errorf(codes.FailedPrecondition, "wallet is not loaded") - } - if err != nil { - return nil, translateError(err) - } - - return &pb.CloseWalletResponse{}, nil -} - -func (s *loaderServer) StartConsensusRpc(ctx context.Context, // nolint:golint - req *pb.StartConsensusRpcRequest) (*pb.StartConsensusRpcResponse, - error) { - - defer zero.Bytes(req.Password) - - defer s.mu.Unlock() - s.mu.Lock() - - if s.rpcClient != nil { - return nil, status.Errorf(codes.FailedPrecondition, "RPC client already created") - } - - networkAddress, err := cfgutil.NormalizeAddress(req.NetworkAddress, - s.activeNet.RPCClientPort) - if err != nil { - return nil, status.Errorf(codes.InvalidArgument, - "Network address is ill-formed: %v", err) - } - - // Error if the wallet is already syncing with the network. - wallet, walletLoaded := s.loader.LoadedWallet() - if walletLoaded && wallet.SynchronizingToNetwork() { - return nil, status.Errorf(codes.FailedPrecondition, - "wallet is loaded and already synchronizing") - } - - rpcClient, err := chain.NewRPCClient(s.activeNet.Params, networkAddress, req.Username, - string(req.Password), req.Certificate, len(req.Certificate) == 0, req.SkipVerify, 1) - if err != nil { - return nil, translateError(err) - } - - err = rpcClient.Start() - if err != nil { - if err == rpcclient.ErrInvalidAuth { - return nil, status.Errorf(codes.InvalidArgument, - "Invalid RPC credentials: %v", err) - } - return nil, status.Errorf(codes.NotFound, - "Connection to RPC server failed: %v", err) - } - - s.rpcClient = rpcClient - - if walletLoaded { - wallet.SynchronizeRPC(rpcClient) - } - - return &pb.StartConsensusRpcResponse{}, nil -} diff --git a/rpc/walletrpc/api.pb.go b/rpc/walletrpc/api.pb.go deleted file mode 100644 index b0f57bf..0000000 --- a/rpc/walletrpc/api.pb.go +++ /dev/null @@ -1,2645 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: api.proto - -/* -Package walletrpc is a generated protocol buffer package. - -It is generated from these files: - - api.proto - -It has these top-level messages: - - VersionRequest - VersionResponse - TransactionDetails - BlockDetails - AccountBalance - PingRequest - PingResponse - NetworkRequest - NetworkResponse - AccountNumberRequest - AccountNumberResponse - AccountsRequest - AccountsResponse - RenameAccountRequest - RenameAccountResponse - NextAccountRequest - NextAccountResponse - NextAddressRequest - NextAddressResponse - ImportPrivateKeyRequest - ImportPrivateKeyResponse - BalanceRequest - BalanceResponse - GetTransactionsRequest - GetTransactionsResponse - ChangePassphraseRequest - ChangePassphraseResponse - FundTransactionRequest - FundTransactionResponse - SignTransactionRequest - SignTransactionResponse - PublishTransactionRequest - PublishTransactionResponse - TransactionNotificationsRequest - TransactionNotificationsResponse - SpentnessNotificationsRequest - SpentnessNotificationsResponse - AccountNotificationsRequest - AccountNotificationsResponse - CreateWalletRequest - CreateWalletResponse - OpenWalletRequest - OpenWalletResponse - CloseWalletRequest - CloseWalletResponse - WalletExistsRequest - WalletExistsResponse - StartConsensusRpcRequest - StartConsensusRpcResponse -*/ -package walletrpc - -import ( - fmt "fmt" - - proto "github.com/golang/protobuf/proto" - - math "math" - - context "golang.org/x/net/context" - - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type NextAddressRequest_Kind int32 - -const ( - NextAddressRequest_BIP0044_EXTERNAL NextAddressRequest_Kind = 0 - NextAddressRequest_BIP0044_INTERNAL NextAddressRequest_Kind = 1 -) - -var NextAddressRequest_Kind_name = map[int32]string{ - 0: "BIP0044_EXTERNAL", - 1: "BIP0044_INTERNAL", -} -var NextAddressRequest_Kind_value = map[string]int32{ - "BIP0044_EXTERNAL": 0, - "BIP0044_INTERNAL": 1, -} - -func (x NextAddressRequest_Kind) String() string { - return proto.EnumName(NextAddressRequest_Kind_name, int32(x)) -} -func (NextAddressRequest_Kind) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{17, 0} } - -type ChangePassphraseRequest_Key int32 - -const ( - ChangePassphraseRequest_PRIVATE ChangePassphraseRequest_Key = 0 - ChangePassphraseRequest_PUBLIC ChangePassphraseRequest_Key = 1 -) - -var ChangePassphraseRequest_Key_name = map[int32]string{ - 0: "PRIVATE", - 1: "PUBLIC", -} -var ChangePassphraseRequest_Key_value = map[string]int32{ - "PRIVATE": 0, - "PUBLIC": 1, -} - -func (x ChangePassphraseRequest_Key) String() string { - return proto.EnumName(ChangePassphraseRequest_Key_name, int32(x)) -} -func (ChangePassphraseRequest_Key) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{25, 0} -} - -type VersionRequest struct { -} - -func (m *VersionRequest) Reset() { *m = VersionRequest{} } -func (m *VersionRequest) String() string { return proto.CompactTextString(m) } -func (*VersionRequest) ProtoMessage() {} -func (*VersionRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -type VersionResponse struct { - VersionString string `protobuf:"bytes,1,opt,name=version_string,json=versionString" json:"version_string,omitempty"` - Major uint32 `protobuf:"varint,2,opt,name=major" json:"major,omitempty"` - Minor uint32 `protobuf:"varint,3,opt,name=minor" json:"minor,omitempty"` - Patch uint32 `protobuf:"varint,4,opt,name=patch" json:"patch,omitempty"` - Prerelease string `protobuf:"bytes,5,opt,name=prerelease" json:"prerelease,omitempty"` - BuildMetadata string `protobuf:"bytes,6,opt,name=build_metadata,json=buildMetadata" json:"build_metadata,omitempty"` -} - -func (m *VersionResponse) Reset() { *m = VersionResponse{} } -func (m *VersionResponse) String() string { return proto.CompactTextString(m) } -func (*VersionResponse) ProtoMessage() {} -func (*VersionResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *VersionResponse) GetVersionString() string { - if m != nil { - return m.VersionString - } - return "" -} - -func (m *VersionResponse) GetMajor() uint32 { - if m != nil { - return m.Major - } - return 0 -} - -func (m *VersionResponse) GetMinor() uint32 { - if m != nil { - return m.Minor - } - return 0 -} - -func (m *VersionResponse) GetPatch() uint32 { - if m != nil { - return m.Patch - } - return 0 -} - -func (m *VersionResponse) GetPrerelease() string { - if m != nil { - return m.Prerelease - } - return "" -} - -func (m *VersionResponse) GetBuildMetadata() string { - if m != nil { - return m.BuildMetadata - } - return "" -} - -type TransactionDetails struct { - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - Transaction []byte `protobuf:"bytes,2,opt,name=transaction,proto3" json:"transaction,omitempty"` - Debits []*TransactionDetails_Input `protobuf:"bytes,3,rep,name=debits" json:"debits,omitempty"` - Credits []*TransactionDetails_Output `protobuf:"bytes,4,rep,name=credits" json:"credits,omitempty"` - Fee int64 `protobuf:"varint,5,opt,name=fee" json:"fee,omitempty"` - Timestamp int64 `protobuf:"varint,6,opt,name=timestamp" json:"timestamp,omitempty"` -} - -func (m *TransactionDetails) Reset() { *m = TransactionDetails{} } -func (m *TransactionDetails) String() string { return proto.CompactTextString(m) } -func (*TransactionDetails) ProtoMessage() {} -func (*TransactionDetails) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -func (m *TransactionDetails) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - -func (m *TransactionDetails) GetTransaction() []byte { - if m != nil { - return m.Transaction - } - return nil -} - -func (m *TransactionDetails) GetDebits() []*TransactionDetails_Input { - if m != nil { - return m.Debits - } - return nil -} - -func (m *TransactionDetails) GetCredits() []*TransactionDetails_Output { - if m != nil { - return m.Credits - } - return nil -} - -func (m *TransactionDetails) GetFee() int64 { - if m != nil { - return m.Fee - } - return 0 -} - -func (m *TransactionDetails) GetTimestamp() int64 { - if m != nil { - return m.Timestamp - } - return 0 -} - -type TransactionDetails_Input struct { - Index uint32 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"` - PreviousAccount uint32 `protobuf:"varint,2,opt,name=previous_account,json=previousAccount" json:"previous_account,omitempty"` - PreviousAmount int64 `protobuf:"varint,3,opt,name=previous_amount,json=previousAmount" json:"previous_amount,omitempty"` -} - -func (m *TransactionDetails_Input) Reset() { *m = TransactionDetails_Input{} } -func (m *TransactionDetails_Input) String() string { return proto.CompactTextString(m) } -func (*TransactionDetails_Input) ProtoMessage() {} -func (*TransactionDetails_Input) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } - -func (m *TransactionDetails_Input) GetIndex() uint32 { - if m != nil { - return m.Index - } - return 0 -} - -func (m *TransactionDetails_Input) GetPreviousAccount() uint32 { - if m != nil { - return m.PreviousAccount - } - return 0 -} - -func (m *TransactionDetails_Input) GetPreviousAmount() int64 { - if m != nil { - return m.PreviousAmount - } - return 0 -} - -type TransactionDetails_Output struct { - Index uint32 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"` - Account uint32 `protobuf:"varint,2,opt,name=account" json:"account,omitempty"` - Internal bool `protobuf:"varint,3,opt,name=internal" json:"internal,omitempty"` -} - -func (m *TransactionDetails_Output) Reset() { *m = TransactionDetails_Output{} } -func (m *TransactionDetails_Output) String() string { return proto.CompactTextString(m) } -func (*TransactionDetails_Output) ProtoMessage() {} -func (*TransactionDetails_Output) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 1} } - -func (m *TransactionDetails_Output) GetIndex() uint32 { - if m != nil { - return m.Index - } - return 0 -} - -func (m *TransactionDetails_Output) GetAccount() uint32 { - if m != nil { - return m.Account - } - return 0 -} - -func (m *TransactionDetails_Output) GetInternal() bool { - if m != nil { - return m.Internal - } - return false -} - -type BlockDetails struct { - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - Height int32 `protobuf:"varint,2,opt,name=height" json:"height,omitempty"` - Timestamp int64 `protobuf:"varint,3,opt,name=timestamp" json:"timestamp,omitempty"` - Transactions []*TransactionDetails `protobuf:"bytes,4,rep,name=transactions" json:"transactions,omitempty"` -} - -func (m *BlockDetails) Reset() { *m = BlockDetails{} } -func (m *BlockDetails) String() string { return proto.CompactTextString(m) } -func (*BlockDetails) ProtoMessage() {} -func (*BlockDetails) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -func (m *BlockDetails) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - -func (m *BlockDetails) GetHeight() int32 { - if m != nil { - return m.Height - } - return 0 -} - -func (m *BlockDetails) GetTimestamp() int64 { - if m != nil { - return m.Timestamp - } - return 0 -} - -func (m *BlockDetails) GetTransactions() []*TransactionDetails { - if m != nil { - return m.Transactions - } - return nil -} - -type AccountBalance struct { - Account uint32 `protobuf:"varint,1,opt,name=account" json:"account,omitempty"` - TotalBalance int64 `protobuf:"varint,2,opt,name=total_balance,json=totalBalance" json:"total_balance,omitempty"` -} - -func (m *AccountBalance) Reset() { *m = AccountBalance{} } -func (m *AccountBalance) String() string { return proto.CompactTextString(m) } -func (*AccountBalance) ProtoMessage() {} -func (*AccountBalance) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *AccountBalance) GetAccount() uint32 { - if m != nil { - return m.Account - } - return 0 -} - -func (m *AccountBalance) GetTotalBalance() int64 { - if m != nil { - return m.TotalBalance - } - return 0 -} - -type PingRequest struct { -} - -func (m *PingRequest) Reset() { *m = PingRequest{} } -func (m *PingRequest) String() string { return proto.CompactTextString(m) } -func (*PingRequest) ProtoMessage() {} -func (*PingRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -type PingResponse struct { -} - -func (m *PingResponse) Reset() { *m = PingResponse{} } -func (m *PingResponse) String() string { return proto.CompactTextString(m) } -func (*PingResponse) ProtoMessage() {} -func (*PingResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } - -type NetworkRequest struct { -} - -func (m *NetworkRequest) Reset() { *m = NetworkRequest{} } -func (m *NetworkRequest) String() string { return proto.CompactTextString(m) } -func (*NetworkRequest) ProtoMessage() {} -func (*NetworkRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } - -type NetworkResponse struct { - ActiveNetwork uint32 `protobuf:"varint,1,opt,name=active_network,json=activeNetwork" json:"active_network,omitempty"` -} - -func (m *NetworkResponse) Reset() { *m = NetworkResponse{} } -func (m *NetworkResponse) String() string { return proto.CompactTextString(m) } -func (*NetworkResponse) ProtoMessage() {} -func (*NetworkResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } - -func (m *NetworkResponse) GetActiveNetwork() uint32 { - if m != nil { - return m.ActiveNetwork - } - return 0 -} - -type AccountNumberRequest struct { - AccountName string `protobuf:"bytes,1,opt,name=account_name,json=accountName" json:"account_name,omitempty"` -} - -func (m *AccountNumberRequest) Reset() { *m = AccountNumberRequest{} } -func (m *AccountNumberRequest) String() string { return proto.CompactTextString(m) } -func (*AccountNumberRequest) ProtoMessage() {} -func (*AccountNumberRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } - -func (m *AccountNumberRequest) GetAccountName() string { - if m != nil { - return m.AccountName - } - return "" -} - -type AccountNumberResponse struct { - AccountNumber uint32 `protobuf:"varint,1,opt,name=account_number,json=accountNumber" json:"account_number,omitempty"` -} - -func (m *AccountNumberResponse) Reset() { *m = AccountNumberResponse{} } -func (m *AccountNumberResponse) String() string { return proto.CompactTextString(m) } -func (*AccountNumberResponse) ProtoMessage() {} -func (*AccountNumberResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } - -func (m *AccountNumberResponse) GetAccountNumber() uint32 { - if m != nil { - return m.AccountNumber - } - return 0 -} - -type AccountsRequest struct { -} - -func (m *AccountsRequest) Reset() { *m = AccountsRequest{} } -func (m *AccountsRequest) String() string { return proto.CompactTextString(m) } -func (*AccountsRequest) ProtoMessage() {} -func (*AccountsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } - -type AccountsResponse struct { - Accounts []*AccountsResponse_Account `protobuf:"bytes,1,rep,name=accounts" json:"accounts,omitempty"` - CurrentBlockHash []byte `protobuf:"bytes,2,opt,name=current_block_hash,json=currentBlockHash,proto3" json:"current_block_hash,omitempty"` - CurrentBlockHeight int32 `protobuf:"varint,3,opt,name=current_block_height,json=currentBlockHeight" json:"current_block_height,omitempty"` -} - -func (m *AccountsResponse) Reset() { *m = AccountsResponse{} } -func (m *AccountsResponse) String() string { return proto.CompactTextString(m) } -func (*AccountsResponse) ProtoMessage() {} -func (*AccountsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } - -func (m *AccountsResponse) GetAccounts() []*AccountsResponse_Account { - if m != nil { - return m.Accounts - } - return nil -} - -func (m *AccountsResponse) GetCurrentBlockHash() []byte { - if m != nil { - return m.CurrentBlockHash - } - return nil -} - -func (m *AccountsResponse) GetCurrentBlockHeight() int32 { - if m != nil { - return m.CurrentBlockHeight - } - return 0 -} - -type AccountsResponse_Account struct { - AccountNumber uint32 `protobuf:"varint,1,opt,name=account_number,json=accountNumber" json:"account_number,omitempty"` - AccountName string `protobuf:"bytes,2,opt,name=account_name,json=accountName" json:"account_name,omitempty"` - TotalBalance int64 `protobuf:"varint,3,opt,name=total_balance,json=totalBalance" json:"total_balance,omitempty"` - ExternalKeyCount uint32 `protobuf:"varint,4,opt,name=external_key_count,json=externalKeyCount" json:"external_key_count,omitempty"` - InternalKeyCount uint32 `protobuf:"varint,5,opt,name=internal_key_count,json=internalKeyCount" json:"internal_key_count,omitempty"` - ImportedKeyCount uint32 `protobuf:"varint,6,opt,name=imported_key_count,json=importedKeyCount" json:"imported_key_count,omitempty"` -} - -func (m *AccountsResponse_Account) Reset() { *m = AccountsResponse_Account{} } -func (m *AccountsResponse_Account) String() string { return proto.CompactTextString(m) } -func (*AccountsResponse_Account) ProtoMessage() {} -func (*AccountsResponse_Account) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12, 0} } - -func (m *AccountsResponse_Account) GetAccountNumber() uint32 { - if m != nil { - return m.AccountNumber - } - return 0 -} - -func (m *AccountsResponse_Account) GetAccountName() string { - if m != nil { - return m.AccountName - } - return "" -} - -func (m *AccountsResponse_Account) GetTotalBalance() int64 { - if m != nil { - return m.TotalBalance - } - return 0 -} - -func (m *AccountsResponse_Account) GetExternalKeyCount() uint32 { - if m != nil { - return m.ExternalKeyCount - } - return 0 -} - -func (m *AccountsResponse_Account) GetInternalKeyCount() uint32 { - if m != nil { - return m.InternalKeyCount - } - return 0 -} - -func (m *AccountsResponse_Account) GetImportedKeyCount() uint32 { - if m != nil { - return m.ImportedKeyCount - } - return 0 -} - -type RenameAccountRequest struct { - AccountNumber uint32 `protobuf:"varint,1,opt,name=account_number,json=accountNumber" json:"account_number,omitempty"` - NewName string `protobuf:"bytes,2,opt,name=new_name,json=newName" json:"new_name,omitempty"` -} - -func (m *RenameAccountRequest) Reset() { *m = RenameAccountRequest{} } -func (m *RenameAccountRequest) String() string { return proto.CompactTextString(m) } -func (*RenameAccountRequest) ProtoMessage() {} -func (*RenameAccountRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } - -func (m *RenameAccountRequest) GetAccountNumber() uint32 { - if m != nil { - return m.AccountNumber - } - return 0 -} - -func (m *RenameAccountRequest) GetNewName() string { - if m != nil { - return m.NewName - } - return "" -} - -type RenameAccountResponse struct { -} - -func (m *RenameAccountResponse) Reset() { *m = RenameAccountResponse{} } -func (m *RenameAccountResponse) String() string { return proto.CompactTextString(m) } -func (*RenameAccountResponse) ProtoMessage() {} -func (*RenameAccountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } - -type NextAccountRequest struct { - Passphrase []byte `protobuf:"bytes,1,opt,name=passphrase,proto3" json:"passphrase,omitempty"` - AccountName string `protobuf:"bytes,2,opt,name=account_name,json=accountName" json:"account_name,omitempty"` -} - -func (m *NextAccountRequest) Reset() { *m = NextAccountRequest{} } -func (m *NextAccountRequest) String() string { return proto.CompactTextString(m) } -func (*NextAccountRequest) ProtoMessage() {} -func (*NextAccountRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } - -func (m *NextAccountRequest) GetPassphrase() []byte { - if m != nil { - return m.Passphrase - } - return nil -} - -func (m *NextAccountRequest) GetAccountName() string { - if m != nil { - return m.AccountName - } - return "" -} - -type NextAccountResponse struct { - AccountNumber uint32 `protobuf:"varint,1,opt,name=account_number,json=accountNumber" json:"account_number,omitempty"` -} - -func (m *NextAccountResponse) Reset() { *m = NextAccountResponse{} } -func (m *NextAccountResponse) String() string { return proto.CompactTextString(m) } -func (*NextAccountResponse) ProtoMessage() {} -func (*NextAccountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } - -func (m *NextAccountResponse) GetAccountNumber() uint32 { - if m != nil { - return m.AccountNumber - } - return 0 -} - -type NextAddressRequest struct { - Account uint32 `protobuf:"varint,1,opt,name=account" json:"account,omitempty"` - Kind NextAddressRequest_Kind `protobuf:"varint,2,opt,name=kind,enum=walletrpc.NextAddressRequest_Kind" json:"kind,omitempty"` -} - -func (m *NextAddressRequest) Reset() { *m = NextAddressRequest{} } -func (m *NextAddressRequest) String() string { return proto.CompactTextString(m) } -func (*NextAddressRequest) ProtoMessage() {} -func (*NextAddressRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } - -func (m *NextAddressRequest) GetAccount() uint32 { - if m != nil { - return m.Account - } - return 0 -} - -func (m *NextAddressRequest) GetKind() NextAddressRequest_Kind { - if m != nil { - return m.Kind - } - return NextAddressRequest_BIP0044_EXTERNAL -} - -type NextAddressResponse struct { - Address string `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` -} - -func (m *NextAddressResponse) Reset() { *m = NextAddressResponse{} } -func (m *NextAddressResponse) String() string { return proto.CompactTextString(m) } -func (*NextAddressResponse) ProtoMessage() {} -func (*NextAddressResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } - -func (m *NextAddressResponse) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -type ImportPrivateKeyRequest struct { - Passphrase []byte `protobuf:"bytes,1,opt,name=passphrase,proto3" json:"passphrase,omitempty"` - Account uint32 `protobuf:"varint,2,opt,name=account" json:"account,omitempty"` - PrivateKeyWif string `protobuf:"bytes,3,opt,name=private_key_wif,json=privateKeyWif" json:"private_key_wif,omitempty"` - Rescan bool `protobuf:"varint,4,opt,name=rescan" json:"rescan,omitempty"` -} - -func (m *ImportPrivateKeyRequest) Reset() { *m = ImportPrivateKeyRequest{} } -func (m *ImportPrivateKeyRequest) String() string { return proto.CompactTextString(m) } -func (*ImportPrivateKeyRequest) ProtoMessage() {} -func (*ImportPrivateKeyRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } - -func (m *ImportPrivateKeyRequest) GetPassphrase() []byte { - if m != nil { - return m.Passphrase - } - return nil -} - -func (m *ImportPrivateKeyRequest) GetAccount() uint32 { - if m != nil { - return m.Account - } - return 0 -} - -func (m *ImportPrivateKeyRequest) GetPrivateKeyWif() string { - if m != nil { - return m.PrivateKeyWif - } - return "" -} - -func (m *ImportPrivateKeyRequest) GetRescan() bool { - if m != nil { - return m.Rescan - } - return false -} - -type ImportPrivateKeyResponse struct { -} - -func (m *ImportPrivateKeyResponse) Reset() { *m = ImportPrivateKeyResponse{} } -func (m *ImportPrivateKeyResponse) String() string { return proto.CompactTextString(m) } -func (*ImportPrivateKeyResponse) ProtoMessage() {} -func (*ImportPrivateKeyResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } - -type BalanceRequest struct { - AccountNumber uint32 `protobuf:"varint,1,opt,name=account_number,json=accountNumber" json:"account_number,omitempty"` - RequiredConfirmations int32 `protobuf:"varint,2,opt,name=required_confirmations,json=requiredConfirmations" json:"required_confirmations,omitempty"` -} - -func (m *BalanceRequest) Reset() { *m = BalanceRequest{} } -func (m *BalanceRequest) String() string { return proto.CompactTextString(m) } -func (*BalanceRequest) ProtoMessage() {} -func (*BalanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } - -func (m *BalanceRequest) GetAccountNumber() uint32 { - if m != nil { - return m.AccountNumber - } - return 0 -} - -func (m *BalanceRequest) GetRequiredConfirmations() int32 { - if m != nil { - return m.RequiredConfirmations - } - return 0 -} - -type BalanceResponse struct { - Total int64 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` - Spendable int64 `protobuf:"varint,2,opt,name=spendable" json:"spendable,omitempty"` - ImmatureReward int64 `protobuf:"varint,3,opt,name=immature_reward,json=immatureReward" json:"immature_reward,omitempty"` -} - -func (m *BalanceResponse) Reset() { *m = BalanceResponse{} } -func (m *BalanceResponse) String() string { return proto.CompactTextString(m) } -func (*BalanceResponse) ProtoMessage() {} -func (*BalanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } - -func (m *BalanceResponse) GetTotal() int64 { - if m != nil { - return m.Total - } - return 0 -} - -func (m *BalanceResponse) GetSpendable() int64 { - if m != nil { - return m.Spendable - } - return 0 -} - -func (m *BalanceResponse) GetImmatureReward() int64 { - if m != nil { - return m.ImmatureReward - } - return 0 -} - -type GetTransactionsRequest struct { - // Optionally specify the starting block from which to begin including all transactions. - // Either the starting block hash or height may be specified, but not both. - // If a block height is specified and is negative, the absolute value becomes the number of - // last blocks to include. That is, given a current chain height of 1000 and a starting block - // height of -3, transaction notifications will be created for blocks 998, 999, and 1000. - // If both options are excluded, transaction results are created for transactions since the - // genesis block. - StartingBlockHash []byte `protobuf:"bytes,1,opt,name=starting_block_hash,json=startingBlockHash,proto3" json:"starting_block_hash,omitempty"` - StartingBlockHeight int32 `protobuf:"zigzag32,2,opt,name=starting_block_height,json=startingBlockHeight" json:"starting_block_height,omitempty"` - // Optionally specify the last block that transaction results may appear in. - // Either the ending block hash or height may be specified, but not both. - // If both are excluded, transaction results are created for all transactions - // through the best block, and include all unmined transactions. - EndingBlockHash []byte `protobuf:"bytes,3,opt,name=ending_block_hash,json=endingBlockHash,proto3" json:"ending_block_hash,omitempty"` - EndingBlockHeight int32 `protobuf:"varint,4,opt,name=ending_block_height,json=endingBlockHeight" json:"ending_block_height,omitempty"` - // Include at least this many of the newest transactions if they exist. - // Cannot be used when the ending block hash is specified. - // - // TODO: remove until spec adds it back in some way. - MinimumRecentTransactions int32 `protobuf:"varint,5,opt,name=minimum_recent_transactions,json=minimumRecentTransactions" json:"minimum_recent_transactions,omitempty"` -} - -func (m *GetTransactionsRequest) Reset() { *m = GetTransactionsRequest{} } -func (m *GetTransactionsRequest) String() string { return proto.CompactTextString(m) } -func (*GetTransactionsRequest) ProtoMessage() {} -func (*GetTransactionsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} } - -func (m *GetTransactionsRequest) GetStartingBlockHash() []byte { - if m != nil { - return m.StartingBlockHash - } - return nil -} - -func (m *GetTransactionsRequest) GetStartingBlockHeight() int32 { - if m != nil { - return m.StartingBlockHeight - } - return 0 -} - -func (m *GetTransactionsRequest) GetEndingBlockHash() []byte { - if m != nil { - return m.EndingBlockHash - } - return nil -} - -func (m *GetTransactionsRequest) GetEndingBlockHeight() int32 { - if m != nil { - return m.EndingBlockHeight - } - return 0 -} - -func (m *GetTransactionsRequest) GetMinimumRecentTransactions() int32 { - if m != nil { - return m.MinimumRecentTransactions - } - return 0 -} - -type GetTransactionsResponse struct { - MinedTransactions []*BlockDetails `protobuf:"bytes,1,rep,name=mined_transactions,json=minedTransactions" json:"mined_transactions,omitempty"` - UnminedTransactions []*TransactionDetails `protobuf:"bytes,2,rep,name=unmined_transactions,json=unminedTransactions" json:"unmined_transactions,omitempty"` -} - -func (m *GetTransactionsResponse) Reset() { *m = GetTransactionsResponse{} } -func (m *GetTransactionsResponse) String() string { return proto.CompactTextString(m) } -func (*GetTransactionsResponse) ProtoMessage() {} -func (*GetTransactionsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} } - -func (m *GetTransactionsResponse) GetMinedTransactions() []*BlockDetails { - if m != nil { - return m.MinedTransactions - } - return nil -} - -func (m *GetTransactionsResponse) GetUnminedTransactions() []*TransactionDetails { - if m != nil { - return m.UnminedTransactions - } - return nil -} - -type ChangePassphraseRequest struct { - Key ChangePassphraseRequest_Key `protobuf:"varint,1,opt,name=key,enum=walletrpc.ChangePassphraseRequest_Key" json:"key,omitempty"` - OldPassphrase []byte `protobuf:"bytes,2,opt,name=old_passphrase,json=oldPassphrase,proto3" json:"old_passphrase,omitempty"` - NewPassphrase []byte `protobuf:"bytes,3,opt,name=new_passphrase,json=newPassphrase,proto3" json:"new_passphrase,omitempty"` -} - -func (m *ChangePassphraseRequest) Reset() { *m = ChangePassphraseRequest{} } -func (m *ChangePassphraseRequest) String() string { return proto.CompactTextString(m) } -func (*ChangePassphraseRequest) ProtoMessage() {} -func (*ChangePassphraseRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} } - -func (m *ChangePassphraseRequest) GetKey() ChangePassphraseRequest_Key { - if m != nil { - return m.Key - } - return ChangePassphraseRequest_PRIVATE -} - -func (m *ChangePassphraseRequest) GetOldPassphrase() []byte { - if m != nil { - return m.OldPassphrase - } - return nil -} - -func (m *ChangePassphraseRequest) GetNewPassphrase() []byte { - if m != nil { - return m.NewPassphrase - } - return nil -} - -type ChangePassphraseResponse struct { -} - -func (m *ChangePassphraseResponse) Reset() { *m = ChangePassphraseResponse{} } -func (m *ChangePassphraseResponse) String() string { return proto.CompactTextString(m) } -func (*ChangePassphraseResponse) ProtoMessage() {} -func (*ChangePassphraseResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} } - -type FundTransactionRequest struct { - Account uint32 `protobuf:"varint,1,opt,name=account" json:"account,omitempty"` - TargetAmount int64 `protobuf:"varint,2,opt,name=target_amount,json=targetAmount" json:"target_amount,omitempty"` - RequiredConfirmations int32 `protobuf:"varint,3,opt,name=required_confirmations,json=requiredConfirmations" json:"required_confirmations,omitempty"` - IncludeImmatureCoinbases bool `protobuf:"varint,4,opt,name=include_immature_coinbases,json=includeImmatureCoinbases" json:"include_immature_coinbases,omitempty"` - IncludeChangeScript bool `protobuf:"varint,5,opt,name=include_change_script,json=includeChangeScript" json:"include_change_script,omitempty"` - IncludeStakes bool `protobuf:"varint,6,opt,name=include_stakes,json=includeStakes" json:"include_stakes,omitempty"` -} - -func (m *FundTransactionRequest) Reset() { *m = FundTransactionRequest{} } -func (m *FundTransactionRequest) String() string { return proto.CompactTextString(m) } -func (*FundTransactionRequest) ProtoMessage() {} -func (*FundTransactionRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} } - -func (m *FundTransactionRequest) GetAccount() uint32 { - if m != nil { - return m.Account - } - return 0 -} - -func (m *FundTransactionRequest) GetTargetAmount() int64 { - if m != nil { - return m.TargetAmount - } - return 0 -} - -func (m *FundTransactionRequest) GetRequiredConfirmations() int32 { - if m != nil { - return m.RequiredConfirmations - } - return 0 -} - -func (m *FundTransactionRequest) GetIncludeImmatureCoinbases() bool { - if m != nil { - return m.IncludeImmatureCoinbases - } - return false -} - -func (m *FundTransactionRequest) GetIncludeChangeScript() bool { - if m != nil { - return m.IncludeChangeScript - } - return false -} - -type FundTransactionResponse struct { - SelectedOutputs []*FundTransactionResponse_PreviousOutput `protobuf:"bytes,1,rep,name=selected_outputs,json=selectedOutputs" json:"selected_outputs,omitempty"` - TotalAmount int64 `protobuf:"varint,2,opt,name=total_amount,json=totalAmount" json:"total_amount,omitempty"` - ChangePkScript []byte `protobuf:"bytes,3,opt,name=change_pk_script,json=changePkScript,proto3" json:"change_pk_script,omitempty"` -} - -func (m *FundTransactionResponse) Reset() { *m = FundTransactionResponse{} } -func (m *FundTransactionResponse) String() string { return proto.CompactTextString(m) } -func (*FundTransactionResponse) ProtoMessage() {} -func (*FundTransactionResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} } - -func (m *FundTransactionResponse) GetSelectedOutputs() []*FundTransactionResponse_PreviousOutput { - if m != nil { - return m.SelectedOutputs - } - return nil -} - -func (m *FundTransactionResponse) GetTotalAmount() int64 { - if m != nil { - return m.TotalAmount - } - return 0 -} - -func (m *FundTransactionResponse) GetChangePkScript() []byte { - if m != nil { - return m.ChangePkScript - } - return nil -} - -type FundTransactionResponse_PreviousOutput struct { - TransactionHash []byte `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"` - OutputIndex uint32 `protobuf:"varint,2,opt,name=output_index,json=outputIndex" json:"output_index,omitempty"` - Amount int64 `protobuf:"varint,3,opt,name=amount" json:"amount,omitempty"` - PkScript []byte `protobuf:"bytes,4,opt,name=pk_script,json=pkScript,proto3" json:"pk_script,omitempty"` - ReceiveTime int64 `protobuf:"varint,5,opt,name=receive_time,json=receiveTime" json:"receive_time,omitempty"` - FromCoinbase bool `protobuf:"varint,6,opt,name=from_coinbase,json=fromCoinbase" json:"from_coinbase,omitempty"` -} - -func (m *FundTransactionResponse_PreviousOutput) Reset() { - *m = FundTransactionResponse_PreviousOutput{} -} -func (m *FundTransactionResponse_PreviousOutput) String() string { return proto.CompactTextString(m) } -func (*FundTransactionResponse_PreviousOutput) ProtoMessage() {} -func (*FundTransactionResponse_PreviousOutput) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{28, 0} -} - -func (m *FundTransactionResponse_PreviousOutput) GetTransactionHash() []byte { - if m != nil { - return m.TransactionHash - } - return nil -} - -func (m *FundTransactionResponse_PreviousOutput) GetOutputIndex() uint32 { - if m != nil { - return m.OutputIndex - } - return 0 -} - -func (m *FundTransactionResponse_PreviousOutput) GetAmount() int64 { - if m != nil { - return m.Amount - } - return 0 -} - -func (m *FundTransactionResponse_PreviousOutput) GetPkScript() []byte { - if m != nil { - return m.PkScript - } - return nil -} - -func (m *FundTransactionResponse_PreviousOutput) GetReceiveTime() int64 { - if m != nil { - return m.ReceiveTime - } - return 0 -} - -func (m *FundTransactionResponse_PreviousOutput) GetFromCoinbase() bool { - if m != nil { - return m.FromCoinbase - } - return false -} - -type SignTransactionRequest struct { - Passphrase []byte `protobuf:"bytes,1,opt,name=passphrase,proto3" json:"passphrase,omitempty"` - SerializedTransaction []byte `protobuf:"bytes,2,opt,name=serialized_transaction,json=serializedTransaction,proto3" json:"serialized_transaction,omitempty"` - // If no indexes are specified, signatures scripts will be added for - // every input. If any input indexes are specified, only those inputs - // will be signed. Rather than returning an incompletely signed - // transaction if any of the inputs to be signed can not be, the RPC - // immediately errors. - InputIndexes []uint32 `protobuf:"varint,3,rep,packed,name=input_indexes,json=inputIndexes" json:"input_indexes,omitempty"` -} - -func (m *SignTransactionRequest) Reset() { *m = SignTransactionRequest{} } -func (m *SignTransactionRequest) String() string { return proto.CompactTextString(m) } -func (*SignTransactionRequest) ProtoMessage() {} -func (*SignTransactionRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} } - -func (m *SignTransactionRequest) GetPassphrase() []byte { - if m != nil { - return m.Passphrase - } - return nil -} - -func (m *SignTransactionRequest) GetSerializedTransaction() []byte { - if m != nil { - return m.SerializedTransaction - } - return nil -} - -func (m *SignTransactionRequest) GetInputIndexes() []uint32 { - if m != nil { - return m.InputIndexes - } - return nil -} - -type SignTransactionResponse struct { - Transaction []byte `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"` - UnsignedInputIndexes []uint32 `protobuf:"varint,2,rep,packed,name=unsigned_input_indexes,json=unsignedInputIndexes" json:"unsigned_input_indexes,omitempty"` -} - -func (m *SignTransactionResponse) Reset() { *m = SignTransactionResponse{} } -func (m *SignTransactionResponse) String() string { return proto.CompactTextString(m) } -func (*SignTransactionResponse) ProtoMessage() {} -func (*SignTransactionResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} } - -func (m *SignTransactionResponse) GetTransaction() []byte { - if m != nil { - return m.Transaction - } - return nil -} - -func (m *SignTransactionResponse) GetUnsignedInputIndexes() []uint32 { - if m != nil { - return m.UnsignedInputIndexes - } - return nil -} - -type PublishTransactionRequest struct { - SignedTransaction []byte `protobuf:"bytes,1,opt,name=signed_transaction,json=signedTransaction,proto3" json:"signed_transaction,omitempty"` -} - -func (m *PublishTransactionRequest) Reset() { *m = PublishTransactionRequest{} } -func (m *PublishTransactionRequest) String() string { return proto.CompactTextString(m) } -func (*PublishTransactionRequest) ProtoMessage() {} -func (*PublishTransactionRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} } - -func (m *PublishTransactionRequest) GetSignedTransaction() []byte { - if m != nil { - return m.SignedTransaction - } - return nil -} - -type PublishTransactionResponse struct { -} - -func (m *PublishTransactionResponse) Reset() { *m = PublishTransactionResponse{} } -func (m *PublishTransactionResponse) String() string { return proto.CompactTextString(m) } -func (*PublishTransactionResponse) ProtoMessage() {} -func (*PublishTransactionResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} } - -type TransactionNotificationsRequest struct { -} - -func (m *TransactionNotificationsRequest) Reset() { *m = TransactionNotificationsRequest{} } -func (m *TransactionNotificationsRequest) String() string { return proto.CompactTextString(m) } -func (*TransactionNotificationsRequest) ProtoMessage() {} -func (*TransactionNotificationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{33} -} - -type TransactionNotificationsResponse struct { - // Sorted by increasing height. This is a repeated field so many new blocks - // in a new best chain can be notified at once during a reorganize. - AttachedBlocks []*BlockDetails `protobuf:"bytes,1,rep,name=attached_blocks,json=attachedBlocks" json:"attached_blocks,omitempty"` - // If there was a chain reorganize, there may have been blocks with wallet - // transactions that are no longer in the best chain. These are those - // block's hashes. - DetachedBlocks [][]byte `protobuf:"bytes,2,rep,name=detached_blocks,json=detachedBlocks,proto3" json:"detached_blocks,omitempty"` - // Any new unmined transactions are included here. These unmined transactions - // refer to the current best chain, so transactions from detached blocks may - // be moved to mempool and included here if they are not mined or double spent - // in the new chain. Additonally, if no new blocks were attached but a relevant - // unmined transaction is seen by the wallet, it will be reported here. - UnminedTransactions []*TransactionDetails `protobuf:"bytes,3,rep,name=unmined_transactions,json=unminedTransactions" json:"unmined_transactions,omitempty"` - // Instead of notifying all of the removed unmined transactions, - // just send all of the current hashes. - UnminedTransactionHashes [][]byte `protobuf:"bytes,4,rep,name=unmined_transaction_hashes,json=unminedTransactionHashes,proto3" json:"unmined_transaction_hashes,omitempty"` -} - -func (m *TransactionNotificationsResponse) Reset() { *m = TransactionNotificationsResponse{} } -func (m *TransactionNotificationsResponse) String() string { return proto.CompactTextString(m) } -func (*TransactionNotificationsResponse) ProtoMessage() {} -func (*TransactionNotificationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{34} -} - -func (m *TransactionNotificationsResponse) GetAttachedBlocks() []*BlockDetails { - if m != nil { - return m.AttachedBlocks - } - return nil -} - -func (m *TransactionNotificationsResponse) GetDetachedBlocks() [][]byte { - if m != nil { - return m.DetachedBlocks - } - return nil -} - -func (m *TransactionNotificationsResponse) GetUnminedTransactions() []*TransactionDetails { - if m != nil { - return m.UnminedTransactions - } - return nil -} - -func (m *TransactionNotificationsResponse) GetUnminedTransactionHashes() [][]byte { - if m != nil { - return m.UnminedTransactionHashes - } - return nil -} - -type SpentnessNotificationsRequest struct { - Account uint32 `protobuf:"varint,1,opt,name=account" json:"account,omitempty"` - NoNotifyUnspent bool `protobuf:"varint,2,opt,name=no_notify_unspent,json=noNotifyUnspent" json:"no_notify_unspent,omitempty"` - NoNotifySpent bool `protobuf:"varint,3,opt,name=no_notify_spent,json=noNotifySpent" json:"no_notify_spent,omitempty"` -} - -func (m *SpentnessNotificationsRequest) Reset() { *m = SpentnessNotificationsRequest{} } -func (m *SpentnessNotificationsRequest) String() string { return proto.CompactTextString(m) } -func (*SpentnessNotificationsRequest) ProtoMessage() {} -func (*SpentnessNotificationsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{35} } - -func (m *SpentnessNotificationsRequest) GetAccount() uint32 { - if m != nil { - return m.Account - } - return 0 -} - -func (m *SpentnessNotificationsRequest) GetNoNotifyUnspent() bool { - if m != nil { - return m.NoNotifyUnspent - } - return false -} - -func (m *SpentnessNotificationsRequest) GetNoNotifySpent() bool { - if m != nil { - return m.NoNotifySpent - } - return false -} - -type SpentnessNotificationsResponse struct { - TransactionHash []byte `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"` - OutputIndex uint32 `protobuf:"varint,2,opt,name=output_index,json=outputIndex" json:"output_index,omitempty"` - Spender *SpentnessNotificationsResponse_Spender `protobuf:"bytes,3,opt,name=spender" json:"spender,omitempty"` -} - -func (m *SpentnessNotificationsResponse) Reset() { *m = SpentnessNotificationsResponse{} } -func (m *SpentnessNotificationsResponse) String() string { return proto.CompactTextString(m) } -func (*SpentnessNotificationsResponse) ProtoMessage() {} -func (*SpentnessNotificationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{36} -} - -func (m *SpentnessNotificationsResponse) GetTransactionHash() []byte { - if m != nil { - return m.TransactionHash - } - return nil -} - -func (m *SpentnessNotificationsResponse) GetOutputIndex() uint32 { - if m != nil { - return m.OutputIndex - } - return 0 -} - -func (m *SpentnessNotificationsResponse) GetSpender() *SpentnessNotificationsResponse_Spender { - if m != nil { - return m.Spender - } - return nil -} - -type SpentnessNotificationsResponse_Spender struct { - TransactionHash []byte `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"` - InputIndex uint32 `protobuf:"varint,2,opt,name=input_index,json=inputIndex" json:"input_index,omitempty"` -} - -func (m *SpentnessNotificationsResponse_Spender) Reset() { - *m = SpentnessNotificationsResponse_Spender{} -} -func (m *SpentnessNotificationsResponse_Spender) String() string { return proto.CompactTextString(m) } -func (*SpentnessNotificationsResponse_Spender) ProtoMessage() {} -func (*SpentnessNotificationsResponse_Spender) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{36, 0} -} - -func (m *SpentnessNotificationsResponse_Spender) GetTransactionHash() []byte { - if m != nil { - return m.TransactionHash - } - return nil -} - -func (m *SpentnessNotificationsResponse_Spender) GetInputIndex() uint32 { - if m != nil { - return m.InputIndex - } - return 0 -} - -type AccountNotificationsRequest struct { -} - -func (m *AccountNotificationsRequest) Reset() { *m = AccountNotificationsRequest{} } -func (m *AccountNotificationsRequest) String() string { return proto.CompactTextString(m) } -func (*AccountNotificationsRequest) ProtoMessage() {} -func (*AccountNotificationsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{37} } - -type AccountNotificationsResponse struct { - AccountNumber uint32 `protobuf:"varint,1,opt,name=account_number,json=accountNumber" json:"account_number,omitempty"` - AccountName string `protobuf:"bytes,2,opt,name=account_name,json=accountName" json:"account_name,omitempty"` - ExternalKeyCount uint32 `protobuf:"varint,3,opt,name=external_key_count,json=externalKeyCount" json:"external_key_count,omitempty"` - InternalKeyCount uint32 `protobuf:"varint,4,opt,name=internal_key_count,json=internalKeyCount" json:"internal_key_count,omitempty"` - ImportedKeyCount uint32 `protobuf:"varint,5,opt,name=imported_key_count,json=importedKeyCount" json:"imported_key_count,omitempty"` -} - -func (m *AccountNotificationsResponse) Reset() { *m = AccountNotificationsResponse{} } -func (m *AccountNotificationsResponse) String() string { return proto.CompactTextString(m) } -func (*AccountNotificationsResponse) ProtoMessage() {} -func (*AccountNotificationsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{38} } - -func (m *AccountNotificationsResponse) GetAccountNumber() uint32 { - if m != nil { - return m.AccountNumber - } - return 0 -} - -func (m *AccountNotificationsResponse) GetAccountName() string { - if m != nil { - return m.AccountName - } - return "" -} - -func (m *AccountNotificationsResponse) GetExternalKeyCount() uint32 { - if m != nil { - return m.ExternalKeyCount - } - return 0 -} - -func (m *AccountNotificationsResponse) GetInternalKeyCount() uint32 { - if m != nil { - return m.InternalKeyCount - } - return 0 -} - -func (m *AccountNotificationsResponse) GetImportedKeyCount() uint32 { - if m != nil { - return m.ImportedKeyCount - } - return 0 -} - -type CreateWalletRequest struct { - PublicPassphrase []byte `protobuf:"bytes,1,opt,name=public_passphrase,json=publicPassphrase,proto3" json:"public_passphrase,omitempty"` - PrivatePassphrase []byte `protobuf:"bytes,2,opt,name=private_passphrase,json=privatePassphrase,proto3" json:"private_passphrase,omitempty"` - Seed []byte `protobuf:"bytes,3,opt,name=seed,proto3" json:"seed,omitempty"` -} - -func (m *CreateWalletRequest) Reset() { *m = CreateWalletRequest{} } -func (m *CreateWalletRequest) String() string { return proto.CompactTextString(m) } -func (*CreateWalletRequest) ProtoMessage() {} -func (*CreateWalletRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{39} } - -func (m *CreateWalletRequest) GetPublicPassphrase() []byte { - if m != nil { - return m.PublicPassphrase - } - return nil -} - -func (m *CreateWalletRequest) GetPrivatePassphrase() []byte { - if m != nil { - return m.PrivatePassphrase - } - return nil -} - -func (m *CreateWalletRequest) GetSeed() []byte { - if m != nil { - return m.Seed - } - return nil -} - -type CreateWalletResponse struct { -} - -func (m *CreateWalletResponse) Reset() { *m = CreateWalletResponse{} } -func (m *CreateWalletResponse) String() string { return proto.CompactTextString(m) } -func (*CreateWalletResponse) ProtoMessage() {} -func (*CreateWalletResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{40} } - -type OpenWalletRequest struct { - PublicPassphrase []byte `protobuf:"bytes,1,opt,name=public_passphrase,json=publicPassphrase,proto3" json:"public_passphrase,omitempty"` -} - -func (m *OpenWalletRequest) Reset() { *m = OpenWalletRequest{} } -func (m *OpenWalletRequest) String() string { return proto.CompactTextString(m) } -func (*OpenWalletRequest) ProtoMessage() {} -func (*OpenWalletRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{41} } - -func (m *OpenWalletRequest) GetPublicPassphrase() []byte { - if m != nil { - return m.PublicPassphrase - } - return nil -} - -type OpenWalletResponse struct { -} - -func (m *OpenWalletResponse) Reset() { *m = OpenWalletResponse{} } -func (m *OpenWalletResponse) String() string { return proto.CompactTextString(m) } -func (*OpenWalletResponse) ProtoMessage() {} -func (*OpenWalletResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{42} } - -type CloseWalletRequest struct { -} - -func (m *CloseWalletRequest) Reset() { *m = CloseWalletRequest{} } -func (m *CloseWalletRequest) String() string { return proto.CompactTextString(m) } -func (*CloseWalletRequest) ProtoMessage() {} -func (*CloseWalletRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{43} } - -type CloseWalletResponse struct { -} - -func (m *CloseWalletResponse) Reset() { *m = CloseWalletResponse{} } -func (m *CloseWalletResponse) String() string { return proto.CompactTextString(m) } -func (*CloseWalletResponse) ProtoMessage() {} -func (*CloseWalletResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{44} } - -type WalletExistsRequest struct { -} - -func (m *WalletExistsRequest) Reset() { *m = WalletExistsRequest{} } -func (m *WalletExistsRequest) String() string { return proto.CompactTextString(m) } -func (*WalletExistsRequest) ProtoMessage() {} -func (*WalletExistsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{45} } - -type WalletExistsResponse struct { - Exists bool `protobuf:"varint,1,opt,name=exists" json:"exists,omitempty"` -} - -func (m *WalletExistsResponse) Reset() { *m = WalletExistsResponse{} } -func (m *WalletExistsResponse) String() string { return proto.CompactTextString(m) } -func (*WalletExistsResponse) ProtoMessage() {} -func (*WalletExistsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{46} } - -func (m *WalletExistsResponse) GetExists() bool { - if m != nil { - return m.Exists - } - return false -} - -type StartConsensusRpcRequest struct { - NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress" json:"network_address,omitempty"` - Username string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"` - Password []byte `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` - Certificate []byte `protobuf:"bytes,4,opt,name=certificate,proto3" json:"certificate,omitempty"` - SkipVerify bool `protobuf:"varint,5,opt,name=skipverify,proto3" json:"skipverify,omitempty"` -} - -func (m *StartConsensusRpcRequest) Reset() { *m = StartConsensusRpcRequest{} } -func (m *StartConsensusRpcRequest) String() string { return proto.CompactTextString(m) } -func (*StartConsensusRpcRequest) ProtoMessage() {} -func (*StartConsensusRpcRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{47} } - -func (m *StartConsensusRpcRequest) GetNetworkAddress() string { - if m != nil { - return m.NetworkAddress - } - return "" -} - -func (m *StartConsensusRpcRequest) GetUsername() string { - if m != nil { - return m.Username - } - return "" -} - -func (m *StartConsensusRpcRequest) GetPassword() []byte { - if m != nil { - return m.Password - } - return nil -} - -func (m *StartConsensusRpcRequest) GetCertificate() []byte { - if m != nil { - return m.Certificate - } - return nil -} - -type StartConsensusRpcResponse struct { -} - -func (m *StartConsensusRpcResponse) Reset() { *m = StartConsensusRpcResponse{} } -func (m *StartConsensusRpcResponse) String() string { return proto.CompactTextString(m) } -func (*StartConsensusRpcResponse) ProtoMessage() {} -func (*StartConsensusRpcResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{48} } - -func init() { - proto.RegisterType((*VersionRequest)(nil), "walletrpc.VersionRequest") - proto.RegisterType((*VersionResponse)(nil), "walletrpc.VersionResponse") - proto.RegisterType((*TransactionDetails)(nil), "walletrpc.TransactionDetails") - proto.RegisterType((*TransactionDetails_Input)(nil), "walletrpc.TransactionDetails.Input") - proto.RegisterType((*TransactionDetails_Output)(nil), "walletrpc.TransactionDetails.Output") - proto.RegisterType((*BlockDetails)(nil), "walletrpc.BlockDetails") - proto.RegisterType((*AccountBalance)(nil), "walletrpc.AccountBalance") - proto.RegisterType((*PingRequest)(nil), "walletrpc.PingRequest") - proto.RegisterType((*PingResponse)(nil), "walletrpc.PingResponse") - proto.RegisterType((*NetworkRequest)(nil), "walletrpc.NetworkRequest") - proto.RegisterType((*NetworkResponse)(nil), "walletrpc.NetworkResponse") - proto.RegisterType((*AccountNumberRequest)(nil), "walletrpc.AccountNumberRequest") - proto.RegisterType((*AccountNumberResponse)(nil), "walletrpc.AccountNumberResponse") - proto.RegisterType((*AccountsRequest)(nil), "walletrpc.AccountsRequest") - proto.RegisterType((*AccountsResponse)(nil), "walletrpc.AccountsResponse") - proto.RegisterType((*AccountsResponse_Account)(nil), "walletrpc.AccountsResponse.Account") - proto.RegisterType((*RenameAccountRequest)(nil), "walletrpc.RenameAccountRequest") - proto.RegisterType((*RenameAccountResponse)(nil), "walletrpc.RenameAccountResponse") - proto.RegisterType((*NextAccountRequest)(nil), "walletrpc.NextAccountRequest") - proto.RegisterType((*NextAccountResponse)(nil), "walletrpc.NextAccountResponse") - proto.RegisterType((*NextAddressRequest)(nil), "walletrpc.NextAddressRequest") - proto.RegisterType((*NextAddressResponse)(nil), "walletrpc.NextAddressResponse") - proto.RegisterType((*ImportPrivateKeyRequest)(nil), "walletrpc.ImportPrivateKeyRequest") - proto.RegisterType((*ImportPrivateKeyResponse)(nil), "walletrpc.ImportPrivateKeyResponse") - proto.RegisterType((*BalanceRequest)(nil), "walletrpc.BalanceRequest") - proto.RegisterType((*BalanceResponse)(nil), "walletrpc.BalanceResponse") - proto.RegisterType((*GetTransactionsRequest)(nil), "walletrpc.GetTransactionsRequest") - proto.RegisterType((*GetTransactionsResponse)(nil), "walletrpc.GetTransactionsResponse") - proto.RegisterType((*ChangePassphraseRequest)(nil), "walletrpc.ChangePassphraseRequest") - proto.RegisterType((*ChangePassphraseResponse)(nil), "walletrpc.ChangePassphraseResponse") - proto.RegisterType((*FundTransactionRequest)(nil), "walletrpc.FundTransactionRequest") - proto.RegisterType((*FundTransactionResponse)(nil), "walletrpc.FundTransactionResponse") - proto.RegisterType((*FundTransactionResponse_PreviousOutput)(nil), "walletrpc.FundTransactionResponse.PreviousOutput") - proto.RegisterType((*SignTransactionRequest)(nil), "walletrpc.SignTransactionRequest") - proto.RegisterType((*SignTransactionResponse)(nil), "walletrpc.SignTransactionResponse") - proto.RegisterType((*PublishTransactionRequest)(nil), "walletrpc.PublishTransactionRequest") - proto.RegisterType((*PublishTransactionResponse)(nil), "walletrpc.PublishTransactionResponse") - proto.RegisterType((*TransactionNotificationsRequest)(nil), "walletrpc.TransactionNotificationsRequest") - proto.RegisterType((*TransactionNotificationsResponse)(nil), "walletrpc.TransactionNotificationsResponse") - proto.RegisterType((*SpentnessNotificationsRequest)(nil), "walletrpc.SpentnessNotificationsRequest") - proto.RegisterType((*SpentnessNotificationsResponse)(nil), "walletrpc.SpentnessNotificationsResponse") - proto.RegisterType((*SpentnessNotificationsResponse_Spender)(nil), "walletrpc.SpentnessNotificationsResponse.Spender") - proto.RegisterType((*AccountNotificationsRequest)(nil), "walletrpc.AccountNotificationsRequest") - proto.RegisterType((*AccountNotificationsResponse)(nil), "walletrpc.AccountNotificationsResponse") - proto.RegisterType((*CreateWalletRequest)(nil), "walletrpc.CreateWalletRequest") - proto.RegisterType((*CreateWalletResponse)(nil), "walletrpc.CreateWalletResponse") - proto.RegisterType((*OpenWalletRequest)(nil), "walletrpc.OpenWalletRequest") - proto.RegisterType((*OpenWalletResponse)(nil), "walletrpc.OpenWalletResponse") - proto.RegisterType((*CloseWalletRequest)(nil), "walletrpc.CloseWalletRequest") - proto.RegisterType((*CloseWalletResponse)(nil), "walletrpc.CloseWalletResponse") - proto.RegisterType((*WalletExistsRequest)(nil), "walletrpc.WalletExistsRequest") - proto.RegisterType((*WalletExistsResponse)(nil), "walletrpc.WalletExistsResponse") - proto.RegisterType((*StartConsensusRpcRequest)(nil), "walletrpc.StartConsensusRpcRequest") - proto.RegisterType((*StartConsensusRpcResponse)(nil), "walletrpc.StartConsensusRpcResponse") - proto.RegisterEnum("walletrpc.NextAddressRequest_Kind", NextAddressRequest_Kind_name, NextAddressRequest_Kind_value) - proto.RegisterEnum("walletrpc.ChangePassphraseRequest_Key", ChangePassphraseRequest_Key_name, ChangePassphraseRequest_Key_value) -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for VersionService service - -type VersionServiceClient interface { - Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionResponse, error) -} - -type versionServiceClient struct { - cc *grpc.ClientConn -} - -func NewVersionServiceClient(cc *grpc.ClientConn) VersionServiceClient { - return &versionServiceClient{cc} -} - -func (c *versionServiceClient) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionResponse, error) { - out := new(VersionResponse) - err := grpc.Invoke(ctx, "/walletrpc.VersionService/Version", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for VersionService service - -type VersionServiceServer interface { - Version(context.Context, *VersionRequest) (*VersionResponse, error) -} - -func RegisterVersionServiceServer(s *grpc.Server, srv VersionServiceServer) { - s.RegisterService(&_VersionService_serviceDesc, srv) -} - -func _VersionService_Version_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(VersionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(VersionServiceServer).Version(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.VersionService/Version", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(VersionServiceServer).Version(ctx, req.(*VersionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _VersionService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "walletrpc.VersionService", - HandlerType: (*VersionServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Version", - Handler: _VersionService_Version_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "api.proto", -} - -// Client API for WalletService service - -type WalletServiceClient interface { - // Queries - Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) - Network(ctx context.Context, in *NetworkRequest, opts ...grpc.CallOption) (*NetworkResponse, error) - AccountNumber(ctx context.Context, in *AccountNumberRequest, opts ...grpc.CallOption) (*AccountNumberResponse, error) - Accounts(ctx context.Context, in *AccountsRequest, opts ...grpc.CallOption) (*AccountsResponse, error) - Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) - GetTransactions(ctx context.Context, in *GetTransactionsRequest, opts ...grpc.CallOption) (*GetTransactionsResponse, error) - // Notifications - TransactionNotifications(ctx context.Context, in *TransactionNotificationsRequest, opts ...grpc.CallOption) (WalletService_TransactionNotificationsClient, error) - SpentnessNotifications(ctx context.Context, in *SpentnessNotificationsRequest, opts ...grpc.CallOption) (WalletService_SpentnessNotificationsClient, error) - AccountNotifications(ctx context.Context, in *AccountNotificationsRequest, opts ...grpc.CallOption) (WalletService_AccountNotificationsClient, error) - // Control - ChangePassphrase(ctx context.Context, in *ChangePassphraseRequest, opts ...grpc.CallOption) (*ChangePassphraseResponse, error) - RenameAccount(ctx context.Context, in *RenameAccountRequest, opts ...grpc.CallOption) (*RenameAccountResponse, error) - NextAccount(ctx context.Context, in *NextAccountRequest, opts ...grpc.CallOption) (*NextAccountResponse, error) - NextAddress(ctx context.Context, in *NextAddressRequest, opts ...grpc.CallOption) (*NextAddressResponse, error) - ImportPrivateKey(ctx context.Context, in *ImportPrivateKeyRequest, opts ...grpc.CallOption) (*ImportPrivateKeyResponse, error) - FundTransaction(ctx context.Context, in *FundTransactionRequest, opts ...grpc.CallOption) (*FundTransactionResponse, error) - SignTransaction(ctx context.Context, in *SignTransactionRequest, opts ...grpc.CallOption) (*SignTransactionResponse, error) - PublishTransaction(ctx context.Context, in *PublishTransactionRequest, opts ...grpc.CallOption) (*PublishTransactionResponse, error) -} - -type walletServiceClient struct { - cc *grpc.ClientConn -} - -func NewWalletServiceClient(cc *grpc.ClientConn) WalletServiceClient { - return &walletServiceClient{cc} -} - -func (c *walletServiceClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) { - out := new(PingResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/Ping", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) Network(ctx context.Context, in *NetworkRequest, opts ...grpc.CallOption) (*NetworkResponse, error) { - out := new(NetworkResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/Network", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) AccountNumber(ctx context.Context, in *AccountNumberRequest, opts ...grpc.CallOption) (*AccountNumberResponse, error) { - out := new(AccountNumberResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/AccountNumber", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) Accounts(ctx context.Context, in *AccountsRequest, opts ...grpc.CallOption) (*AccountsResponse, error) { - out := new(AccountsResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/Accounts", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { - out := new(BalanceResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/Balance", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) GetTransactions(ctx context.Context, in *GetTransactionsRequest, opts ...grpc.CallOption) (*GetTransactionsResponse, error) { - out := new(GetTransactionsResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/GetTransactions", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) TransactionNotifications(ctx context.Context, in *TransactionNotificationsRequest, opts ...grpc.CallOption) (WalletService_TransactionNotificationsClient, error) { - stream, err := grpc.NewClientStream(ctx, &_WalletService_serviceDesc.Streams[0], c.cc, "/walletrpc.WalletService/TransactionNotifications", opts...) - if err != nil { - return nil, err - } - x := &walletServiceTransactionNotificationsClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type WalletService_TransactionNotificationsClient interface { - Recv() (*TransactionNotificationsResponse, error) - grpc.ClientStream -} - -type walletServiceTransactionNotificationsClient struct { - grpc.ClientStream -} - -func (x *walletServiceTransactionNotificationsClient) Recv() (*TransactionNotificationsResponse, error) { - m := new(TransactionNotificationsResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *walletServiceClient) SpentnessNotifications(ctx context.Context, in *SpentnessNotificationsRequest, opts ...grpc.CallOption) (WalletService_SpentnessNotificationsClient, error) { - stream, err := grpc.NewClientStream(ctx, &_WalletService_serviceDesc.Streams[1], c.cc, "/walletrpc.WalletService/SpentnessNotifications", opts...) - if err != nil { - return nil, err - } - x := &walletServiceSpentnessNotificationsClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type WalletService_SpentnessNotificationsClient interface { - Recv() (*SpentnessNotificationsResponse, error) - grpc.ClientStream -} - -type walletServiceSpentnessNotificationsClient struct { - grpc.ClientStream -} - -func (x *walletServiceSpentnessNotificationsClient) Recv() (*SpentnessNotificationsResponse, error) { - m := new(SpentnessNotificationsResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *walletServiceClient) AccountNotifications(ctx context.Context, in *AccountNotificationsRequest, opts ...grpc.CallOption) (WalletService_AccountNotificationsClient, error) { - stream, err := grpc.NewClientStream(ctx, &_WalletService_serviceDesc.Streams[2], c.cc, "/walletrpc.WalletService/AccountNotifications", opts...) - if err != nil { - return nil, err - } - x := &walletServiceAccountNotificationsClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type WalletService_AccountNotificationsClient interface { - Recv() (*AccountNotificationsResponse, error) - grpc.ClientStream -} - -type walletServiceAccountNotificationsClient struct { - grpc.ClientStream -} - -func (x *walletServiceAccountNotificationsClient) Recv() (*AccountNotificationsResponse, error) { - m := new(AccountNotificationsResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *walletServiceClient) ChangePassphrase(ctx context.Context, in *ChangePassphraseRequest, opts ...grpc.CallOption) (*ChangePassphraseResponse, error) { - out := new(ChangePassphraseResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/ChangePassphrase", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) RenameAccount(ctx context.Context, in *RenameAccountRequest, opts ...grpc.CallOption) (*RenameAccountResponse, error) { - out := new(RenameAccountResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/RenameAccount", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) NextAccount(ctx context.Context, in *NextAccountRequest, opts ...grpc.CallOption) (*NextAccountResponse, error) { - out := new(NextAccountResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/NextAccount", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) NextAddress(ctx context.Context, in *NextAddressRequest, opts ...grpc.CallOption) (*NextAddressResponse, error) { - out := new(NextAddressResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/NextAddress", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) ImportPrivateKey(ctx context.Context, in *ImportPrivateKeyRequest, opts ...grpc.CallOption) (*ImportPrivateKeyResponse, error) { - out := new(ImportPrivateKeyResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/ImportPrivateKey", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) FundTransaction(ctx context.Context, in *FundTransactionRequest, opts ...grpc.CallOption) (*FundTransactionResponse, error) { - out := new(FundTransactionResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/FundTransaction", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) SignTransaction(ctx context.Context, in *SignTransactionRequest, opts ...grpc.CallOption) (*SignTransactionResponse, error) { - out := new(SignTransactionResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/SignTransaction", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) PublishTransaction(ctx context.Context, in *PublishTransactionRequest, opts ...grpc.CallOption) (*PublishTransactionResponse, error) { - out := new(PublishTransactionResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletService/PublishTransaction", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for WalletService service - -type WalletServiceServer interface { - // Queries - Ping(context.Context, *PingRequest) (*PingResponse, error) - Network(context.Context, *NetworkRequest) (*NetworkResponse, error) - AccountNumber(context.Context, *AccountNumberRequest) (*AccountNumberResponse, error) - Accounts(context.Context, *AccountsRequest) (*AccountsResponse, error) - Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) - GetTransactions(context.Context, *GetTransactionsRequest) (*GetTransactionsResponse, error) - // Notifications - TransactionNotifications(*TransactionNotificationsRequest, WalletService_TransactionNotificationsServer) error - SpentnessNotifications(*SpentnessNotificationsRequest, WalletService_SpentnessNotificationsServer) error - AccountNotifications(*AccountNotificationsRequest, WalletService_AccountNotificationsServer) error - // Control - ChangePassphrase(context.Context, *ChangePassphraseRequest) (*ChangePassphraseResponse, error) - RenameAccount(context.Context, *RenameAccountRequest) (*RenameAccountResponse, error) - NextAccount(context.Context, *NextAccountRequest) (*NextAccountResponse, error) - NextAddress(context.Context, *NextAddressRequest) (*NextAddressResponse, error) - ImportPrivateKey(context.Context, *ImportPrivateKeyRequest) (*ImportPrivateKeyResponse, error) - FundTransaction(context.Context, *FundTransactionRequest) (*FundTransactionResponse, error) - SignTransaction(context.Context, *SignTransactionRequest) (*SignTransactionResponse, error) - PublishTransaction(context.Context, *PublishTransactionRequest) (*PublishTransactionResponse, error) -} - -func RegisterWalletServiceServer(s *grpc.Server, srv WalletServiceServer) { - s.RegisterService(&_WalletService_serviceDesc, srv) -} - -func _WalletService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PingRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).Ping(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/Ping", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).Ping(ctx, req.(*PingRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_Network_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(NetworkRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).Network(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/Network", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).Network(ctx, req.(*NetworkRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_AccountNumber_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AccountNumberRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).AccountNumber(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/AccountNumber", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).AccountNumber(ctx, req.(*AccountNumberRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_Accounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AccountsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).Accounts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/Accounts", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).Accounts(ctx, req.(*AccountsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(BalanceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).Balance(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/Balance", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).Balance(ctx, req.(*BalanceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_GetTransactions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetTransactionsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).GetTransactions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/GetTransactions", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).GetTransactions(ctx, req.(*GetTransactionsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_TransactionNotifications_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(TransactionNotificationsRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(WalletServiceServer).TransactionNotifications(m, &walletServiceTransactionNotificationsServer{stream}) -} - -type WalletService_TransactionNotificationsServer interface { - Send(*TransactionNotificationsResponse) error - grpc.ServerStream -} - -type walletServiceTransactionNotificationsServer struct { - grpc.ServerStream -} - -func (x *walletServiceTransactionNotificationsServer) Send(m *TransactionNotificationsResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _WalletService_SpentnessNotifications_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(SpentnessNotificationsRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(WalletServiceServer).SpentnessNotifications(m, &walletServiceSpentnessNotificationsServer{stream}) -} - -type WalletService_SpentnessNotificationsServer interface { - Send(*SpentnessNotificationsResponse) error - grpc.ServerStream -} - -type walletServiceSpentnessNotificationsServer struct { - grpc.ServerStream -} - -func (x *walletServiceSpentnessNotificationsServer) Send(m *SpentnessNotificationsResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _WalletService_AccountNotifications_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(AccountNotificationsRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(WalletServiceServer).AccountNotifications(m, &walletServiceAccountNotificationsServer{stream}) -} - -type WalletService_AccountNotificationsServer interface { - Send(*AccountNotificationsResponse) error - grpc.ServerStream -} - -type walletServiceAccountNotificationsServer struct { - grpc.ServerStream -} - -func (x *walletServiceAccountNotificationsServer) Send(m *AccountNotificationsResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _WalletService_ChangePassphrase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ChangePassphraseRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).ChangePassphrase(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/ChangePassphrase", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).ChangePassphrase(ctx, req.(*ChangePassphraseRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_RenameAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RenameAccountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).RenameAccount(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/RenameAccount", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).RenameAccount(ctx, req.(*RenameAccountRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_NextAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(NextAccountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).NextAccount(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/NextAccount", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).NextAccount(ctx, req.(*NextAccountRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_NextAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(NextAddressRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).NextAddress(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/NextAddress", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).NextAddress(ctx, req.(*NextAddressRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_ImportPrivateKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ImportPrivateKeyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).ImportPrivateKey(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/ImportPrivateKey", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).ImportPrivateKey(ctx, req.(*ImportPrivateKeyRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_FundTransaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FundTransactionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).FundTransaction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/FundTransaction", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).FundTransaction(ctx, req.(*FundTransactionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_SignTransaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SignTransactionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).SignTransaction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/SignTransaction", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).SignTransaction(ctx, req.(*SignTransactionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_PublishTransaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PublishTransactionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).PublishTransaction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletService/PublishTransaction", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).PublishTransaction(ctx, req.(*PublishTransactionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _WalletService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "walletrpc.WalletService", - HandlerType: (*WalletServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Ping", - Handler: _WalletService_Ping_Handler, - }, - { - MethodName: "Network", - Handler: _WalletService_Network_Handler, - }, - { - MethodName: "AccountNumber", - Handler: _WalletService_AccountNumber_Handler, - }, - { - MethodName: "Accounts", - Handler: _WalletService_Accounts_Handler, - }, - { - MethodName: "Balance", - Handler: _WalletService_Balance_Handler, - }, - { - MethodName: "GetTransactions", - Handler: _WalletService_GetTransactions_Handler, - }, - { - MethodName: "ChangePassphrase", - Handler: _WalletService_ChangePassphrase_Handler, - }, - { - MethodName: "RenameAccount", - Handler: _WalletService_RenameAccount_Handler, - }, - { - MethodName: "NextAccount", - Handler: _WalletService_NextAccount_Handler, - }, - { - MethodName: "NextAddress", - Handler: _WalletService_NextAddress_Handler, - }, - { - MethodName: "ImportPrivateKey", - Handler: _WalletService_ImportPrivateKey_Handler, - }, - { - MethodName: "FundTransaction", - Handler: _WalletService_FundTransaction_Handler, - }, - { - MethodName: "SignTransaction", - Handler: _WalletService_SignTransaction_Handler, - }, - { - MethodName: "PublishTransaction", - Handler: _WalletService_PublishTransaction_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "TransactionNotifications", - Handler: _WalletService_TransactionNotifications_Handler, - ServerStreams: true, - }, - { - StreamName: "SpentnessNotifications", - Handler: _WalletService_SpentnessNotifications_Handler, - ServerStreams: true, - }, - { - StreamName: "AccountNotifications", - Handler: _WalletService_AccountNotifications_Handler, - ServerStreams: true, - }, - }, - Metadata: "api.proto", -} - -// Client API for WalletLoaderService service - -type WalletLoaderServiceClient interface { - WalletExists(ctx context.Context, in *WalletExistsRequest, opts ...grpc.CallOption) (*WalletExistsResponse, error) - CreateWallet(ctx context.Context, in *CreateWalletRequest, opts ...grpc.CallOption) (*CreateWalletResponse, error) - OpenWallet(ctx context.Context, in *OpenWalletRequest, opts ...grpc.CallOption) (*OpenWalletResponse, error) - CloseWallet(ctx context.Context, in *CloseWalletRequest, opts ...grpc.CallOption) (*CloseWalletResponse, error) - StartConsensusRpc(ctx context.Context, in *StartConsensusRpcRequest, opts ...grpc.CallOption) (*StartConsensusRpcResponse, error) -} - -type walletLoaderServiceClient struct { - cc *grpc.ClientConn -} - -func NewWalletLoaderServiceClient(cc *grpc.ClientConn) WalletLoaderServiceClient { - return &walletLoaderServiceClient{cc} -} - -func (c *walletLoaderServiceClient) WalletExists(ctx context.Context, in *WalletExistsRequest, opts ...grpc.CallOption) (*WalletExistsResponse, error) { - out := new(WalletExistsResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletLoaderService/WalletExists", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletLoaderServiceClient) CreateWallet(ctx context.Context, in *CreateWalletRequest, opts ...grpc.CallOption) (*CreateWalletResponse, error) { - out := new(CreateWalletResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletLoaderService/CreateWallet", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletLoaderServiceClient) OpenWallet(ctx context.Context, in *OpenWalletRequest, opts ...grpc.CallOption) (*OpenWalletResponse, error) { - out := new(OpenWalletResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletLoaderService/OpenWallet", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletLoaderServiceClient) CloseWallet(ctx context.Context, in *CloseWalletRequest, opts ...grpc.CallOption) (*CloseWalletResponse, error) { - out := new(CloseWalletResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletLoaderService/CloseWallet", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletLoaderServiceClient) StartConsensusRpc(ctx context.Context, in *StartConsensusRpcRequest, opts ...grpc.CallOption) (*StartConsensusRpcResponse, error) { - out := new(StartConsensusRpcResponse) - err := grpc.Invoke(ctx, "/walletrpc.WalletLoaderService/StartConsensusRpc", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for WalletLoaderService service - -type WalletLoaderServiceServer interface { - WalletExists(context.Context, *WalletExistsRequest) (*WalletExistsResponse, error) - CreateWallet(context.Context, *CreateWalletRequest) (*CreateWalletResponse, error) - OpenWallet(context.Context, *OpenWalletRequest) (*OpenWalletResponse, error) - CloseWallet(context.Context, *CloseWalletRequest) (*CloseWalletResponse, error) - StartConsensusRpc(context.Context, *StartConsensusRpcRequest) (*StartConsensusRpcResponse, error) -} - -func RegisterWalletLoaderServiceServer(s *grpc.Server, srv WalletLoaderServiceServer) { - s.RegisterService(&_WalletLoaderService_serviceDesc, srv) -} - -func _WalletLoaderService_WalletExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(WalletExistsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletLoaderServiceServer).WalletExists(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletLoaderService/WalletExists", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletLoaderServiceServer).WalletExists(ctx, req.(*WalletExistsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletLoaderService_CreateWallet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateWalletRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletLoaderServiceServer).CreateWallet(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletLoaderService/CreateWallet", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletLoaderServiceServer).CreateWallet(ctx, req.(*CreateWalletRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletLoaderService_OpenWallet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenWalletRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletLoaderServiceServer).OpenWallet(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletLoaderService/OpenWallet", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletLoaderServiceServer).OpenWallet(ctx, req.(*OpenWalletRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletLoaderService_CloseWallet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseWalletRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletLoaderServiceServer).CloseWallet(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletLoaderService/CloseWallet", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletLoaderServiceServer).CloseWallet(ctx, req.(*CloseWalletRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletLoaderService_StartConsensusRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StartConsensusRpcRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletLoaderServiceServer).StartConsensusRpc(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/walletrpc.WalletLoaderService/StartConsensusRpc", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletLoaderServiceServer).StartConsensusRpc(ctx, req.(*StartConsensusRpcRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _WalletLoaderService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "walletrpc.WalletLoaderService", - HandlerType: (*WalletLoaderServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "WalletExists", - Handler: _WalletLoaderService_WalletExists_Handler, - }, - { - MethodName: "CreateWallet", - Handler: _WalletLoaderService_CreateWallet_Handler, - }, - { - MethodName: "OpenWallet", - Handler: _WalletLoaderService_OpenWallet_Handler, - }, - { - MethodName: "CloseWallet", - Handler: _WalletLoaderService_CloseWallet_Handler, - }, - { - MethodName: "StartConsensusRpc", - Handler: _WalletLoaderService_StartConsensusRpc_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "api.proto", -} - -func init() { proto.RegisterFile("api.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 2391 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x59, 0x5b, 0x73, 0xdc, 0x48, - 0x15, 0x66, 0x2c, 0xdf, 0x72, 0xe6, 0xde, 0xbe, 0x4d, 0x94, 0x38, 0xc9, 0x2a, 0xbb, 0xd9, 0xec, - 0x2e, 0x98, 0x60, 0x02, 0x2c, 0xc5, 0x56, 0xd8, 0xc4, 0x64, 0xd9, 0x21, 0xc1, 0x99, 0x92, 0x93, - 0x4d, 0xaa, 0xa0, 0x98, 0x92, 0x35, 0xed, 0x58, 0x78, 0x46, 0x9a, 0x48, 0x9a, 0x38, 0xe1, 0x89, - 0xa2, 0x8a, 0x47, 0x5e, 0x80, 0x07, 0x0a, 0x6a, 0x5f, 0xf8, 0x05, 0x54, 0xf1, 0xc2, 0x23, 0xfc, - 0x06, 0x1e, 0xf9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, 0x26, 0x2c, - 0x1f, 0xd3, 0xe0, 0xe5, 0xb1, 0x94, 0xbc, 0xe4, 0xe2, 0x97, 0x69, 0x23, 0x2b, 0x67, 0x23, 0x72, - 0x1f, 0x6a, 0xda, 0xfd, 0xaa, 0x8b, 0xd9, 0x9e, 0x7b, 0x31, 0xae, 0xc1, 0xe2, 0x3c, 0x81, 0x06, - 0xda, 0xe9, 0x81, 0x37, 0xf4, 0x42, 0x9f, 0xea, 0xa7, 0xac, 0x98, 0xa7, 0xbc, 0x09, 0xf5, 0x34, - 0x4a, 0xbd, 0x61, 0xff, 0x50, 0x92, 0x0a, 0x5d, 0x2d, 0x26, 0x90, 0x83, 0xc8, 0xee, 0xd4, 0xa1, - 0xda, 0x63, 0x21, 0xa4, 0x82, 0xb0, 0x01, 0x35, 0xf9, 0x29, 0x03, 0x90, 0x87, 0xe9, 0x3e, 0x4d, - 0x4f, 0xa3, 0xf8, 0x44, 0x51, 0x7c, 0x0c, 0xcd, 0x29, 0x92, 0x45, 0x29, 0xd7, 0xef, 0x35, 0xed, - 0x87, 0x72, 0x05, 0x35, 0xa9, 0x4b, 0x14, 0xc9, 0x9d, 0xef, 0xc3, 0x3a, 0xea, 0xbe, 0x3f, 0x19, - 0x1d, 0xd2, 0x18, 0x25, 0x92, 0x77, 0xa0, 0x86, 0x2a, 0xf7, 0x43, 0x6f, 0x44, 0x31, 0xc4, 0xab, - 0x88, 0xed, 0x33, 0xc8, 0xb9, 0x07, 0x1b, 0x39, 0x56, 0x7d, 0x6b, 0xe4, 0x15, 0x2b, 0xd9, 0xd6, - 0x1a, 0xb9, 0xd3, 0x86, 0x26, 0xf2, 0x27, 0xea, 0x1c, 0xff, 0xb0, 0xa0, 0x95, 0x61, 0x28, 0xee, - 0x87, 0xb0, 0x8a, 0x8c, 0x09, 0x13, 0x94, 0x0f, 0xba, 0x3c, 0xb9, 0x02, 0xdc, 0x29, 0x13, 0xf9, - 0x3a, 0x10, 0x7f, 0x12, 0xc7, 0x94,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 0xfa, 0xe0, 0x6d, 0xfd, 0x7f, 0x93, - 0xc6, 0x23, 0x58, 0x11, 0x6d, 0x14, 0x95, 0xaf, 0x4a, 0x66, 0xde, 0x9c, 0xaf, 0x89, 0x58, 0x66, - 0x8c, 0xae, 0x92, 0x60, 0x3f, 0x83, 0x15, 0xc4, 0x2e, 0xa2, 0xe5, 0x75, 0xa8, 0x6a, 0xd1, 0x85, - 0x4a, 0x42, 0x16, 0xc6, 0xce, 0x36, 0x5c, 0x51, 0xc3, 0x72, 0x99, 0x8f, 0xff, 0xb7, 0x02, 0x57, - 0xcb, 0xd7, 0x2f, 0x34, 0x7b, 0x9c, 0x67, 0xae, 0x2c, 0x1f, 0x19, 0xad, 0x0b, 0x8d, 0x8c, 0x8b, - 0x17, 0x1a, 0x19, 0x97, 0x66, 0x8c, 0x8c, 0xbf, 0xad, 0xc0, 0xda, 0x5e, 0x4c, 0x59, 0xfb, 0xfe, - 0x5c, 0x5c, 0x97, 0x72, 0xd7, 0x8f, 0xa0, 0x3d, 0xe6, 0x19, 0xc3, 0xef, 0x17, 0x72, 0x6e, 0x4b, - 0x2e, 0x68, 0xfd, 0x0b, 0xcb, 0x46, 0x6a, 0x92, 0x28, 0xb4, 0x3a, 0x6d, 0x5c, 0xd1, 0xc8, 0x09, - 0x2c, 0x26, 0x94, 0x0e, 0xb0, 0xbe, 0x89, 0xdf, 0xce, 0x26, 0xac, 0x9b, 0x6a, 0x60, 0x6e, 0xfa, - 0x14, 0xda, 0x4f, 0x98, 0x2b, 0x7c, 0x75, 0xe5, 0x9c, 0x75, 0x20, 0xba, 0x04, 0x94, 0xcb, 0xd0, - 0xbd, 0x61, 0x94, 0x98, 0xa7, 0x76, 0x36, 0x98, 0x31, 0x74, 0x14, 0x89, 0x19, 0x2c, 0x91, 0x87, - 0x6f, 0x82, 0x24, 0x7b, 0x29, 0xd9, 0x81, 0x75, 0x13, 0x46, 0x3f, 0x61, 0x05, 0x94, 0x0a, 0x44, - 0xe8, 0xc4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x44, 0xff, 0x0f, - 0x6c, 0xe6, 0xd0, 0x61, 0xbf, 0x77, 0x06, 0x15, 0x66, 0xf5, 0xbf, 0x59, 0xaa, 0x5c, 0x3e, 0x8e, - 0x3c, 0xd6, 0xc3, 0xa9, 0xdc, 0xfe, 0x04, 0x6a, 0x7a, 0xb9, 0x24, 0xfa, 0xdd, 0x95, 0x94, 0x57, - 0xfb, 0xfa, 0xcc, 0x75, 0x3c, 0x0b, 0x13, 0xa8, 0xf7, 0x0c, 0x86, 0xc0, 0x92, 0x9e, 0xc6, 0x10, - 0x58, 0xd6, 0x6c, 0x90, 0x2e, 0x40, 0xd6, 0x2a, 0x90, 0xab, 0x1a, 0x79, 0xa1, 0x07, 0xb1, 0xb7, - 0x67, 0xac, 0x66, 0x6e, 0xac, 0x75, 0x12, 0x86, 0x1b, 0x17, 0xfb, 0x0e, 0xc3, 0x8d, 0x4b, 0x1a, - 0x10, 0xf2, 0x0b, 0x68, 0x17, 0x2a, 0x33, 0xd1, 0x7d, 0x74, 0x56, 0x5b, 0x61, 0xbf, 0x3b, 0x9f, - 0x48, 0xca, 0x3f, 0x5c, 0x16, 0x7f, 0x43, 0x7f, 0xfb, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x22, - 0xfc, 0x70, 0xb3, 0x93, 0x1e, 0x00, 0x00, -} diff --git a/rpcserver.go b/rpcserver.go index 7a29076..939e92c 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -18,10 +18,7 @@ import ( btcutil "github.com/lbryio/lbcutil" "github.com/lbryio/lbcwallet/rpc/legacyrpc" - "github.com/lbryio/lbcwallet/rpc/rpcserver" "github.com/lbryio/lbcwallet/wallet" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" ) // openRPCKeyPair creates or loads the RPC TLS keypair specified by the @@ -102,9 +99,8 @@ func generateRPCKeyPair(writeKey bool) (tls.Certificate, error) { return keyPair, nil } -func startRPCServers(walletLoader *wallet.Loader) (*grpc.Server, *legacyrpc.Server, error) { +func startRPCServers(walletLoader *wallet.Loader) (*legacyrpc.Server, error) { var ( - server *grpc.Server legacyServer *legacyrpc.Server legacyListen = net.Listen keyPair tls.Certificate @@ -115,7 +111,7 @@ func startRPCServers(walletLoader *wallet.Loader) (*grpc.Server, *legacyrpc.Serv } else { keyPair, err = openRPCKeyPair() if err != nil { - return nil, nil, err + return nil, err } // Change the standard net.Listen function to the tls one. @@ -128,27 +124,6 @@ func startRPCServers(walletLoader *wallet.Loader) (*grpc.Server, *legacyrpc.Serv return tls.Listen(net, laddr, tlsConfig) } - if len(cfg.ExperimentalRPCListeners) != 0 { - listeners := makeListeners(cfg.ExperimentalRPCListeners, net.Listen) - if len(listeners) == 0 { - err := errors.New("failed to create listeners for RPC server") - return nil, nil, err - } - creds := credentials.NewServerTLSFromCert(&keyPair) - server = grpc.NewServer(grpc.Creds(creds)) - rpcserver.StartVersionService(server) - rpcserver.StartWalletLoaderService(server, walletLoader, activeNet) - for _, lis := range listeners { - lis := lis - go func() { - log.Infof("Experimental RPC server listening on %s", - lis.Addr()) - err := server.Serve(lis) - log.Tracef("Finished serving expimental RPC: %v", - err) - }() - } - } } if cfg.Username == "" || cfg.Password == "" { @@ -157,7 +132,7 @@ func startRPCServers(walletLoader *wallet.Loader) (*grpc.Server, *legacyrpc.Serv listeners := makeListeners(cfg.LegacyRPCListeners, legacyListen) if len(listeners) == 0 { err := errors.New("failed to create listeners for legacy RPC server") - return nil, nil, err + return nil, err } opts := legacyrpc.Options{ Username: cfg.Username, @@ -169,11 +144,11 @@ func startRPCServers(walletLoader *wallet.Loader) (*grpc.Server, *legacyrpc.Serv } // Error when neither the GRPC nor legacy RPC servers can be started. - if server == nil && legacyServer == nil { - return nil, nil, errors.New("no suitable RPC services can be started") + if legacyServer == nil { + return nil, errors.New("no suitable RPC services can be started") } - return server, legacyServer, nil + return legacyServer, nil } type listenFunc func(net string, laddr string) (net.Listener, error) @@ -244,11 +219,6 @@ func makeListeners(normalizedListenAddrs []string, listen listenFunc) []net.List // with a wallet to enable remote wallet access. For the GRPC server, this // registers the WalletService service, and for the legacy JSON-RPC server it // enables methods that require a loaded wallet. -func startWalletRPCServices(wallet *wallet.Wallet, server *grpc.Server, legacyServer *legacyrpc.Server) { - if server != nil { - rpcserver.StartWalletService(server, wallet) - } - if legacyServer != nil { - legacyServer.RegisterWallet(wallet) - } +func startWalletRPCServices(wallet *wallet.Wallet, legacyServer *legacyrpc.Server) { + legacyServer.RegisterWallet(wallet) }