Skip to content

Latest commit

 

History

History
91 lines (82 loc) · 3.42 KB

fip-0013.md

File metadata and controls

91 lines (82 loc) · 3.42 KB
fip title status type author created updated
13
Ability to retrive all public addresses for a FIO Address
Final
Functionality
Pawel Mastalerz <[email protected]>
2020-07-13
2021-06-15

Abstract

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.

Motivation

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.

Specification

New actions

Get All Public Addresses

Returns all public addresses for specified FIO Address.

New end point: /get_pub_addresses

Request

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.
Example
{
	"fio_address": "purse@alice",
	"limit": 100,
	"offset": 0
}

Processing

  • Request is validated per Exception handling
  • FIO Addresses are returned

Exception handling

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"

Response

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
Example
{
	"public_addresses": [
		{
			"chain_code": "FIO",
			"token_code": "FIO",
			"public_address": "FIO6cp3eJMhtAuQvzetCAqcUAyLBabHj8M8hJD5nA8T1p7FoXaTd2"
		},
		{
			"chain_code": "ETH",
			"token_code": "ETH",
			"public_address": "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B"
		}
	],
	"more": 0
}

Rationale

Straightforward approach used in other getter methods.

Implementation

Release information

The get_pub_addresses API endpoint released in fio v3.0.0.

Backwards Compatibility

No impact on existing functionality, actions or API endpoints.

Future considerations

None