Fetching entries is as simple as fetching the JSON-document at https://raw.githubusercontent.com/1Hive/erya/master/entry/$scope/$4byte
.
For correct resolution of both overrides and global descriptions, you should first fetch the entry with a scope of the address you are sending a transaction to. If no entry exists in this scope, you should check the global scope (the 0-address).
For example, suppose we are sending a transaction to 0x40204DaaCb1480019A7A6826C699903dF94eE019
where we are calling a method with the 4-byte signature 0x8456cb59
. This is how we could do that using JavaScript:
const baseUrl = '<https://raw.githubusercontent.com/1Hive/erya/master/entry/>'
const zeroAddress = '0x0000000000000000000000000000000000000000'
const scope = '0x40204DaaCb1480019A7A6826C699903dF94eE019'
const fourByte = '0x8456cb59'
const globalQuery = fetch(`${baseUrl}/${zeroAddress}/${fourByte}`)
const overrideQuery = fetch(`${baseUrl}/${scope}/${fourByte}`)
const entry = Promise.allSettled([
globalQuery,
overrideQuery
]).then((queries) => {
const firstResolved = queries.find(({ status }) => status === 'fulfilled')
return firstResolved
? firstResolved.value.json()
: null
})