Skip to content

Latest commit

 

History

History
109 lines (98 loc) · 4.94 KB

fip-0019.md

File metadata and controls

109 lines (98 loc) · 4.94 KB
fip title status type author created updated
19
Add ability to retrieve all received FIO Requests
Final
Functionality
Pawel Mastalerz <[email protected]>
2020-10-01
2021-06-15

Abstract

This FIPs adds ability for wallets retrieve all received FIO Request.

New actions and end points:

Action Endpoint Description
get_received_fio_requests Returns all FIO Request received irrespective of status.

Motivation

Currently the wallet can retrieve:

There is no getter to fetch all received FIO Requests irrespective of status. Wallet could use get_table_rows, but it requires hashing of values and potentially multi-table look-up.

Specification

New actions and end points

Get received FIO Requests

Returns all FIO Request received irrespective of status.

New end point: /get_received_fio_requests

Request

Parameter Required Format Definition
fio_public_key Yes FIO public key Valid FIO Public Key.
limit No Positive Int Number of records to return. If omitted, all records will be returned. Due to table read timeout, a value of less than 1,000 is recommended.
offset No Positive Int First record from list to return. If omitted, 0 is assumed.
Example
{
  "fio_public_key": "FIO8PRe4WRZJj5mkem6qVGKyvNFgPsNnjNN6kPhh6EaCpzCVin5Jj",
  "limit": 100,
  "offset": 0
}

Processing

  • Request is validated per Exception handling
  • All FIO Requests received by any FIO Address owned by account hashed down from the supplied fio_public_key is returned

Exception handling

Error condition Trigger Type fields:name fields:value Error message
Invalid FIO Public Key Format of FIO Public Key is not valid. 400 "fio_public_key" Value sent in, i.e. "FIO8PRe4WRZJj5..." "Invalid FIO Public Key format"
Invalid limit limit is not valid 400 "limit" Value sent in, e.g. "-1" "Invalid limit"
invalid offset offset not valid 400 "offset" Value sent in, e.g. "-1" "Invalid offset"
No received FIO Requests There are no received FIO Requests for account. 404 "No received FIO Requests"

Response

Group Parameter Format Definition
requests JSON Array Array of FIO Requests
requests fio_request_id String ID of FIO Request
requests payer_fio_address String FIO Address of the payer. Request was sent from this FIO Address.
requests payee_fio_address String FIO Address of the payee. Request was sent to this FIO Address.
requests payer_fio_public_key String FIO Public Key of the payer. Account hashed down from this key owns the payer_fio_address.
requests payee_fio_public_key String FIO Public Key of the payee. Account hashed down from this key owns the payee_fio_address.
requests content String Encrypted blob
requests status String Status of FIO Request.
more Int Number of results remaining
Example
{
  "requests": [
    {
      "fio_request_id": "10",
      "payer_fio_address": "purse@alice",
      "payee_fio_address": "crypto@bob",
      "payer_fio_public_key": "FIO7167ErgCveJvuonvrEvVGhdWnkP4AEMfqvEd8s8raMkbbAXqhx",
      "payee_fio_public_key": "FIO7KGdMYj4ZMY2nUX9EaZu3G3GxZhTNXUq1tsNqC5rcP9rcmvWHq",
      "content": "...",
      "time_stamp": "2020-09-11T18:30:56"
      "status": "rejected"
    }
  ],
  "more": 0
}

Rationale

The FIO Protocol functionality can be significantly improved for wallets without major compatibility disruptions.

Implementation

define branching strategy for this change. set up branch. modify the chain plugin -- make a new get method get_received_fio_requests, use the get_pending_fio_requests as an example, modify inner logic so all results in the specified offset and limit are returned. modify the chain_api_plugin to add the new chain RO call get_received_fio_requests. modify chain_plugin.hpp add a new received_record, get_received_fio_requests_params and definitions of get_received_fio_requests. rebuild, and dev test. submit PR, review with the team. estimated time to complete .5-2 working days.

Release information

The get_received_fio_requests API endpoint released in fio v3.0.0.

Backwards Compatibility

As this is a new getter method there is no backwards compatibility issues. Chain API code deploy will be required. After deployment, nodes which have not upgraded, will not support this getter method, but would otherwise function properly.

Future considerations

None

Discussion link

https://fioprotocol.atlassian.net/browse/WP-148