forked from Qortal/qortal-ui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
541 B
21 lines
541 B
import { Epml } from '../../epml.js'; |
|
import { cropAddress } from './cropAddress.js'; |
|
|
|
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) |
|
|
|
export const getUserNameFromAddress = async (address) => { |
|
try { |
|
const getNames = await parentEpml.request("apiCall", { |
|
type: "api", |
|
url: `/names/address/${address}`, |
|
}); |
|
|
|
if (Array.isArray(getNames) && getNames.length > 0 ) { |
|
return getNames[0].name; |
|
} else { |
|
return address; |
|
} |
|
} catch (error) { |
|
console.error(error); |
|
} |
|
} |