mirror of
https://github.com/alexgo-io/redstone-cache-layer.git
synced 2026-04-30 12:42:05 +08:00
feat: fix problems with no tokens in gw response
This commit is contained in:
@@ -378,3 +378,25 @@ export const findProviderDetailsByAddress = (address: string) => {
|
||||
// throw new Error(`Public key not found for provider address: ${address}`);
|
||||
return {};
|
||||
};
|
||||
|
||||
export const findProviderNameByAddress = (address: string) => {
|
||||
for (const providerName in providers) {
|
||||
const details = providers[providerName];
|
||||
if (
|
||||
details.address === address ||
|
||||
details.evmAddress.toLowerCase() === address.toLowerCase()
|
||||
) {
|
||||
return providerName;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export const getDataServiceId = (provider: string) => {
|
||||
const dataServiceIdFromProviderName = providerToDataServiceId[provider];
|
||||
if (dataServiceIdFromProviderName) {
|
||||
return dataServiceIdFromProviderName;
|
||||
} else {
|
||||
return providerToDataServiceId[findProviderNameByAddress(provider)];
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user