diff --git a/cli/mobilecoin/cli.py b/cli/mobilecoin/cli.py
index 40a72a6ac..4fb6ef887 100644
--- a/cli/mobilecoin/cli.py
+++ b/cli/mobilecoin/cli.py
@@ -391,7 +391,7 @@ def history(self, account_id):
account = self._load_account_prefix(account_id)
account_id = account['account_id']
- transactions = self.client.get_all_transaction_logs_for_account(account_id)
+ transactions = self.client.get_transaction_logs_for_account(account_id, limit=1000)
def block_key(t):
submitted = t['submitted_block_index']
@@ -585,7 +585,7 @@ def address(self, action, **args):
def address_list(self, account_id):
account = self._load_account_prefix(account_id)
- addresses = self.client.get_addresses_for_account(account['account_id'])
+ addresses = self.client.get_addresses_for_account(account['account_id'], limit=1000)
print()
print(_format_account_header(account))
diff --git a/cli/mobilecoin/client.py b/cli/mobilecoin/client.py
index 25c4b5f86..2146c1d74 100755
--- a/cli/mobilecoin/client.py
+++ b/cli/mobilecoin/client.py
@@ -45,13 +45,17 @@ def _req(self, request_data):
except ConnectionError:
raise ConnectionError(f'Could not connect to wallet server at {self.url}.')
+ raw_response = None
try:
- response_data = json.load(r)
+ raw_response = r.read()
+ response_data = json.loads(raw_response)
except ValueError:
- raise ValueError('API returned invalid JSON:', r.text)
+ raise ValueError('API returned invalid JSON:', raw_response)
if self.verbose:
print(r.status, http.client.responses[r.status])
+ print(repr(raw_response))
+ print(len(raw_response), 'bytes')
print(json.dumps(response_data, indent=2))
print()
@@ -147,10 +151,14 @@ def export_account_secrets(self, account_id):
})
return r['account_secrets']
- def get_all_txos_for_account(self, account_id):
+ def get_txos_for_account(self, account_id, offset=0, limit=100):
r = self._req({
- "method": "get_all_txos_for_account",
- "params": {"account_id": account_id}
+ "method": "get_txos_for_account",
+ "params": {
+ "account_id": account_id,
+ "offset": offset,
+ "limit": limit,
+ }
})
return r['txo_map']
@@ -200,7 +208,7 @@ def assign_address_for_account(self, account_id, metadata=None):
})
return r['address']
- def get_addresses_for_account(self, account_id, offset=0, limit=1000):
+ def get_addresses_for_account(self, account_id, offset=0, limit=100):
r = self._req({
"method": "get_addresses_for_account",
"params": {
@@ -259,11 +267,13 @@ def submit_transaction(self, tx_proposal, account_id=None):
})
return r['transaction_log']
- def get_all_transaction_logs_for_account(self, account_id):
+ def get_transaction_logs_for_account(self, account_id, offset=0, limit=100):
r = self._req({
- "method": "get_all_transaction_logs_for_account",
+ "method": "get_transaction_logs_for_account",
"params": {
"account_id": account_id,
+ "offset": str(int(offset)),
+ "limit": str(int(limit)),
},
})
return r['transaction_log_map']
diff --git a/cli/test/client_tests.py b/cli/test/client_tests.py
index c2c4d8328..72052766f 100644
--- a/cli/test/client_tests.py
+++ b/cli/test/client_tests.py
@@ -113,7 +113,7 @@ def tests_with_wallet(c, source_wallet):
# Check its balance and make sure it has txos.
balance = c.poll_balance(source_account_id, seconds=60)
assert pmob2mob(balance['unspent_pmob']) >= 1
- txos = c.get_all_txos_for_account(source_account_id)
+ txos = c.get_txos_for_account(source_account_id)
assert len(txos) > 0
try:
@@ -149,7 +149,7 @@ def test_transaction(c, source_account_id):
assert pmob2mob(balance['unspent_pmob']) == Decimal('0.0')
# Check transaction logs.
- transaction_log_map = c.get_all_transaction_logs_for_account(dest_account_id)
+ transaction_log_map = c.get_transaction_logs_for_account(dest_account_id)
amounts = [ pmob2mob(t['value_pmob']) for t in transaction_log_map.values() ]
assert sorted( float(a) for a in amounts ) == [0.0996, 0.1], str(amounts)
assert all( t['status'] == 'tx_status_succeeded' for t in transaction_log_map.values() )
diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md
index 1bbb44a61..176fcc93e 100644
--- a/docs/SUMMARY.md
+++ b/docs/SUMMARY.md
@@ -23,7 +23,6 @@
* [Export View Only Account Secrets](accounts/account-secrets/export_view_only_account_secrets.md)
* [Address](accounts/address/README.md)
* [Assign Address For Account](accounts/address/assign_address_for_account.md)
- * [Get All Addresses For Account](accounts/address/get_all_addresses_for_account.md)
* [Get Addresses For Account](accounts/address/get_addresses_for_account.md)
* [Verify Address](accounts/address/verify_address.md)
* [Balance](accounts/balance/README.md)
@@ -42,7 +41,6 @@
* [Get TXO](transactions/txo/get_txo.md)
* [Get MobileCoin Protocol TXO](transactions/txo/get_mc_protocol_txo.md)
* [Get TXOs For Account](transactions/txo/get_txos_for_account.md)
- * [Get All TXOs For Account](transactions/txo/get_all_txos_for_account.md)
* [Get TXOs For Account](transactions/txo/get_txos_for_account.md)
* [Get TXOs For View Only Account](transactions/txo/get_txos_for_view_only_account.md)
* [Get All TXOs For Address](transactions/txo/get_txo_object.md)
@@ -55,7 +53,6 @@
* [Transaction Log](transactions/transaction-log/README.md)
* [Get Transaction Object](transactions/transaction-log/get_transaction_object.md)
* [Get Transaction Log](transactions/transaction-log/get_transaction_log.md)
- * [Get All Transaction Logs For Account](transactions/transaction-log/get_all_transaction_logs_for_account.md)
* [Get Transaction Logs For Account](transactions/transaction-log/get_transaction_logs_for_account.md)
* [Get All Transaction Logs For Block](transactions/transaction-log/get_all_transaction_logs_for_block.md)
* [Get All Transaction Logs Ordered By Block](transactions/transaction-log/get_all_transaction_logs_ordered_by_block.md)
diff --git a/docs/accounts/address/README.md b/docs/accounts/address/README.md
index 74f657cd9..392faf762 100644
--- a/docs/accounts/address/README.md
+++ b/docs/accounts/address/README.md
@@ -22,8 +22,6 @@ Important: If you receive funds at a subaddress that has not yet been assigned,
| `account_id` | string | A unique identifier for the assigned associated account. |
| `metadata` | string | An arbitrary string attached to the object. |
| `subaddress_index` | string \(uint64\) | The assigned subaddress index on the associated account. |
-| `offset` | integer | The value to offset pagination requests. Requests will exclude all list items up to and including this object. |
-| `limit` | integer | The limit of returned results. |
## Example
diff --git a/docs/accounts/address/get_addresses_for_account.md b/docs/accounts/address/get_addresses_for_account.md
index effa784ef..0048f9d01 100644
--- a/docs/accounts/address/get_addresses_for_account.md
+++ b/docs/accounts/address/get_addresses_for_account.md
@@ -9,8 +9,8 @@ description: Get assigned addresses for an account.
| Required Param | Purpose | Requirements |
| :--- | :--- | :--- |
| `account_id` | The account on which to perform this action. | The account must exist in the wallet. |
-| `offset` | integer | The value to offset pagination requests. Requests will exclude all list items up to and including this object. |
-| `limit` | integer | The limit of returned results. This has a max value of 1000, and will return an error if exceeded. |
+| `offset` | The pagination offset. Results start at the offset index. Optional, defaults to 0. | |
+| `limit` | Limit for the number of results. Optional, defaults to 100 | |
## Example
diff --git a/docs/accounts/address/get_all_addresses_for_account.md b/docs/accounts/address/get_all_addresses_for_account.md
deleted file mode 100644
index b5f4cdf21..000000000
--- a/docs/accounts/address/get_all_addresses_for_account.md
+++ /dev/null
@@ -1,71 +0,0 @@
----
-description: Get all assigned addresses for a given account.
----
-
-# Get All Addresses For Account
-
-## Parameters
-
-| Required Param | Purpose | Requirements |
-| :--- | :--- | :--- |
-| `account_id` | The account on which to perform this action. | The account must exist in the wallet. |
-
-## Example
-
-{% tabs %}
-{% tab title="Request Body" %}
-```text
-{
- "method": "get_all_addresses_for_account",
- "params": {
- "account_id": "a8c9c7acb96cf4ad9154eec9384c09f2c75a340b441924847fe5f60a41805bde"
- },
- "jsonrpc": "2.0",
- "id": 1
-}
-```
-{% endtab %}
-
-{% tab title="Response" %}
-```text
-{
- "method": "get_all_addresses_for_account",
- "result": {
- "public_addresses": [
- "4bgkVAH1hs55dwLTGVpZER8ZayhqXbYqfuyisoRrmQPXoWcYQ3SQRTjsAytCiAgk21CRrVNysVw5qwzweURzDK9HL3rGXFmAAahb364kYe3",
- "6prEWE8yEmHAznkZ3QUtHRmVf7q8DS6XpkjzecYCGMj7hVh8fivmCcujamLtugsvvmWE9P2WgTb2o7xGHw8FhiBr1hSrku1u9KKfRJFMenG",
- "3P4GtGkp5UVBXUzBqirgj7QFetWn4PsFPsHBXbC6A8AXw1a9CMej969jneiN1qKcwdn6e1VtD64EruGVSFQ8wHk5xuBHndpV9WUGQ78vV7Z"
- ],
- "address_map": {
- "4bgkVAH1hs55dwLTGVpZER8ZayhqXbYqfuyisoRrmQPXoWcYQ3SQRTjsAytCiAgk21CRrVNysVw5qwzweURzDK9HL3rGXFmAAahb364kYe3": {
- "object": "address",
- "public_address": "4bgkVAH1hs55dwLTGVpZER8ZayhqXbYqfuyisoRrmQPXoWcYQ3SQRTjsAytCiAgk21CRrVNysVw5qwzweURzDK9HL3rGXFmAAahb364kYe3",
- "account_id": "3407fbbc250799f5ce9089658380c5fe152403643a525f581f359917d8d59d52",
- "metadata": "Main",
- "subaddress_index": "0"
- },
- "6prEWE8yEmHAznkZ3QUtHRmVf7q8DS6XpkjzecYCGMj7hVh8fivmCcujamLtugsvvmWE9P2WgTb2o7xGHw8FhiBr1hSrku1u9KKfRJFMenG": {
- "object": "address",
- "public_address": "6prEWE8yEmHAznkZ3QUtHRmVf7q8DS6XpkjzecYCGMj7hVh8fivmCcujamLtugsvvmWE9P2WgTb2o7xGHw8FhiBr1hSrku1u9KKfRJFMenG",
- "account_id": "3407fbbc250799f5ce9089658380c5fe152403643a525f581f359917d8d59d52",
- "metadata": "Change",
- "subaddress_index": "1"
- },
- "3P4GtGkp5UVBXUzBqirgj7QFetWn4PsFPsHBXbC6A8AXw1a9CMej969jneiN1qKcwdn6e1VtD64EruGVSFQ8wHk5xuBHndpV9WUGQ78vV7Z": {
- "object": "address",
- "public_address": "3P4GtGkp5UVBXUzBqirgj7QFetWn4PsFPsHBXbC6A8AXw1a9CMej969jneiN1qKcwdn6e1VtD64EruGVSFQ8wHk5xuBHndpV9WUGQ78vV7Z",
- "account_id": "3407fbbc250799f5ce9089658380c5fe152403643a525f581f359917d8d59d52",
- "metadata": "",
- "subaddress_index": "2"
- }
- }
- },
- "error": null,
- "jsonrpc": "2.0",
- "id": 1,
-}
-verify_a
-```
-{% endtab %}
-{% endtabs %}
-
diff --git a/docs/gift-codes/gift-code/build_gift_code.md b/docs/gift-codes/gift-code/build_gift_code.md
index 98b4fb2d0..b25cf2bff 100644
--- a/docs/gift-codes/gift-code/build_gift_code.md
+++ b/docs/gift-codes/gift-code/build_gift_code.md
@@ -13,7 +13,7 @@ description: Build a gift code in a tx_proposal that you can fund and submit to
| Optional Param | Purpose | Requirements |
| :--- | :--- | :--- |
-| `input_txo_ids` | The specific TXOs to use as inputs to this transaction. | TXO IDs \(obtain from `get_all_txos_for_account`\) |
+| `input_txo_ids` | The specific TXOs to use as inputs to this transaction. | TXO IDs \(obtain from `get_txos_for_account`\) |
| `fee` | The fee amount to submit with this transaction. | If not provided, uses `MINIMUM_FEE` = .01 MOB. |
| `tombstone_block` | The block after which this transaction expires. | If not provided, uses `cur_height` + 10. |
| `max_spendable_value` | The maximum amount for an input TXO selected for this transaction. | |
diff --git a/docs/transactions/transaction-log/README.md b/docs/transactions/transaction-log/README.md
index cbdeb5df1..372c1ccdc 100644
--- a/docs/transactions/transaction-log/README.md
+++ b/docs/transactions/transaction-log/README.md
@@ -32,7 +32,6 @@ Due to the privacy properties of the MobileCoin ledger, transactions are ephemer
| `comment` | string | An arbitrary string attached to the object. |
| `failure_code` | integer | Code representing the cause of "failed" status. |
| `failure_message` | string | Human parsable explanation of "failed" status. |
-| `offset` | integer | The value to offset pagination requests for `transaction_log` list. Requests will exclude all list items up to and including this object. |
## Example
diff --git a/docs/transactions/transaction-log/get_all_transaction_logs_for_account.md b/docs/transactions/transaction-log/get_all_transaction_logs_for_account.md
deleted file mode 100644
index 910d797d9..000000000
--- a/docs/transactions/transaction-log/get_all_transaction_logs_for_account.md
+++ /dev/null
@@ -1,99 +0,0 @@
----
-description: Get all transaction logs for a given account.
----
-
-# Get All Transaction Logs For Account
-
-## Parameters
-
-| Required Param | Purpose | Requirements |
-| :--- | :--- | :--- |
-| `account_id` | The account on which to perform this action. | Account must exist in the wallet. |
-
-## Example
-
-{% tabs %}
-{% tab title="Request Body" %}
-```text
-{
- "method": "get_all_transaction_logs_for_account",
- "params": {
- "account_id": "a4db032dcedc14e39608fe6f26deadf57e306e8c03823b52065724fb4d274c10"
- },
- "jsonrpc": "2.0",
- "id": 1
-}
-```
-{% endtab %}
-
-{% tab title="Response" %}
-```text
-{
- "method": "get_all_transaction_logs_for_account",
- "result": {
- "transaction_log_ids": [
- "49da8168e26331fc9bc109d1e59f7ed572b453f232591de4196f9cefb381c3f4",
- "ff1c85e7a488c2821110597ba75db30d913bb1595de549f83c6e8c56b06d70d1"
- ],
- "transaction_log_map": {
- "49da8168e26331fc9bc109d1e59f7ed572b453f232591de4196f9cefb381c3f4": {
- "object": "transaction_log",
- "transaction_log_id": "49da8168e26331fc9bc109d1e59f7ed572b453f232591de4196f9cefb381c3f4",
- "direction": "tx_direction_received",
- "is_sent_recovered": null,
- "account_id": "a4db032dcedc14e39608fe6f26deadf57e306e8c03823b52065724fb4d274c10",
- "recipient_address_id": null,
- "assigned_address_id": "7JvajhkAZYGmrpCY7ZpEiXRK5yW1ooTV7EWfDNu3Eyt572mH1wNb37BWiU6JqRUvgopPqSVZRexhXXpjF3wqLQR7HaJrcdbHmULujgFmzav",
- "value_pmob": "8199980000000000",
- "fee_pmob": null,
- "submitted_block_index": null,
- "finalized_block_index": "130689",
- "status": "tx_status_succeeded",
- "input_txo_ids": [],
- "output_txo_ids": [
- "49da8168e26331fc9bc109d1e59f7ed572b453f232591de4196f9cefb381c3f4"
- ],
- "change_txo_ids": [],
- "sent_time": null,
- "comment": "",
- "failure_code": null,
- "failure_message": null
- },
- "ff1c85e7a488c2821110597ba75db30d913bb1595de549f83c6e8c56b06d70d1": {
- "object": "transaction_log",
- "transaction_log_id": "ff1c85e7a488c2821110597ba75db30d913bb1595de549f83c6e8c56b06d70d1",
- "direction": "tx_direction_sent",
- "is_sent_recovered": null,
- "account_id": "a4db032dcedc14e39608fe6f26deadf57e306e8c03823b52065724fb4d274c10",
- "recipient_address_id": "7JvajhkAZYGmrpCY7ZpEiXRK5yW1ooTV7EWfDNu3Eyt572mH1wNb37BWiU6JqRUvgopPqSVZRexhXXpjF3wqLQR7HaJrcdbHmULujgFmzav",
- "assigned_address_id": null,
- "value_pmob": "8000000000008",
- "fee_pmob": "10000000000",
- "submitted_block_index": "152951",
- "finalized_block_index": "152951",
- "status": "tx_status_succeeded",
- "input_txo_ids": [
- "135c3861be4034fccb8d0b329f86124cb6e2404cd4debf52a3c3a10cb4a7bdfb",
- "c91b5f27e28460ef6c4f33229e70c4cfe6dc4bc1517a22122a86df9fb8e40815"
- ],
- "output_txo_ids": [
- "243494a0030bcbac40e87670b9288834047ef0727bcc6630a2fe2799439879ab"
- ],
- "change_txo_ids": [
- "58729797de0929eed37acb45225d3631235933b709c00015f46bfc002d5754fc"
- ],
- "sent_time": "2021-02-28 03:05:11 UTC",
- "comment": "",
- "failure_code": null,
- "failure_message": null
- }
- }
- },
- "error": null,
- "jsonrpc": "2.0",
- "id": 1,
-}
-```
-{% endtab %}
-{% endtabs %}
-
diff --git a/docs/transactions/transaction-log/get_transaction_logs_for_account.md b/docs/transactions/transaction-log/get_transaction_logs_for_account.md
index 05432f912..df9da680c 100644
--- a/docs/transactions/transaction-log/get_transaction_logs_for_account.md
+++ b/docs/transactions/transaction-log/get_transaction_logs_for_account.md
@@ -5,8 +5,8 @@
| Required Param | Purpose | Requirement |
| :--- | :--- | :--- |
| `transaction_log_id` | The transaction log ID to get. | Transaction log must exist in the wallet. |
-| `offset` | integer | The value to offset pagination requests. Requests will exclude all list items up to and including this object. |
-| `limit` | integer | The limit of returned results. This has a max value of 1000, and will return an error if exceeded. |
+| `offset` | The pagination offset. Results start at the offset index. Optional, defaults to 0. | |
+| `limit` | Limit for the number of results. Optional, defaults to 100 | |
## Example
@@ -118,4 +118,4 @@
}
```
{% endtab %}
-{% endtabs %}
\ No newline at end of file
+{% endtabs %}
diff --git a/docs/transactions/transaction/build_and_submit_transaction.md b/docs/transactions/transaction/build_and_submit_transaction.md
index ed2542161..1a6a6697d 100644
--- a/docs/transactions/transaction/build_and_submit_transaction.md
+++ b/docs/transactions/transaction/build_and_submit_transaction.md
@@ -17,7 +17,7 @@ description: >-
| `recipient_public_address` | The recipient for this transaction | b58-encoded public address bytes |
| `value_pmob` | The amount of MOB to send in this transaction | |
| `addresses_and_values` | An array of public addresses and value tuples | addresses are b58-encoded public addresses, value is in pmob |
-| `input_txo_ids` | Specific TXOs to use as inputs to this transaction | TXO IDs \(obtain from `get_all_txos_for_account`\) |
+| `input_txo_ids` | Specific TXOs to use as inputs to this transaction | TXO IDs \(obtain from `get_txos_for_account`\) |
| `fee` | The fee amount to submit with this transaction | If not provided, uses `MINIMUM_FEE` = .01 MOB |
| `tombstone_block` | The block after which this transaction expires | If not provided, uses `cur_height` + 10 |
| `max_spendable_value` | The maximum amount for an input TXO selected for this transaction | |
diff --git a/docs/transactions/transaction/build_transaction.md b/docs/transactions/transaction/build_transaction.md
index 002762a95..9f4e8e9d3 100644
--- a/docs/transactions/transaction/build_transaction.md
+++ b/docs/transactions/transaction/build_transaction.md
@@ -17,7 +17,7 @@ description: >-
| `recipient_public_address` | The recipient for this transaction | b58-encoded public address bytes |
| `value_pmob` | The amount of MOB to send in this transaction | |
| `addresses_and_values` | An array of public addresses and value tuples | addresses are b58-encoded public addresses, value is in pmob |
-| `input_txo_ids` | Specific TXOs to use as inputs to this transaction | TXO IDs (obtain from `get_all_txos_for_account`) |
+| `input_txo_ids` | Specific TXOs to use as inputs to this transaction | TXO IDs (obtain from `get_txos_for_account`) |
| `fee` | The fee amount to submit with this transaction | If not provided, uses `MINIMUM_FEE` = .01 MOB |
| `tombstone_block` | The block after which this transaction expires | If not provided, uses `cur_height` + 10 |
| `max_spendable_value` | The maximum amount for an input TXO selected for this transaction | |
diff --git a/docs/transactions/txo/README.md b/docs/transactions/txo/README.md
index 17d8880fe..f81417221 100644
--- a/docs/transactions/txo/README.md
+++ b/docs/transactions/txo/README.md
@@ -29,8 +29,6 @@ In order to construct a transaction, the wallet will select "Unspent Transaction
| `assigned_address` | string \(uint64\) | The address corresponding to the subaddress index which was assigned as an intended sender for this TXO. |
| `key_image` \(only on pending/spent\) | string \(hex\) | A fingerprint of the TXO derived from your private spend key materials, required to spend a TXO |
| `confirmation` | string \(hex\) | A confirmation that the sender of the TXO can provide to validate that they participated in the construction of this TXO. |
-| `offset` | integer | The value to offset pagination requests. Requests will exclude all list items up to and including this object. |
-| `limit` | integer | The limit of returned results. |
## Example
@@ -109,4 +107,4 @@ a minimal txo entity useful for view-only-accounts
| `spent` | string | Whether or not this txo has been manually marked as spent. |
| `txo_id_hex` | string | A synthetic ID created from properties of the TXO. This will be the same for a given TXO across systems. |
-## Example
\ No newline at end of file
+## Example
diff --git a/docs/transactions/txo/get_all_txos_for_account.md b/docs/transactions/txo/get_all_txos_for_account.md
deleted file mode 100644
index b39eb248b..000000000
--- a/docs/transactions/txo/get_all_txos_for_account.md
+++ /dev/null
@@ -1,158 +0,0 @@
----
-description: Get all TXOs for a given account.
----
-
-# Get All TXOs For Account
-
-## Parameters
-
-| Parameter | Purpose | Requirements |
-| :--- | :--- | :--- |
-| `account_id` | The account on which to perform this action. | Account must exist in the wallet. |
-
-## Example
-
-{% tabs %}
-{% tab title="Request Body" %}
-```text
-{
- "method": "get_all_txos_for_account",
- "params": {
- "account_id": "a8c9c7acb96cf4ad9154eec9384c09f2c75a340b441924847fe5f60a41805bde"
- },
- "jsonrpc": "2.0",
- "id": 1
-}
-```
-{% endtab %}
-
-{% tab title="Response" %}
-```text
-{
- "method": "get_all_txos_for_account",
- "result": {
- "txo_ids": [
- "001cdcc1f0a22dc0ddcdaac6020cc03d919cbc3c36923f157b4a6bf0dc980167",
- "00408833347550b046f0996afe92313745f76e307904686e93de5bab3590e9da",
- "005b41a40be1401426f9a00965cc334e4703e4089adb8fa00616e7b25b92c6e5",
- ...
- ],
- "txo_map": {
- "001cdcc1f0a22dc0ddcdaac6020cc03d919cbc3c36923f157b4a6bf0dc980167": {
- "account_status_map": {
- "a4db032dcedc14e39608fe6f26deadf57e306e8c03823b52065724fb4d274c10": {
- "txo_status": "spent",
- "txo_type": "received"
- }
- },
- "assigned_subaddress": "7BeDc5jpZu72AuNavumc8qo8CRJijtQ7QJXyPo9dpnqULaPhe6GdaDNF7cjxkTrDfTcfMgWVgDzKzbvTTwp32KQ78qpx7bUnPYxAgy92caJ",
- "e_fog_hint": "0a54bf0a5f37989b379b9db3e8937387c5033428b399d44ee524c02b53ce8b7fa7ffc7181a854255cefc68704f69eedd43a891d2ed65c9f6e4c0fc645c2bc156278395221100a4fc3a1d617d04f6eca8851e846a0100",
- "is_spent_recovered": false,
- "key_image": "0a20f041e3da520a6e3328d43a920b90bf87826a1602c9249cf6591dd32328a4544e",
- "minted_account_id": null,
- "object": "txo",
- "confirmation": null,
- "public_key": "0a201a592874a596aeb14cbeb1c7d3449cbd20dc8078ad7fff657e131d619145ef0a",
- "received_account_id": "a4db032dcedc14e39608fe6f26deadf57e306e8c03823b52065724fb4d274c10",
- "received_block_index": "128567",
- "spent_block_index": "128569",
- "subaddress_index": "0",
- "target_key": "0a209e1067117870549a77a47de04bd810da052abfc23d60a0c433367bfc689b7428",
- "txo_id": "001cdcc1f0a22dc0ddcdaac6020cc03d919cbc3c36923f157b4a6bf0dc980167",
- "value_pmob": "990000000000"
- },
- "84f30233774d728bb7844bed59d471fe55ee3680ab70ddc312840db0f978f3ba": {
- "account_status_map": {
- "36fdf8fbdaa35ad8e661209b8a7c7057f29bf16a1e399a34aa92c3873dfb853c": {
- "txo_status": "unspent",
- "txo_type": "received"
- },
- "a4db032dcedc14e39608fe6f26deadf57e306e8c03823b52065724fb4d274c10": {
- "txo_status": "secreted",
- "txo_type": "minted"
- }
- },
- "assigned_subaddress": null,
- "e_fog_hint": "0a5472b079a520696518cc7d7c3036e855cbbcf1a3e247db32ab2e62e835183077b862ef86ec4963a584650cc028eb645569f9de1392b88f8fd7fa07aa28c4e035fd5f4866f3db3d403a05d2adb5e4f2992c010b0100",
- "is_spent_recovered": false,
- "key_image": null,
- "minted_account_id": "a4db032dcedc14e39608fe6f26deadf57e306e8c03823b52065724fb4d274c10",
- "object": "txo",
- "confirmation": "0a204488e153cce1e4bcdd4419eecb778f3d2d2b024b39aaa29532d2e47e238b2e31",
- "public_key": "0a20e6736474f73e440686736bfd045d838c2b3bc056ffc647ad6b1c990f5a46b123",
- "received_account_id": "36fdf8fbdaa35ad8e661209b8a7c7057f29bf16a1e399a34aa92c3873dfb853c",
- "received_block_index": null,
- "spent_block_index": null,
- "subaddress_index": null,
- "target_key": "0a20762d8a723aae2aa70cc11c62c91af715f957a7455b695641fe8c94210812cf1b",
- "txo_id": "84f30233774d728bb7844bed59d471fe55ee3680ab70ddc312840db0f978f3ba",
- "value_pmob": "200"
- },
- "58c2c3780792ccf9c51014c7688a71f03732b633f8c5dfa49040fa7f51328280": {
- "account_status_map": {
- "a4db032dcedc14e39608fe6f26deadf57e306e8c03823b52065724fb4d274c10": {
- "txo_status": "unspent",
- "txo_type": "received"
- }
- },
- "assigned_subaddress": "7BeDc5jpZu72AuNavumc8qo8CRJijtQ7QJXyPo9dpnqULaPhe6GdaDNF7cjxkTrDfTcfMgWVgDzKzbvTTwp32KQ78qpx7bUnPYxAgy92caJ",
- "e_fog_hint": "0a546f862ccf5e96a89b3ede770a70aa26ce8be704a7e5a73fff02d16ee1f694297b6c17d2e668d6181df047ae68730dfc7913b28aca66450ee1de0ca3b0bedb07664918899848f217bcbbe48be2ef40074ae5dd0100",
- "is_spent_recovered": false,
- "key_image": "0a20784ab38c4541ce23abbec6744431d6ae14101c49c6535b3e9bf3fd728db13848",
- "minted_account_id": null,
- "object": "txo",
- "confirmation": null,
- "public_key": "0a20d803a979c9ec0531f106363a885dde29101fcd70209f9ed686905512dfd14d5f",
- "received_account_id": "a4db032dcedc14e39608fe6f26deadf57e306e8c03823b52065724fb4d274c10",
- "received_block_index": "79",
- "spent_block_index": null,
- "subaddress_index": "0",
- "target_key": "0a209abadbfcec6c81b3d184dc104e51cac4c4faa8bab4da21a3714901519810c20d",
- "txo_id": "58c2c3780792ccf9c51014c7688a71f03732b633f8c5dfa49040fa7f51328280",
- "value_pmob": "4000000000000"
- },
- "b496f4f3ec3159bf48517aa7d9cda193ef8bfcac343f81eaed0e0a55849e4726": {
- "account_status_map": {
- "a4db032dcedc14e39608fe6f26deadf57e306e8c03823b52065724fb4d274c10": {
- "txo_status": "secreted",
- "txo_type": "minted"
- }
- },
- "assigned_subaddress": null,
- "e_fog_hint": "0a54338fcf8609cf80dfe017bee2339b22b626af2957ef579ae8829f3d8e7fab6c20365b6a99727fcd5e3de7784fca7e1cbb77ec35e7f2c39ea47ef6121716119ba5a67f8a6026a6a6274e7262ea8ea8280782440100",
- "is_spent_recovered": false,
- "key_image": null,
- "minted_account_id": "a4db032dcedc14e39608fe6f26deadf57e306e8c03823b52065724fb4d274c10",
- "object": "txo",
- "confirmation": null,
- "public_key": "0a209432c589bb4e5101c26e935b70930dfe45c78417527fb994872ebd65fcb9c116",
- "received_account_id": null,
- "received_block_index": null,
- "spent_block_index": null,
- "subaddress_index": null,
- "target_key": "0a208c75723e9b9a4af0c833bfe190c43900c3b41834cf37024f5fecfbe9919dff23",
- "txo_id": "b496f4f3ec3159bf48517aa7d9cda193ef8bfcac343f81eaed0e0a55849e4726",
- "value_pmob": "980000000000"
- }
- ]
- }
-}
-```
-{% endtab %}
-{% endtabs %}
-
-{% hint style="info" %}
-Note, you may wish to filter TXOs using a tool like jq. For example, to get all unspent TXOs, you can use:
-
-```text
-{
- "method": "get_all_txos_for_account",
- "params": {
- "account_id": "a4db032dcedc14e39608fe6f26deadf57e306e8c03823b52065724fb4d274c10"
- },
- "jsonrpc": "2.0",
- "id": 1,
-}
-```
-{% endhint %}
-
diff --git a/docs/transactions/txo/get_txos_for_account.md b/docs/transactions/txo/get_txos_for_account.md
index b7b4d24c6..4ebe30ee0 100644
--- a/docs/transactions/txo/get_txos_for_account.md
+++ b/docs/transactions/txo/get_txos_for_account.md
@@ -9,8 +9,8 @@ description: Get TXOs for a given account with offset and limit parameters
| Parameter | Purpose | Requirements |
| :--- | :--- | :--- |
| `account_id` | The account on which to perform this action. | Account must exist in the wallet. |
-| `offset` | The value to offset pagination requests. Requests will exclude all list items up to and including this object. | |
-| `limit` | The limit of returned results. | This has a max value of 1000, and will return an error if exceeded. |
+| `offset` | The pagination offset. Results start at the offset index. Optional, defaults to 0. | |
+| `limit` | Limit for the number of results. Optional, defaults to 100 | |
## Example
@@ -144,4 +144,4 @@ description: Get TXOs for a given account with offset and limit parameters
}
```
{% endtab %}
-{% endtabs %}
\ No newline at end of file
+{% endtabs %}
diff --git a/docs/transactions/txo/get_txos_for_view_only_account.md b/docs/transactions/txo/get_txos_for_view_only_account.md
index 2bc50c0ca..7f1357ec0 100644
--- a/docs/transactions/txo/get_txos_for_view_only_account.md
+++ b/docs/transactions/txo/get_txos_for_view_only_account.md
@@ -9,8 +9,8 @@ description: Get view only TXOs for a given view only account with offset and li
| Parameter | Purpose | Requirements |
| :--- | :--- | :--- |
| `account_id` | The account on which to perform this action. | Account must exist in the wallet. |
-| `offset` | The value to offset pagination requests. Requests will exclude all list items up to and including this object. | |
-| `limit` | The limit of returned results. | This has a max value of 1000, and will return an error if exceeded. |
+| `offset` | The pagination offset. Results start at the offset index. Optional, defaults to 0. | |
+| `limit` | Limit for the number of results. Optional, defaults to 100 | |
## Example
@@ -71,4 +71,4 @@ description: Get view only TXOs for a given view only account with offset and li
}
```
{% endtab %}
-{% endtabs %}
\ No newline at end of file
+{% endtabs %}
diff --git a/full-service/src/db/assigned_subaddress.rs b/full-service/src/db/assigned_subaddress.rs
index 922f66c76..312ec26b0 100644
--- a/full-service/src/db/assigned_subaddress.rs
+++ b/full-service/src/db/assigned_subaddress.rs
@@ -79,8 +79,8 @@ pub trait AssignedSubaddressModel {
/// List all AssignedSubaddresses for a given account.
fn list_all(
account_id_hex: &str,
- offset: Option,
- limit: Option,
+ offset: Option,
+ limit: Option,
conn: &Conn,
) -> Result, WalletDbError>;
@@ -294,8 +294,8 @@ impl AssignedSubaddressModel for AssignedSubaddress {
fn list_all(
account_id_hex: &str,
- offset: Option,
- limit: Option,
+ offset: Option,
+ limit: Option,
conn: &Conn,
) -> Result, WalletDbError> {
use crate::db::schema::assigned_subaddresses::{
@@ -307,7 +307,10 @@ impl AssignedSubaddressModel for AssignedSubaddress {
.filter(schema_account_id_hex.eq(account_id_hex));
let addresses: Vec = if let (Some(o), Some(l)) = (offset, limit) {
- addresses_query.offset(o).limit(l).load(conn)?
+ addresses_query
+ .offset(o as i64)
+ .limit(l as i64)
+ .load(conn)?
} else {
addresses_query.load(conn)?
};
diff --git a/full-service/src/db/transaction_log.rs b/full-service/src/db/transaction_log.rs
index 2d3f9f41d..eacdeeeb9 100644
--- a/full-service/src/db/transaction_log.rs
+++ b/full-service/src/db/transaction_log.rs
@@ -82,8 +82,8 @@ pub trait TransactionLogModel {
/// * Vec(TransactionLog, AssociatedTxos(inputs, outputs, change))
fn list_all(
account_id_hex: &str,
- offset: Option,
- limit: Option,
+ offset: Option,
+ limit: Option,
conn: &Conn,
) -> Result, WalletDbError>;
@@ -227,8 +227,8 @@ impl TransactionLogModel for TransactionLog {
fn list_all(
account_id_hex: &str,
- offset: Option,
- limit: Option,
+ offset: Option,
+ limit: Option,
conn: &Conn,
) -> Result, WalletDbError> {
use crate::db::schema::{transaction_logs, transaction_txo_types, txos};
@@ -252,7 +252,10 @@ impl TransactionLogModel for TransactionLog {
let transactions: Vec<(TransactionLog, TransactionTxoType, Txo)> =
if let (Some(o), Some(l)) = (offset, limit) {
- transactions_query.offset(o).limit(l).load(conn)?
+ transactions_query
+ .offset(o as i64)
+ .limit(l as i64)
+ .load(conn)?
} else {
transactions_query.load(conn)?
};
diff --git a/full-service/src/db/view_only_txo.rs b/full-service/src/db/view_only_txo.rs
index 583a755d0..13bd730b0 100644
--- a/full-service/src/db/view_only_txo.rs
+++ b/full-service/src/db/view_only_txo.rs
@@ -39,8 +39,8 @@ pub trait ViewOnlyTxoModel {
/// * Vec
fn list_for_account(
account_id_hex: &str,
- offset: Option,
- limit: Option,
+ offset: Option,
+ limit: Option,
conn: &Conn,
) -> Result, WalletDbError>;
@@ -98,8 +98,8 @@ impl ViewOnlyTxoModel for ViewOnlyTxo {
fn list_for_account(
account_id_hex: &str,
- offset: Option,
- limit: Option,
+ offset: Option,
+ limit: Option,
conn: &Conn,
) -> Result, WalletDbError> {
use schema::view_only_txos;
@@ -108,7 +108,7 @@ impl ViewOnlyTxoModel for ViewOnlyTxo {
.filter(view_only_txos::view_only_account_id_hex.eq(account_id_hex));
let txos: Vec = if let (Some(o), Some(l)) = (offset, limit) {
- txos_query.offset(o).limit(l).load(conn)?
+ txos_query.offset(o as i64).limit(l as i64).load(conn)?
} else {
txos_query.load(conn)?
};
diff --git a/full-service/src/json_rpc/e2e.rs b/full-service/src/json_rpc/e2e.rs
index 52f41638f..ae79a9689 100644
--- a/full-service/src/json_rpc/e2e.rs
+++ b/full-service/src/json_rpc/e2e.rs
@@ -1309,7 +1309,7 @@ mod e2e {
let body = json!({
"jsonrpc": "2.0",
"id": 1,
- "method": "get_all_transaction_logs_for_account",
+ "method": "get_transaction_logs_for_account",
"params": {
"account_id": account_id,
}
@@ -1954,7 +1954,7 @@ mod e2e {
let body = json!({
"jsonrpc": "2.0",
"id": 1,
- "method": "get_all_txos_for_account",
+ "method": "get_txos_for_account",
"params": {
"account_id": account_id,
}
@@ -1985,7 +1985,7 @@ mod e2e {
let body = json!({
"jsonrpc": "2.0",
"id": 1,
- "method": "get_all_transaction_logs_for_account",
+ "method": "get_transaction_logs_for_account",
"params": {
"account_id": account_id,
}
@@ -2058,7 +2058,7 @@ mod e2e {
let body = json!({
"jsonrpc": "2.0",
"id": 1,
- "method": "get_all_addresses_for_account",
+ "method": "get_addresses_for_account",
"params": {
"account_id": account_id,
},
@@ -2600,7 +2600,7 @@ mod e2e {
let body = json!({
"jsonrpc": "2.0",
"id": 1,
- "method": "get_all_txos_for_account",
+ "method": "get_txos_for_account",
"params": {
"account_id": account_id,
}
@@ -3165,7 +3165,7 @@ mod e2e {
}
#[test_with_logger]
- fn test_get_all_txos(logger: Logger) {
+ fn test_get_txos(logger: Logger) {
let mut rng: StdRng = SeedableRng::from_seed([20u8; 32]);
let (client, mut ledger_db, db_ctx, _network_state) = setup(&mut rng, logger.clone());
@@ -3204,7 +3204,7 @@ mod e2e {
let body = json!({
"jsonrpc": "2.0",
"id": 1,
- "method": "get_all_txos_for_account",
+ "method": "get_txos_for_account",
"params": {
"account_id": account_id,
}
@@ -3293,7 +3293,7 @@ mod e2e {
let body = json!({
"jsonrpc": "2.0",
"id": 1,
- "method": "get_all_txos_for_account",
+ "method": "get_txos_for_account",
"params": {
"account_id": account_id,
}
@@ -4335,6 +4335,7 @@ mod e2e {
fn test_e2e_hot_and_cold_view_only_flow(logger: Logger) {
let mut rng: StdRng = SeedableRng::from_seed([20u8; 32]);
let (client, mut ledger_db, db_ctx, _network_state) = setup(&mut rng, logger.clone());
+ let wallet_db = db_ctx.get_db_instance(logger.clone());
// Add an account
let body = json!({
@@ -4362,7 +4363,7 @@ mod e2e {
);
manually_sync_account(
&ledger_db,
- &db_ctx.get_db_instance(logger.clone()),
+ &wallet_db,
&AccountID(account_id.to_string()),
&logger,
);
@@ -4420,7 +4421,7 @@ mod e2e {
// sync view-only account and check balance
manually_sync_view_only_account(
&ledger_db,
- &db_ctx.get_db_instance(logger.clone()),
+ &wallet_db,
&view_only_account_id,
&logger,
);
@@ -4481,7 +4482,7 @@ mod e2e {
add_block_with_tx_proposal(&mut ledger_db, payments_tx_proposal);
manually_sync_view_only_account(
&ledger_db,
- &db_ctx.get_db_instance(logger.clone()),
+ &wallet_db,
&view_only_account_id,
&logger,
);
diff --git a/full-service/src/json_rpc/json_rpc_request.rs b/full-service/src/json_rpc/json_rpc_request.rs
index 256bd4eb1..2117f6d55 100644
--- a/full-service/src/json_rpc/json_rpc_request.rs
+++ b/full-service/src/json_rpc/json_rpc_request.rs
@@ -45,7 +45,12 @@ impl TryFrom<&JsonRPCRequest> for JsonCommandRequest {
type Error = String;
fn try_from(src: &JsonRPCRequest) -> Result {
- let src_json: serde_json::Value = serde_json::json!(src);
+ let mut src_json: serde_json::Value = serde_json::json!(src);
+
+ // Resolve deprecated method names to an alias.
+ let method = src_json.get_mut("method").ok_or("Missing method")?;
+ *method = method_alias(method.as_str().ok_or("Method is not a string")?).into();
+
serde_json::from_value(src_json).map_err(|e| format!("Could not get value {:?}", e))
}
}
@@ -148,24 +153,15 @@ pub enum JsonCommandRequest {
},
get_addresses_for_account {
account_id: String,
- offset: String,
- limit: String,
+ offset: Option,
+ limit: Option,
},
get_all_accounts,
- get_all_addresses_for_account {
- account_id: String,
- },
get_all_gift_codes,
- get_all_transaction_logs_for_account {
- account_id: String,
- },
get_all_transaction_logs_for_block {
block_index: String,
},
get_all_transaction_logs_ordered_by_block,
- get_all_txos_for_account {
- account_id: String,
- },
get_all_txos_for_address {
address: String,
},
@@ -200,21 +196,21 @@ pub enum JsonCommandRequest {
},
get_transaction_logs_for_account {
account_id: String,
- offset: String,
- limit: String,
+ offset: Option,
+ limit: Option,
},
get_txo {
txo_id: String,
},
get_txos_for_account {
account_id: String,
- offset: String,
- limit: String,
+ offset: Option,
+ limit: Option,
},
get_txos_for_view_only_account {
account_id: String,
- offset: String,
- limit: String,
+ offset: Option,
+ limit: Option,
},
get_view_only_account {
account_id: String,
@@ -284,3 +280,12 @@ pub enum JsonCommandRequest {
},
version,
}
+
+fn method_alias(m: &str) -> &str {
+ match m {
+ "get_all_addresses_for_account" => "get_addresses_for_account",
+ "get_all_transaction_logs_for_account" => "get_transaction_logs_for_account",
+ "get_all_txos_for_account" => "get_txos_for_account",
+ _ => m,
+ }
+}
diff --git a/full-service/src/json_rpc/json_rpc_response.rs b/full-service/src/json_rpc/json_rpc_response.rs
index d726cf942..49aad17c8 100644
--- a/full-service/src/json_rpc/json_rpc_response.rs
+++ b/full-service/src/json_rpc/json_rpc_response.rs
@@ -201,10 +201,6 @@ pub enum JsonCommandResponse {
get_all_gift_codes {
gift_codes: Vec,
},
- get_all_transaction_logs_for_account {
- transaction_log_ids: Vec,
- transaction_log_map: Map,
- },
get_all_transaction_logs_for_block {
transaction_log_ids: Vec,
transaction_log_map: Map,
@@ -212,10 +208,6 @@ pub enum JsonCommandResponse {
get_all_transaction_logs_ordered_by_block {
transaction_log_map: Map,
},
- get_all_txos_for_account {
- txo_ids: Vec,
- txo_map: Map,
- },
get_all_txos_for_address {
txo_ids: Vec,
txo_map: Map,
diff --git a/full-service/src/json_rpc/wallet.rs b/full-service/src/json_rpc/wallet.rs
index 1df4a615c..e29032461 100644
--- a/full-service/src/json_rpc/wallet.rs
+++ b/full-service/src/json_rpc/wallet.rs
@@ -491,13 +491,7 @@ where
offset,
limit,
} => {
- let o = offset.parse::().map_err(format_error)?;
- let l = limit.parse::().map_err(format_error)?;
-
- if l > 1000 {
- return Err(format_error("limit must not exceed 1000"));
- }
-
+ let (o, l) = page_helper(offset, limit)?;
let addresses = service
.get_addresses_for_account(&AccountID(account_id), Some(o), Some(l))
.map_err(format_error)?;
@@ -542,31 +536,6 @@ where
account_map,
}
}
- JsonCommandRequest::get_all_addresses_for_account { account_id } => {
- let addresses = service
- .get_addresses_for_account(&AccountID(account_id), None, None)
- .map_err(format_error)?;
- let address_map: Map = Map::from_iter(
- addresses
- .iter()
- .map(|a| {
- (
- a.assigned_subaddress_b58.clone(),
- serde_json::to_value(&(Address::from(a)))
- .expect("Could not get json value"),
- )
- })
- .collect::>(),
- );
-
- JsonCommandResponse::get_addresses_for_account {
- public_addresses: addresses
- .iter()
- .map(|a| a.assigned_subaddress_b58.clone())
- .collect(),
- address_map,
- }
- }
JsonCommandRequest::get_all_gift_codes {} => JsonCommandResponse::get_all_gift_codes {
gift_codes: service
.list_gift_codes()
@@ -575,30 +544,6 @@ where
.map(GiftCode::from)
.collect(),
},
- JsonCommandRequest::get_all_transaction_logs_for_account { account_id } => {
- let transaction_logs_and_txos = service
- .list_transaction_logs(&AccountID(account_id), None, None)
- .map_err(format_error)?;
- let transaction_log_map: Map = Map::from_iter(
- transaction_logs_and_txos
- .iter()
- .map(|(t, a)| {
- (
- t.transaction_id_hex.clone(),
- serde_json::json!(json_rpc::transaction_log::TransactionLog::new(t, a)),
- )
- })
- .collect::>(),
- );
-
- JsonCommandResponse::get_all_transaction_logs_for_account {
- transaction_log_ids: transaction_logs_and_txos
- .iter()
- .map(|(t, _a)| t.transaction_id_hex.to_string())
- .collect(),
- transaction_log_map,
- }
- }
JsonCommandRequest::get_all_transaction_logs_for_block { block_index } => {
let transaction_logs_and_txos = service
.get_all_transaction_logs_for_block(
@@ -645,26 +590,6 @@ where
transaction_log_map,
}
}
- JsonCommandRequest::get_all_txos_for_account { account_id } => {
- let txos = service
- .list_txos(&AccountID(account_id), None, None)
- .map_err(format_error)?;
- let txo_map: Map = Map::from_iter(
- txos.iter()
- .map(|t| {
- (
- t.txo_id_hex.clone(),
- serde_json::to_value(Txo::from(t)).expect("Could not get json value"),
- )
- })
- .collect::>(),
- );
-
- JsonCommandResponse::get_all_txos_for_account {
- txo_ids: txos.iter().map(|t| t.txo_id_hex.clone()).collect(),
- txo_map,
- }
- }
JsonCommandRequest::get_all_txos_for_address { address } => {
let txos = service
.get_all_txos_for_address(&address)
@@ -796,13 +721,7 @@ where
offset,
limit,
} => {
- let o = offset.parse::().map_err(format_error)?;
- let l = limit.parse::().map_err(format_error)?;
-
- if l > 1000 {
- return Err(format_error("limit must not exceed 1000"));
- }
-
+ let (o, l) = page_helper(offset, limit)?;
let transaction_logs_and_txos = service
.list_transaction_logs(&AccountID(account_id), Some(o), Some(l))
.map_err(format_error)?;
@@ -837,15 +756,7 @@ where
offset,
limit,
} => {
- let o = offset
- .parse::()
- .map_err(format_invalid_request_error)?;
- let l = limit.parse::().map_err(format_invalid_request_error)?;
-
- if l > 1000 {
- return Err(format_error("limit must not exceed 1000"));
- }
-
+ let (o, l) = page_helper(offset, limit)?;
let txos = service
.list_txos(&AccountID(account_id), Some(o), Some(l))
.map_err(format_error)?;
@@ -870,15 +781,7 @@ where
offset,
limit,
} => {
- let o = offset
- .parse::()
- .map_err(format_invalid_request_error)?;
- let l = limit.parse::().map_err(format_invalid_request_error)?;
-
- if l > 1000 {
- return Err(format_error("limit must not exceed 1000"));
- }
-
+ let (o, l) = page_helper(offset, limit)?;
let txos = service
.list_view_only_txos(&account_id, Some(o), Some(l))
.map_err(format_error)?;
@@ -1135,6 +1038,18 @@ fn health() -> Result<(), ()> {
Ok(())
}
+fn page_helper(offset: Option, limit: Option) -> Result<(u64, u64), JsonRPCError> {
+ let offset = match offset {
+ Some(o) => o.parse::().map_err(format_error)?,
+ None => 0, // Default offset is zero, at the start of the records.
+ };
+ let limit = match limit {
+ Some(l) => l.parse::().map_err(format_error)?,
+ None => 100, // Default page size is one hundred records.
+ };
+ Ok((offset, limit))
+}
+
/// Returns an instance of a Rocket server.
pub fn consensus_backed_rocket(
rocket_config: rocket::Config,
diff --git a/full-service/src/service/address.rs b/full-service/src/service/address.rs
index 001600ef6..632f4cdeb 100644
--- a/full-service/src/service/address.rs
+++ b/full-service/src/service/address.rs
@@ -54,8 +54,8 @@ pub trait AddressService {
fn get_addresses_for_account(
&self,
account_id: &AccountID,
- offset: Option,
- limit: Option,
+ offset: Option,
+ limit: Option,
) -> Result, AddressServiceError>;
fn get_address_for_account(
@@ -94,8 +94,8 @@ where
fn get_addresses_for_account(
&self,
account_id: &AccountID,
- offset: Option,
- limit: Option,
+ offset: Option,
+ limit: Option,
) -> Result, AddressServiceError> {
let conn = self.wallet_db.get_conn()?;
Ok(AssignedSubaddress::list_all(
diff --git a/full-service/src/service/transaction_log.rs b/full-service/src/service/transaction_log.rs
index be59d1f18..fffe9fc29 100644
--- a/full-service/src/service/transaction_log.rs
+++ b/full-service/src/service/transaction_log.rs
@@ -46,8 +46,8 @@ pub trait TransactionLogService {
fn list_transaction_logs(
&self,
account_id: &AccountID,
- offset: Option,
- limit: Option,
+ offset: Option,
+ limit: Option,
) -> Result, WalletServiceError>;
/// Get a specific transaction log.
@@ -76,8 +76,8 @@ where
fn list_transaction_logs(
&self,
account_id: &AccountID,
- offset: Option,
- limit: Option,
+ offset: Option,
+ limit: Option,
) -> Result, WalletServiceError> {
let conn = &self.wallet_db.get_conn()?;
Ok(TransactionLog::list_all(
diff --git a/full-service/src/service/view_only_txo.rs b/full-service/src/service/view_only_txo.rs
index ec898826b..84d2ac39b 100644
--- a/full-service/src/service/view_only_txo.rs
+++ b/full-service/src/service/view_only_txo.rs
@@ -17,8 +17,8 @@ pub trait ViewOnlyTxoService {
fn list_view_only_txos(
&self,
account_id: &str,
- limit: Option,
- offset: Option,
+ limit: Option,
+ offset: Option,
) -> Result, TxoServiceError>;
/// set a group of txos as spent.
@@ -33,8 +33,8 @@ where
fn list_view_only_txos(
&self,
account_id: &str,
- limit: Option,
- offset: Option,
+ limit: Option,
+ offset: Option,
) -> Result, TxoServiceError> {
let conn = self.wallet_db.get_conn()?;
Ok(ViewOnlyTxo::list_for_account(