@gelatonetwork/aave-protection-lib
Advanced tools
Comparing version 1.9.1 to 1.9.2
@@ -10,1 +10,3 @@ import { BigNumber, ContractTransaction, ethers } from "ethers"; | ||
export declare const getExecutedProtection: (user: string) => Promise<Protection[]>; | ||
export declare const getSubmittedOldProtection: (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.getExecutedProtection = exports.getCancelledProtection = exports.getSubmittedProtection = exports.isProtectionDeprecated = exports.updateProtection = exports.cancelProtection = exports.submitProtection = void 0; | ||
exports.getExecutedOldProtection = exports.getSubmittedOldProtection = exports.getExecutedProtection = exports.getCancelledProtection = exports.getSubmittedProtection = exports.isProtectionDeprecated = exports.updateProtection = exports.cancelProtection = exports.submitProtection = void 0; | ||
const constants_1 = require("./constants"); | ||
@@ -45,3 +45,3 @@ const contracts_1 = require("./instances/contracts"); | ||
const getSubmittedProtection = (user) => __awaiter(void 0, void 0, void 0, function* () { | ||
return protections_1.getSubmittedProtectionByUser(user); | ||
return protections_1.getSubmittedProtectionByUserAndAction(user, constants_1.addresses(137).ProtectionAction); | ||
}); | ||
@@ -54,4 +54,12 @@ exports.getSubmittedProtection = getSubmittedProtection; | ||
const getExecutedProtection = (user) => __awaiter(void 0, void 0, void 0, function* () { | ||
return protections_1.getExecutedProtectionByUser(user); | ||
return protections_1.getExecutedProtectionByUserAndAction(user, constants_1.addresses(137).ProtectionAction); | ||
}); | ||
exports.getExecutedProtection = getExecutedProtection; | ||
const getSubmittedOldProtection = (user) => __awaiter(void 0, void 0, void 0, function* () { | ||
return protections_1.getSubmittedProtectionByUserAndAction(user, constants_1.addresses(137).OldProtectionAction); | ||
}); | ||
exports.getSubmittedOldProtection = getSubmittedOldProtection; | ||
const getExecutedOldProtection = (user) => __awaiter(void 0, void 0, void 0, function* () { | ||
return protections_1.getExecutedProtectionByUserAndAction(user, constants_1.addresses(137).OldProtectionAction); | ||
}); | ||
exports.getExecutedOldProtection = getExecutedOldProtection; |
export declare const GET_ALL_CANCELLED_PROTECTION_BY_USER: string; | ||
export declare const GET_ALL_SUBMITTED_PROTECTION_BY_USER: string; | ||
export declare const GET_ALL_EXECUTED_PROTECTION_BY_USER: 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 = exports.GET_ALL_SUBMITTED_PROTECTION_BY_USER = 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 = void 0; | ||
const graphql_request_1 = require("graphql-request"); | ||
@@ -41,5 +41,5 @@ exports.GET_ALL_CANCELLED_PROTECTION_BY_USER = graphql_request_1.gql ` | ||
`; | ||
exports.GET_ALL_SUBMITTED_PROTECTION_BY_USER = graphql_request_1.gql ` | ||
query getSubmittedProtectionByUser($user: String) { | ||
protections(where: { user: $user, status: submitted }) { | ||
exports.GET_ALL_SUBMITTED_PROTECTION_BY_USER_AND_ACTION = graphql_request_1.gql ` | ||
query getSubmittedProtectionByUserAndAction($user: String, $action: String) { | ||
protections(where: { user: $user, status: submitted, action: $action }) { | ||
id | ||
@@ -78,5 +78,5 @@ status | ||
`; | ||
exports.GET_ALL_EXECUTED_PROTECTION_BY_USER = graphql_request_1.gql ` | ||
query getExecutedProtectionByUser($user: String) { | ||
protections(where: { user: $user, status: executed }) { | ||
exports.GET_ALL_EXECUTED_PROTECTION_BY_USER_AND_ACTION = graphql_request_1.gql ` | ||
query getExecutedProtectionByUserAndAction($user: String, $action: String) { | ||
protections(where: { user: $user, status: executed, action: $action }) { | ||
id | ||
@@ -83,0 +83,0 @@ status |
import { Protection } from "../types"; | ||
export declare const getSubmittedProtectionByUser: (user: string) => Promise<Protection[]>; | ||
export declare const getSubmittedProtectionByUserAndAction: (user: string, action: string) => Promise<Protection[]>; | ||
export declare const getCancelledProtectionByUser: (user: string) => Promise<Protection[]>; | ||
export declare const getExecutedProtectionByUser: (user: string) => Promise<Protection[]>; | ||
export declare const getExecutedProtectionByUserAndAction: (user: string, action: string) => Promise<Protection[]>; |
@@ -12,17 +12,18 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getExecutedProtectionByUser = exports.getCancelledProtectionByUser = exports.getSubmittedProtectionByUser = void 0; | ||
exports.getExecutedProtectionByUserAndAction = exports.getCancelledProtectionByUser = exports.getSubmittedProtectionByUserAndAction = void 0; | ||
const graphql_1 = require("./graphql"); | ||
const graphql_request_1 = require("graphql-request"); | ||
const constants_1 = require("../constants"); | ||
const getSubmittedProtectionByUser = (user) => __awaiter(void 0, void 0, void 0, function* () { | ||
const data = yield graphql_request_1.request(constants_1.subgraphUrl, graphql_1.GET_ALL_SUBMITTED_PROTECTION_BY_USER, { | ||
const getSubmittedProtectionByUserAndAction = (user, action) => __awaiter(void 0, void 0, void 0, function* () { | ||
const data = yield graphql_request_1.request(constants_1.subgraphUrl, graphql_1.GET_ALL_SUBMITTED_PROTECTION_BY_USER_AND_ACTION, { | ||
user: user.toLowerCase(), | ||
action: action.toLowerCase(), | ||
}); | ||
if (!data) | ||
throw new Error("getSubmittedProtectionByUser: NO DATA"); | ||
throw new Error("getSubmittedProtectionByUserAndAction: NO DATA"); | ||
if (!data.protections) | ||
throw new Error("getSubmittedProtectionByUser: NO PROTECTIONS FIELD"); | ||
throw new Error("getSubmittedProtectionByUserAndAction: NO PROTECTIONS FIELD"); | ||
return data.protections; | ||
}); | ||
exports.getSubmittedProtectionByUser = getSubmittedProtectionByUser; | ||
exports.getSubmittedProtectionByUserAndAction = getSubmittedProtectionByUserAndAction; | ||
const getCancelledProtectionByUser = (user) => __awaiter(void 0, void 0, void 0, function* () { | ||
@@ -39,12 +40,13 @@ const data = yield graphql_request_1.request(constants_1.subgraphUrl, graphql_1.GET_ALL_CANCELLED_PROTECTION_BY_USER, { | ||
exports.getCancelledProtectionByUser = getCancelledProtectionByUser; | ||
const getExecutedProtectionByUser = (user) => __awaiter(void 0, void 0, void 0, function* () { | ||
const data = yield graphql_request_1.request(constants_1.subgraphUrl, graphql_1.GET_ALL_EXECUTED_PROTECTION_BY_USER, { | ||
const getExecutedProtectionByUserAndAction = (user, action) => __awaiter(void 0, void 0, void 0, function* () { | ||
const data = yield graphql_request_1.request(constants_1.subgraphUrl, graphql_1.GET_ALL_EXECUTED_PROTECTION_BY_USER_AND_ACTION, { | ||
user: user.toLowerCase(), | ||
action: action.toLowerCase(), | ||
}); | ||
if (!data) | ||
throw new Error("getExecutedProtectionByUser: NO DATA"); | ||
throw new Error("getExecutedProtectionByUserAndAction: NO DATA"); | ||
if (!data.protections) | ||
throw new Error("getExecutedProtectionByUser: NO PROTECTIONS FIELD"); | ||
throw new Error("getExecutedProtectionByUserAndAction: NO PROTECTIONS FIELD"); | ||
return data.protections; | ||
}); | ||
exports.getExecutedProtectionByUser = getExecutedProtectionByUser; | ||
exports.getExecutedProtectionByUserAndAction = getExecutedProtectionByUserAndAction; |
{ | ||
"name": "@gelatonetwork/aave-protection-lib", | ||
"version": "1.9.1", | ||
"version": "1.9.2", | ||
"description": "Aave Automated protection library for submitting and reading task.", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
163252
4715