| fip | 13 |
|---|---|
| title | Ability to retrive all public addresses for a FIO Address |
| status | Final |
| type | Functionality |
| author | Pawel Mastalerz <pawel@dapix.io> |
| created | 2020-07-13 |
| updated | 2021-06-15 |
This FIP implements ability to easily fetch all public address mapped to a provided FIO Address.
Proposed new actions:
| Action | Endpoint | Description |
|---|---|---|
| get_pub_addresses | Returns all public addresses for specified FIO Address. |
Currently, the /get_pub_address API method returns only the public address for specific chain and token code. This works great for a look-up of a specific token code, but it's not practical for a wallet wanting to fetch and display all public address mappings to the owner of the FIO Address. Even though the mappings can be fetched using /get_table_rows, this call requires index computation, and therefore a native API method is desirable.
Returns all public addresses for specified FIO Address.
| Parameter | Required | Format | Definition |
|---|---|---|---|
| fio_address | Yes | FIO Address | FIO Address of the payee. |
| 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. |
{
"fio_address": "purse@alice",
"limit": 100,
"offset": 0
}
- Request is validated per Exception handling
- FIO Addresses are returned
| Error condition | Trigger | Type | fields:name | fields:value | Error message |
|---|---|---|---|---|---|
| Invalid FIO Address | Format of FIO Address not valid. | 400 | "fio_address" | Value sent in, i.e. "purse@alice" | "Invalid FIO Address format" |
| FIO Address does not exist | FIO Address does not exist. | 400 | "fio_address" | Value sent in, i.e. "purse@alice" | "FIO Address does not exist" |
| 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 FIO addresses are mapped | FIO Address does not have any public addresses mapped. | 404 | "Public addresses not found" |
| Group | Parameter | Format | Definition |
|---|---|---|---|
| public_addresses | JSON Array | Array of actions | |
| public_addresses | chain_code | String | Chain code |
| public_addresses | token_code | String | Token code |
| public_addresses | public_address | String | Public address for specified chain_code and token_code |
| more | Int | Number of remaining results |
{
"public_addresses": [
{
"chain_code": "FIO",
"token_code": "FIO",
"public_address": "FIO6cp3eJMhtAuQvzetCAqcUAyLBabHj8M8hJD5nA8T1p7FoXaTd2"
},
{
"chain_code": "ETH",
"token_code": "ETH",
"public_address": "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B"
}
],
"more": 0
}
Straightforward approach used in other getter methods.
The get_pub_addresses API endpoint released in fio v3.0.0.
No impact on existing functionality, actions or API endpoints.
None