Skip to main content

selectAddress

Opens a popup dialog letting the user pick one address from a provided list. Useful for account-selection UX driven from the bridge popup.

Signature​

await dcent.selectAddress(addresses: string[]): Promise<V1Response>

Parameters​

FieldTypeNotes
addressesstring[]Candidate addresses to show. A non-array argument throws param_error. An empty array or a non-string element (other than one that cannot be cloned for postMessage, such as a function or Symbol, which resolves with internal_error) does not throw — the promise resolves with header.status === 'failure' and param_error (-32602).
const res = await dcent.selectAddress(['0x6A5C…', '0x9bF2…'])
const { selected_index, selected_address } = res.body.parameter

Response​

{
"header": { "version": "1.0", "status": "success", "response_from": "bridge" },
"body": {
"command": "select_address",
"parameter": {
"selected_index": 0,
"selected_address": "0x6A5C…"
}
}
}
FieldTypeDescription
selected_indexnumberIndex of the chosen address within the input array.
selected_addressstringThe address string the user picked.
info

If the user cancels the dialog the promise still resolves — check header.status === 'failure' and user_cancel (4001).