mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 16:53:02 +08:00
Updated adapter to support Rain.fi v2 (#13634)
Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com>
This commit is contained in:
@@ -32,7 +32,22 @@ function checkType(typeObj) {
|
||||
if (isAccountObjInTypeMap || !accountMap[typeObj.name])
|
||||
whitelistedTypeMap[typeObj.name] = typeObj
|
||||
|
||||
if (typeObj.type.kind === 'enum' && Array.isArray(typeObj.type.variants)) {
|
||||
typeObj.type.variants.forEach(v => {
|
||||
if (!v.fields) {
|
||||
const name = getDefinedName(v)
|
||||
if (name && typeMap[name]) checkType(typeMap[name])
|
||||
return;
|
||||
}
|
||||
v.fields.forEach(f => {
|
||||
const name = getDefinedName(f)
|
||||
if (name && typeMap[name]) checkType(typeMap[name])
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (typeObj.type.kind !== 'struct') return;
|
||||
|
||||
typeObj.type.fields.forEach(f => {
|
||||
const isVec = f.type?.vec?.defined?.name
|
||||
if (isVec) {
|
||||
@@ -49,6 +64,19 @@ function checkType(typeObj) {
|
||||
if (name && typeMap[name]) checkType(typeMap[name])
|
||||
})
|
||||
}
|
||||
if (typeof f.type === 'enum' && Array.isArray(f.type.variants)) {
|
||||
f.type.variants.forEach(v => {
|
||||
if (!v.fields) {
|
||||
const name = getDefinedName(v)
|
||||
if (name && typeMap[name]) checkType(typeMap[name])
|
||||
return;
|
||||
}
|
||||
v.fields.forEach(f => {
|
||||
const name = getDefinedName(f)
|
||||
if (name && typeMap[name]) checkType(typeMap[name])
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user