function resolveAddresses(resolver, value, paramType) {
    return __awaiter$4(this, void 0, void 0, function* () {
        if (Array.isArray(paramType)) {
            return yield Promise.all(paramType.map((paramType, index) => {
                return resolveAddresses(resolver, ((Array.isArray(value)) ? value[index] : value[paramType.name]), paramType);
            }));
        }
        if (paramType.type === "address") {
            return yield resolveName(resolver, value);
        }
        if (paramType.type === "tuple") {
            return yield resolveAddresses(resolver, value, paramType.components);
        }
        if (paramType.baseType === "array") {
            if (!Array.isArray(value)) {
                return Promise.reject(logger$i.makeError("invalid value for array", Logger.errors.INVALID_ARGUMENT, {
                    argument: "value",
                    value
                }));
            }
            return yield Promise.all(value.map((v) => resolveAddresses(resolver, v, paramType.arrayChildren)));
        }
        return value;
    });
}
// Recursively replaces ENS names with promises to resolve the name and resolves all properties
Recursively replaces ENS names with promises to resolve the name and resolves all properties
Recursively replaces ENS names with promises to resolve the name and resolves all properties
function resolveAddresses(resolver, value, paramType) {
    return __awaiter$4(this, void 0, void 0, function* () {
        if (Array.isArray(paramType)) {
            return yield Promise.all(paramType.map((paramType, index) => {
                return resolveAddresses(resolver, ((Array.isArray(value)) ? value[index] : value[paramType.name]), paramType);
            }));
        }
        if (paramType.type === "address") {
            return yield resolveName(resolver, value);
        }
        if (paramType.type === "tuple") {
            return yield resolveAddresses(resolver, value, paramType.components);
        }
        if (paramType.baseType === "array") {
            if (!Array.isArray(value)) {
                return Promise.reject(logger$i.makeError("invalid value for array", Logger.errors.INVALID_ARGUMENT, {
                    argument: "value",
                    value
                }));
            }
            return yield Promise.all(value.map((v) => resolveAddresses(resolver, v, paramType.arrayChildren)));
        }
        return value;
    });
}
function resolveAddresses ( resolver , value , paramType ) { return __awaiter$4 ( this , void 0 , void 0 , function * ( ) { if ( Array . isArray ( paramType ) ) { return yield Promise . all ( paramType . map ( ( paramType , index ) => { return resolveAddresses ( resolver , ( ( Array . isArray ( value ) ) ? value [ index ] : value [ paramType . name ] ) , paramType ) ; } ) ) ; } if ( paramType . type === "address" ) { return yield resolveName ( resolver , value ) ; } if ( paramType . type === "tuple" ) { return yield resolveAddresses ( resolver , value , paramType . components ) ; } if ( paramType . baseType === "array" ) { if ( ! Array . isArray ( value ) ) { return Promise . reject ( logger$i . makeError ( "invalid value for array" , Logger . errors . INVALID_ARGUMENT , { argument : "value" , value } ) ) ; } return yield Promise . all ( value . map ( ( v ) => resolveAddresses ( resolver , v , paramType . arrayChildren ) ) ) ; } return value ; } ) ; }
Recursively replaces ENS names with promises to resolve the name and resolves all properties
Recursively replaces ENS names with promises to resolve the name and resolves all properties