Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gelatonetwork/aave-protection-lib

Package Overview
Dependencies
Maintainers
6
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gelatonetwork/aave-protection-lib - npm Package Compare versions

Comparing version 1.9.2 to 1.9.3

8

dist/src/index.d.ts

@@ -5,8 +5,10 @@ import { BigNumber, ContractTransaction, ethers } from "ethers";

export declare const cancelProtection: (provider: ethers.providers.Web3Provider) => Promise<ContractTransaction>;
export declare const cancelOldProtection: (provider: ethers.providers.Web3Provider) => Promise<ContractTransaction>;
export declare const updateProtection: (provider: ethers.providers.Web3Provider, colToken: string, debtToken: string, rateMode: BigNumber, wantedHealthFactor: BigNumber, minimumHealthFactor: BigNumber, isPermanent: boolean) => Promise<ContractTransaction>;
export declare const isProtectionDeprecated: (user: string) => Promise<boolean | null>;
export declare const getSubmittedProtection: (user: string) => Promise<Protection[]>;
export declare const isProtectionDeprecated: (user: string) => Promise<boolean>;
export declare const getSubmittedProtection: (user: string) => Promise<Protection>;
export declare const getCancelledProtection: (user: string) => Promise<Protection[]>;
export declare const getExecutedProtection: (user: string) => Promise<Protection[]>;
export declare const getSubmittedOldProtection: (user: string) => Promise<Protection[]>;
export declare const getSubmittedOldProtection: (user: string) => Promise<Protection>;
export declare const getCancelledOldProtection: (user: string) => Promise<Protection[]>;
export declare const getExecutedOldProtection: (user: string) => Promise<Protection[]>;

@@ -12,3 +12,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getExecutedOldProtection = exports.getSubmittedOldProtection = exports.getExecutedProtection = exports.getCancelledProtection = exports.getSubmittedProtection = exports.isProtectionDeprecated = exports.updateProtection = exports.cancelProtection = exports.submitProtection = void 0;
exports.getExecutedOldProtection = exports.getCancelledOldProtection = exports.getSubmittedOldProtection = exports.getExecutedProtection = exports.getCancelledProtection = exports.getSubmittedProtection = exports.isProtectionDeprecated = exports.updateProtection = exports.cancelOldProtection = exports.cancelProtection = exports.submitProtection = void 0;
const constants_1 = require("./constants");

@@ -28,2 +28,6 @@ const contracts_1 = require("./instances/contracts");

exports.cancelProtection = cancelProtection;
const cancelOldProtection = (provider) => __awaiter(void 0, void 0, void 0, function* () {
return contracts_1.getAaveServices(provider).cancelTask(constants_1.addresses(provider.network.chainId).OldProtectionAction);
});
exports.cancelOldProtection = cancelOldProtection;
const updateProtection = (provider, colToken, debtToken, rateMode, wantedHealthFactor, minimumHealthFactor, isPermanent) => __awaiter(void 0, void 0, void 0, function* () {

@@ -38,15 +42,14 @@ if (!utils_1.isProtectionOK(colToken, debtToken, rateMode))

const isProtectionDeprecated = (user) => __awaiter(void 0, void 0, void 0, function* () {
const submittedTasks = yield exports.getSubmittedProtection(user);
if (submittedTasks.length === 0)
return null;
return (submittedTasks[0].action ===
constants_1.addresses(137).OldProtectionAction.toLowerCase());
return ((yield exports.getSubmittedOldProtection(user)).id !== null &&
(yield exports.getSubmittedProtection(user)).id === null &&
(yield exports.getCancelledProtection(user)).length === 0 &&
(yield exports.getExecutedProtection(user)).length === 0);
});
exports.isProtectionDeprecated = isProtectionDeprecated;
const getSubmittedProtection = (user) => __awaiter(void 0, void 0, void 0, function* () {
return protections_1.getSubmittedProtectionByUserAndAction(user, constants_1.addresses(137).ProtectionAction);
return (yield protections_1.getSubmittedProtectionByUserAndAction(user, constants_1.addresses(137).ProtectionAction))[0];
});
exports.getSubmittedProtection = getSubmittedProtection;
const getCancelledProtection = (user) => __awaiter(void 0, void 0, void 0, function* () {
return protections_1.getCancelledProtectionByUser(user);
return protections_1.getCancelledProtectionByUserAndAction(user, constants_1.addresses(137).ProtectionAction);
});

@@ -59,5 +62,9 @@ exports.getCancelledProtection = getCancelledProtection;

const getSubmittedOldProtection = (user) => __awaiter(void 0, void 0, void 0, function* () {
return protections_1.getSubmittedProtectionByUserAndAction(user, constants_1.addresses(137).OldProtectionAction);
return (yield protections_1.getSubmittedProtectionByUserAndAction(user, constants_1.addresses(137).OldProtectionAction))[0];
});
exports.getSubmittedOldProtection = getSubmittedOldProtection;
const getCancelledOldProtection = (user) => __awaiter(void 0, void 0, void 0, function* () {
return protections_1.getCancelledProtectionByUserAndAction(user, constants_1.addresses(137).OldProtectionAction);
});
exports.getCancelledOldProtection = getCancelledOldProtection;
const getExecutedOldProtection = (user) => __awaiter(void 0, void 0, void 0, function* () {

@@ -64,0 +71,0 @@ return protections_1.getExecutedProtectionByUserAndAction(user, constants_1.addresses(137).OldProtectionAction);

@@ -1,3 +0,3 @@

export declare const GET_ALL_CANCELLED_PROTECTION_BY_USER: string;
export declare const GET_ALL_CANCELLED_PROTECTION_BY_USER_AND_ACTION: string;
export declare const GET_ALL_SUBMITTED_PROTECTION_BY_USER_AND_ACTION: string;
export declare const GET_ALL_EXECUTED_PROTECTION_BY_USER_AND_ACTION: string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GET_ALL_EXECUTED_PROTECTION_BY_USER_AND_ACTION = exports.GET_ALL_SUBMITTED_PROTECTION_BY_USER_AND_ACTION = exports.GET_ALL_CANCELLED_PROTECTION_BY_USER = void 0;
exports.GET_ALL_EXECUTED_PROTECTION_BY_USER_AND_ACTION = exports.GET_ALL_SUBMITTED_PROTECTION_BY_USER_AND_ACTION = exports.GET_ALL_CANCELLED_PROTECTION_BY_USER_AND_ACTION = void 0;
const graphql_request_1 = require("graphql-request");
exports.GET_ALL_CANCELLED_PROTECTION_BY_USER = graphql_request_1.gql `
query getCancelledProtectionByUser($user: String) {
protections(where: { user: $user, status: cancelled }) {
exports.GET_ALL_CANCELLED_PROTECTION_BY_USER_AND_ACTION = graphql_request_1.gql `
query getCancelledProtectionByUserAndAction($user: String, $action: String) {
protections(where: { user: $user, status: cancelled, action: $action }) {
id

@@ -9,0 +9,0 @@ status

import { Protection } from "../types";
export declare const getSubmittedProtectionByUserAndAction: (user: string, action: string) => Promise<Protection[]>;
export declare const getCancelledProtectionByUser: (user: string) => Promise<Protection[]>;
export declare const getCancelledProtectionByUserAndAction: (user: string, action: string) => Promise<Protection[]>;
export declare const getExecutedProtectionByUserAndAction: (user: string, action: string) => Promise<Protection[]>;

@@ -12,3 +12,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getExecutedProtectionByUserAndAction = exports.getCancelledProtectionByUser = exports.getSubmittedProtectionByUserAndAction = void 0;
exports.getExecutedProtectionByUserAndAction = exports.getCancelledProtectionByUserAndAction = exports.getSubmittedProtectionByUserAndAction = void 0;
const graphql_1 = require("./graphql");

@@ -29,13 +29,14 @@ const graphql_request_1 = require("graphql-request");

exports.getSubmittedProtectionByUserAndAction = getSubmittedProtectionByUserAndAction;
const getCancelledProtectionByUser = (user) => __awaiter(void 0, void 0, void 0, function* () {
const data = yield graphql_request_1.request(constants_1.subgraphUrl, graphql_1.GET_ALL_CANCELLED_PROTECTION_BY_USER, {
const getCancelledProtectionByUserAndAction = (user, action) => __awaiter(void 0, void 0, void 0, function* () {
const data = yield graphql_request_1.request(constants_1.subgraphUrl, graphql_1.GET_ALL_CANCELLED_PROTECTION_BY_USER_AND_ACTION, {
user: user.toLowerCase(),
action: action.toLowerCase(),
});
if (!data)
throw new Error("getCancelledProtectionByUser: NO DATA");
throw new Error("getCancelledProtectionByUserAndAction: NO DATA");
if (!data.protections)
throw new Error("getCancelledProtectionByUser: NO PROTECTIONS FIELD");
throw new Error("getCancelledProtectionByUserAndAction: NO PROTECTIONS FIELD");
return data.protections;
});
exports.getCancelledProtectionByUser = getCancelledProtectionByUser;
exports.getCancelledProtectionByUserAndAction = getCancelledProtectionByUserAndAction;
const getExecutedProtectionByUserAndAction = (user, action) => __awaiter(void 0, void 0, void 0, function* () {

@@ -42,0 +43,0 @@ const data = yield graphql_request_1.request(constants_1.subgraphUrl, graphql_1.GET_ALL_EXECUTED_PROTECTION_BY_USER_AND_ACTION, {

{
"name": "@gelatonetwork/aave-protection-lib",
"version": "1.9.2",
"version": "1.9.3",
"description": "Aave Automated protection library for submitting and reading task.",

@@ -5,0 +5,0 @@ "main": "dist/src/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc