@lit-protocol/vincent-ability-aave 0.0.7-mma
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +90 -0
- package/README.md +113 -0
- package/dist/CONTRIBUTING.md +90 -0
- package/dist/README.md +113 -0
- package/dist/package.json +31 -0
- package/dist/src/generated/lit-action.js +9 -0
- package/dist/src/generated/vincent-ability-metadata.json +3 -0
- package/dist/src/generated/vincent-bundled-ability.d.ts +92 -0
- package/dist/src/generated/vincent-bundled-ability.d.ts.map +1 -0
- package/dist/src/generated/vincent-bundled-ability.js +15 -0
- package/dist/src/generated/vincent-bundled-ability.js.map +1 -0
- package/dist/src/generated/vincent-bundled-ability.ts +13 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/helpers/index.d.ts +71 -0
- package/dist/src/lib/helpers/index.d.ts.map +1 -0
- package/dist/src/lib/helpers/index.js +345 -0
- package/dist/src/lib/helpers/index.js.map +1 -0
- package/dist/src/lib/lit-action.d.ts +2 -0
- package/dist/src/lib/lit-action.d.ts.map +1 -0
- package/dist/src/lib/lit-action.js +15 -0
- package/dist/src/lib/lit-action.js.map +1 -0
- package/dist/src/lib/schemas.d.ts +118 -0
- package/dist/src/lib/schemas.d.ts.map +1 -0
- package/dist/src/lib/schemas.js +115 -0
- package/dist/src/lib/schemas.js.map +1 -0
- package/dist/src/lib/vincent-ability.d.ts +90 -0
- package/dist/src/lib/vincent-ability.d.ts.map +1 -0
- package/dist/src/lib/vincent-ability.js +352 -0
- package/dist/src/lib/vincent-ability.js.map +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT EDIT THIS FILE. IT IS GENERATED ON BUILD.
|
|
3
|
+
*/
|
|
4
|
+
export declare const bundledVincentAbility: import("@lit-protocol/vincent-ability-sdk").BundledVincentAbility<import("@lit-protocol/vincent-ability-sdk").VincentAbility<import("zod").ZodObject<{
|
|
5
|
+
operation: import("zod").ZodNativeEnum<typeof import("../lib/schemas").AaveOperation>;
|
|
6
|
+
asset: import("zod").ZodString;
|
|
7
|
+
amount: import("zod").ZodEffects<import("zod").ZodString, string, string>;
|
|
8
|
+
interestRateMode: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
9
|
+
onBehalfOf: import("zod").ZodOptional<import("zod").ZodString>;
|
|
10
|
+
chain: import("zod").ZodEffects<import("zod").ZodString, string, string>;
|
|
11
|
+
rpcUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
12
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
13
|
+
asset: string;
|
|
14
|
+
amount: string;
|
|
15
|
+
operation: import("../lib/schemas").AaveOperation;
|
|
16
|
+
chain: string;
|
|
17
|
+
onBehalfOf?: string | undefined;
|
|
18
|
+
interestRateMode?: number | undefined;
|
|
19
|
+
rpcUrl?: string | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
asset: string;
|
|
22
|
+
amount: string;
|
|
23
|
+
operation: import("../lib/schemas").AaveOperation;
|
|
24
|
+
chain: string;
|
|
25
|
+
onBehalfOf?: string | undefined;
|
|
26
|
+
interestRateMode?: number | undefined;
|
|
27
|
+
rpcUrl?: string | undefined;
|
|
28
|
+
}>, string, import("node_modules/@lit-protocol/vincent-ability-sdk/dist/src/lib/abilityCore/helpers").AbilityPolicyMap<readonly [], never>, {}, import("zod").ZodObject<{
|
|
29
|
+
txHash: import("zod").ZodString;
|
|
30
|
+
operation: import("zod").ZodNativeEnum<typeof import("../lib/schemas").AaveOperation>;
|
|
31
|
+
asset: import("zod").ZodString;
|
|
32
|
+
amount: import("zod").ZodString;
|
|
33
|
+
timestamp: import("zod").ZodNumber;
|
|
34
|
+
interestRateMode: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
35
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
36
|
+
asset: string;
|
|
37
|
+
amount: string;
|
|
38
|
+
operation: import("../lib/schemas").AaveOperation;
|
|
39
|
+
txHash: string;
|
|
40
|
+
timestamp: number;
|
|
41
|
+
interestRateMode?: number | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
asset: string;
|
|
44
|
+
amount: string;
|
|
45
|
+
operation: import("../lib/schemas").AaveOperation;
|
|
46
|
+
txHash: string;
|
|
47
|
+
timestamp: number;
|
|
48
|
+
interestRateMode?: number | undefined;
|
|
49
|
+
}>, import("zod").ZodObject<{
|
|
50
|
+
error: import("zod").ZodString;
|
|
51
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
52
|
+
error: string;
|
|
53
|
+
}, {
|
|
54
|
+
error: string;
|
|
55
|
+
}>, import("zod").ZodObject<{
|
|
56
|
+
operationValid: import("zod").ZodBoolean;
|
|
57
|
+
assetValid: import("zod").ZodBoolean;
|
|
58
|
+
amountValid: import("zod").ZodBoolean;
|
|
59
|
+
userBalance: import("zod").ZodOptional<import("zod").ZodString>;
|
|
60
|
+
allowance: import("zod").ZodOptional<import("zod").ZodString>;
|
|
61
|
+
borrowCapacity: import("zod").ZodOptional<import("zod").ZodString>;
|
|
62
|
+
estimatedGas: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
63
|
+
availableMarkets: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
64
|
+
supportedChains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
65
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
66
|
+
operationValid: boolean;
|
|
67
|
+
assetValid: boolean;
|
|
68
|
+
amountValid: boolean;
|
|
69
|
+
allowance?: string | undefined;
|
|
70
|
+
userBalance?: string | undefined;
|
|
71
|
+
borrowCapacity?: string | undefined;
|
|
72
|
+
estimatedGas?: number | undefined;
|
|
73
|
+
availableMarkets?: Record<string, string> | undefined;
|
|
74
|
+
supportedChains?: string[] | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
operationValid: boolean;
|
|
77
|
+
assetValid: boolean;
|
|
78
|
+
amountValid: boolean;
|
|
79
|
+
allowance?: string | undefined;
|
|
80
|
+
userBalance?: string | undefined;
|
|
81
|
+
borrowCapacity?: string | undefined;
|
|
82
|
+
estimatedGas?: number | undefined;
|
|
83
|
+
availableMarkets?: Record<string, string> | undefined;
|
|
84
|
+
supportedChains?: string[] | undefined;
|
|
85
|
+
}>, import("zod").ZodObject<{
|
|
86
|
+
error: import("zod").ZodString;
|
|
87
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
88
|
+
error: string;
|
|
89
|
+
}, {
|
|
90
|
+
error: string;
|
|
91
|
+
}>>, string>;
|
|
92
|
+
//# sourceMappingURL=vincent-bundled-ability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vincent-bundled-ability.d.ts","sourceRoot":"","sources":["../../../src/generated/vincent-bundled-ability.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAA4D,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DO NOT EDIT THIS FILE. IT IS GENERATED ON BUILD.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.bundledVincentAbility = void 0;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const vincent_ability_sdk_1 = require("@lit-protocol/vincent-ability-sdk");
|
|
9
|
+
const vincent_ability_1 = require("../lib/vincent-ability");
|
|
10
|
+
const vincent_ability_metadata_json_1 = tslib_1.__importDefault(require("./vincent-ability-metadata.json"));
|
|
11
|
+
if (!vincent_ability_metadata_json_1.default.ipfsCid) {
|
|
12
|
+
throw new Error('ipfsCid is not defined in metadata JSON file');
|
|
13
|
+
}
|
|
14
|
+
exports.bundledVincentAbility = (0, vincent_ability_sdk_1.asBundledVincentAbility)(vincent_ability_1.vincentAbility, vincent_ability_metadata_json_1.default.ipfsCid);
|
|
15
|
+
//# sourceMappingURL=vincent-bundled-ability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vincent-bundled-ability.js","sourceRoot":"","sources":["../../../src/generated/vincent-bundled-ability.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,2EAA4E;AAC5E,4DAAwD;AACxD,4GAAuD;AAEvD,IAAG,CAAC,uCAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;AAClE,CAAC;AAEY,QAAA,qBAAqB,GAAG,IAAA,6CAAuB,EAAC,gCAAc,EAAE,uCAAQ,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT EDIT THIS FILE. IT IS GENERATED ON BUILD.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { asBundledVincentAbility } from '@lit-protocol/vincent-ability-sdk';
|
|
6
|
+
import { vincentAbility } from '../lib/vincent-ability';
|
|
7
|
+
import metadata from './vincent-ability-metadata.json';
|
|
8
|
+
|
|
9
|
+
if(!metadata.ipfsCid) {
|
|
10
|
+
throw new Error('ipfsCid is not defined in metadata JSON file');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const bundledVincentAbility = asBundledVincentAbility(vincentAbility, metadata.ipfsCid);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bundledVincentAbility = void 0;
|
|
4
|
+
var vincent_bundled_ability_1 = require("./generated/vincent-bundled-ability");
|
|
5
|
+
Object.defineProperty(exports, "bundledVincentAbility", { enumerable: true, get: function () { return vincent_bundled_ability_1.bundledVincentAbility; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,+EAA4E;AAAnE,gIAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test token addresses indexed by chain name
|
|
3
|
+
*/
|
|
4
|
+
export declare const TEST_TOKENS: Record<string, Record<string, string>>;
|
|
5
|
+
export declare const CHAIN_IDS: {
|
|
6
|
+
readonly sepolia: 11155111;
|
|
7
|
+
readonly base: 8453;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* AAVE v3 Pool Contract ABI - Essential methods only
|
|
11
|
+
*/
|
|
12
|
+
export declare const AAVE_POOL_ABI: any[];
|
|
13
|
+
/**
|
|
14
|
+
* ERC20 Token ABI - Essential methods only
|
|
15
|
+
*/
|
|
16
|
+
export declare const ERC20_ABI: any[];
|
|
17
|
+
/**
|
|
18
|
+
* Interest Rate Modes for AAVE
|
|
19
|
+
*/
|
|
20
|
+
export declare const INTEREST_RATE_MODE: {
|
|
21
|
+
readonly NONE: 0;
|
|
22
|
+
readonly STABLE: 1;
|
|
23
|
+
readonly VARIABLE: 2;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Chain name to Aave Address Book mapping
|
|
27
|
+
*/
|
|
28
|
+
export declare const CHAIN_TO_AAVE_ADDRESS_BOOK: Record<string, () => any>;
|
|
29
|
+
/**
|
|
30
|
+
* Supported chain names
|
|
31
|
+
*/
|
|
32
|
+
export type SupportedChain = keyof typeof CHAIN_TO_AAVE_ADDRESS_BOOK;
|
|
33
|
+
/**
|
|
34
|
+
* Get AAVE addresses for a specific chain using the Aave Address Book
|
|
35
|
+
*/
|
|
36
|
+
export declare function getAaveAddresses(chain: string): {
|
|
37
|
+
POOL: any;
|
|
38
|
+
POOL_ADDRESSES_PROVIDER: any;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Get test token addresses for a specific chain
|
|
42
|
+
*/
|
|
43
|
+
export declare function getTestTokens(chain: string): Record<string, string>;
|
|
44
|
+
/**
|
|
45
|
+
* Get available markets (asset addresses) for a specific chain using the Aave Address Book
|
|
46
|
+
*/
|
|
47
|
+
export declare function getAvailableMarkets(chain: string): Record<string, string>;
|
|
48
|
+
/**
|
|
49
|
+
* Get all supported chains
|
|
50
|
+
*/
|
|
51
|
+
export declare function getSupportedChains(): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Utility function to validate Ethereum address
|
|
54
|
+
*/
|
|
55
|
+
export declare function isValidAddress(address: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Utility function to parse amount with decimals
|
|
58
|
+
*/
|
|
59
|
+
export declare function parseAmount(amount: string, decimals?: number): string;
|
|
60
|
+
/**
|
|
61
|
+
* Utility function to format amount from wei
|
|
62
|
+
*/
|
|
63
|
+
export declare function formatAmount(amount: string, decimals?: number): string;
|
|
64
|
+
/**
|
|
65
|
+
* Validate operation-specific requirements
|
|
66
|
+
*/
|
|
67
|
+
export declare function validateOperationRequirements(operation: string, userBalance: string, allowance: string, borrowCapacity: string, convertedAmount: string, _interestRateMode?: number): Promise<{
|
|
68
|
+
valid: boolean;
|
|
69
|
+
error?: string;
|
|
70
|
+
}>;
|
|
71
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/helpers/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE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AAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAmE7C"}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHAIN_TO_AAVE_ADDRESS_BOOK = exports.INTEREST_RATE_MODE = exports.ERC20_ABI = exports.AAVE_POOL_ABI = exports.CHAIN_IDS = exports.TEST_TOKENS = void 0;
|
|
4
|
+
exports.getAaveAddresses = getAaveAddresses;
|
|
5
|
+
exports.getTestTokens = getTestTokens;
|
|
6
|
+
exports.getAvailableMarkets = getAvailableMarkets;
|
|
7
|
+
exports.getSupportedChains = getSupportedChains;
|
|
8
|
+
exports.isValidAddress = isValidAddress;
|
|
9
|
+
exports.parseAmount = parseAmount;
|
|
10
|
+
exports.formatAmount = formatAmount;
|
|
11
|
+
exports.validateOperationRequirements = validateOperationRequirements;
|
|
12
|
+
const ethers_1 = require("ethers");
|
|
13
|
+
/**
|
|
14
|
+
* Test token addresses indexed by chain name
|
|
15
|
+
*/
|
|
16
|
+
exports.TEST_TOKENS = {
|
|
17
|
+
sepolia: {
|
|
18
|
+
USDC: '0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8',
|
|
19
|
+
WETH: '0xC558DBdd856501FCd9aaF1E62eae57A9F0629a3c',
|
|
20
|
+
USDT: '0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0',
|
|
21
|
+
AAVE: '0x88541670E55cC00bEEFD87eB59EDd1b7C511AC9a',
|
|
22
|
+
WBTC: '0x29f2D40B0605204364af54EC677bD022dA425d03',
|
|
23
|
+
},
|
|
24
|
+
base: {
|
|
25
|
+
USDC: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
26
|
+
WETH: '0x4200000000000000000000000000000000000006',
|
|
27
|
+
USDT: '0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2',
|
|
28
|
+
AAVE: '0xEB4c2781e4ebA804CE9a9803C67d0893436bB27D',
|
|
29
|
+
WBTC: '0x0555E30da8f98308EdB960aa94C0Db47230d2B9c',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
exports.CHAIN_IDS = {
|
|
33
|
+
sepolia: 11155111,
|
|
34
|
+
base: 8453,
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* AAVE v3 Pool Contract ABI - Essential methods only
|
|
38
|
+
*/
|
|
39
|
+
exports.AAVE_POOL_ABI = [
|
|
40
|
+
// Supply
|
|
41
|
+
{
|
|
42
|
+
inputs: [
|
|
43
|
+
{ internalType: 'address', name: 'asset', type: 'address' },
|
|
44
|
+
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
|
|
45
|
+
{ internalType: 'address', name: 'onBehalfOf', type: 'address' },
|
|
46
|
+
{ internalType: 'uint16', name: 'referralCode', type: 'uint16' },
|
|
47
|
+
],
|
|
48
|
+
name: 'supply',
|
|
49
|
+
outputs: [],
|
|
50
|
+
stateMutability: 'nonpayable',
|
|
51
|
+
type: 'function',
|
|
52
|
+
},
|
|
53
|
+
// Withdraw
|
|
54
|
+
{
|
|
55
|
+
inputs: [
|
|
56
|
+
{ internalType: 'address', name: 'asset', type: 'address' },
|
|
57
|
+
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
|
|
58
|
+
{ internalType: 'address', name: 'to', type: 'address' },
|
|
59
|
+
],
|
|
60
|
+
name: 'withdraw',
|
|
61
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
62
|
+
stateMutability: 'nonpayable',
|
|
63
|
+
type: 'function',
|
|
64
|
+
},
|
|
65
|
+
// Borrow
|
|
66
|
+
{
|
|
67
|
+
inputs: [
|
|
68
|
+
{ internalType: 'address', name: 'asset', type: 'address' },
|
|
69
|
+
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
|
|
70
|
+
{ internalType: 'uint256', name: 'interestRateMode', type: 'uint256' },
|
|
71
|
+
{ internalType: 'uint16', name: 'referralCode', type: 'uint16' },
|
|
72
|
+
{ internalType: 'address', name: 'onBehalfOf', type: 'address' },
|
|
73
|
+
],
|
|
74
|
+
name: 'borrow',
|
|
75
|
+
outputs: [],
|
|
76
|
+
stateMutability: 'nonpayable',
|
|
77
|
+
type: 'function',
|
|
78
|
+
},
|
|
79
|
+
// Repay
|
|
80
|
+
{
|
|
81
|
+
inputs: [
|
|
82
|
+
{ internalType: 'address', name: 'asset', type: 'address' },
|
|
83
|
+
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
|
|
84
|
+
{ internalType: 'uint256', name: 'interestRateMode', type: 'uint256' },
|
|
85
|
+
{ internalType: 'address', name: 'onBehalfOf', type: 'address' },
|
|
86
|
+
],
|
|
87
|
+
name: 'repay',
|
|
88
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
89
|
+
stateMutability: 'nonpayable',
|
|
90
|
+
type: 'function',
|
|
91
|
+
},
|
|
92
|
+
// getUserAccountData
|
|
93
|
+
{
|
|
94
|
+
inputs: [{ internalType: 'address', name: 'user', type: 'address' }],
|
|
95
|
+
name: 'getUserAccountData',
|
|
96
|
+
outputs: [
|
|
97
|
+
{ internalType: 'uint256', name: 'totalCollateralBase', type: 'uint256' },
|
|
98
|
+
{ internalType: 'uint256', name: 'totalDebtBase', type: 'uint256' },
|
|
99
|
+
{
|
|
100
|
+
internalType: 'uint256',
|
|
101
|
+
name: 'availableBorrowsBase',
|
|
102
|
+
type: 'uint256',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
internalType: 'uint256',
|
|
106
|
+
name: 'currentLiquidationThreshold',
|
|
107
|
+
type: 'uint256',
|
|
108
|
+
},
|
|
109
|
+
{ internalType: 'uint256', name: 'ltv', type: 'uint256' },
|
|
110
|
+
{ internalType: 'uint256', name: 'healthFactor', type: 'uint256' },
|
|
111
|
+
],
|
|
112
|
+
stateMutability: 'view',
|
|
113
|
+
type: 'function',
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
/**
|
|
117
|
+
* ERC20 Token ABI - Essential methods only
|
|
118
|
+
*/
|
|
119
|
+
exports.ERC20_ABI = [
|
|
120
|
+
{
|
|
121
|
+
inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
|
|
122
|
+
name: 'balanceOf',
|
|
123
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
124
|
+
stateMutability: 'view',
|
|
125
|
+
type: 'function',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
inputs: [
|
|
129
|
+
{ internalType: 'address', name: 'owner', type: 'address' },
|
|
130
|
+
{ internalType: 'address', name: 'spender', type: 'address' },
|
|
131
|
+
],
|
|
132
|
+
name: 'allowance',
|
|
133
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
134
|
+
stateMutability: 'view',
|
|
135
|
+
type: 'function',
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
inputs: [
|
|
139
|
+
{ internalType: 'address', name: 'spender', type: 'address' },
|
|
140
|
+
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
|
|
141
|
+
],
|
|
142
|
+
name: 'approve',
|
|
143
|
+
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
|
|
144
|
+
stateMutability: 'nonpayable',
|
|
145
|
+
type: 'function',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
inputs: [],
|
|
149
|
+
name: 'decimals',
|
|
150
|
+
outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }],
|
|
151
|
+
stateMutability: 'view',
|
|
152
|
+
type: 'function',
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
/**
|
|
156
|
+
* Interest Rate Modes for AAVE
|
|
157
|
+
*/
|
|
158
|
+
exports.INTEREST_RATE_MODE = {
|
|
159
|
+
NONE: 0,
|
|
160
|
+
STABLE: 1,
|
|
161
|
+
VARIABLE: 2,
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Chain name to Aave Address Book mapping
|
|
165
|
+
*/
|
|
166
|
+
exports.CHAIN_TO_AAVE_ADDRESS_BOOK = {
|
|
167
|
+
// Mainnets
|
|
168
|
+
ethereum: () => require('@bgd-labs/aave-address-book').AaveV3Ethereum,
|
|
169
|
+
polygon: () => require('@bgd-labs/aave-address-book').AaveV3Polygon,
|
|
170
|
+
avalanche: () => require('@bgd-labs/aave-address-book').AaveV3Avalanche,
|
|
171
|
+
arbitrum: () => require('@bgd-labs/aave-address-book').AaveV3Arbitrum,
|
|
172
|
+
optimism: () => require('@bgd-labs/aave-address-book').AaveV3Optimism,
|
|
173
|
+
base: () => require('@bgd-labs/aave-address-book').AaveV3Base,
|
|
174
|
+
fantom: () => require('@bgd-labs/aave-address-book').AaveV3Fantom,
|
|
175
|
+
bnb: () => require('@bgd-labs/aave-address-book').AaveV3BNB,
|
|
176
|
+
gnosis: () => require('@bgd-labs/aave-address-book').AaveV3Gnosis,
|
|
177
|
+
scroll: () => require('@bgd-labs/aave-address-book').AaveV3Scroll,
|
|
178
|
+
metis: () => require('@bgd-labs/aave-address-book').AaveV3Metis,
|
|
179
|
+
linea: () => require('@bgd-labs/aave-address-book').AaveV3Linea,
|
|
180
|
+
zksync: () => require('@bgd-labs/aave-address-book').AaveV3ZkSync,
|
|
181
|
+
// Testnets
|
|
182
|
+
sepolia: () => require('@bgd-labs/aave-address-book').AaveV3Sepolia,
|
|
183
|
+
basesepolia: () => require('@bgd-labs/aave-address-book').AaveV3BaseSepolia,
|
|
184
|
+
arbitrumsepolia: () => require('@bgd-labs/aave-address-book').AaveV3ArbitrumSepolia,
|
|
185
|
+
optimismsepolia: () => require('@bgd-labs/aave-address-book').AaveV3OptimismSepolia,
|
|
186
|
+
avalanchefuji: () => require('@bgd-labs/aave-address-book').AaveV3AvalancheFuji,
|
|
187
|
+
scrollsepolia: () => require('@bgd-labs/aave-address-book').AaveV3ScrollSepolia,
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Get AAVE addresses for a specific chain using the Aave Address Book
|
|
191
|
+
*/
|
|
192
|
+
function getAaveAddresses(chain) {
|
|
193
|
+
const chainKey = chain.toLowerCase();
|
|
194
|
+
// First try to get from the official Address Book
|
|
195
|
+
if (chainKey in exports.CHAIN_TO_AAVE_ADDRESS_BOOK) {
|
|
196
|
+
try {
|
|
197
|
+
const addressBook = exports.CHAIN_TO_AAVE_ADDRESS_BOOK[chainKey]();
|
|
198
|
+
return {
|
|
199
|
+
POOL: addressBook.POOL,
|
|
200
|
+
POOL_ADDRESSES_PROVIDER: addressBook.POOL_ADDRESSES_PROVIDER,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
console.warn(`Failed to load from Address Book for ${chain}:`, error);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
throw new Error(`Unsupported chain: ${chain}. Supported chains: ${[
|
|
208
|
+
...Object.keys(exports.CHAIN_TO_AAVE_ADDRESS_BOOK),
|
|
209
|
+
].join(', ')}`);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Get test token addresses for a specific chain
|
|
213
|
+
*/
|
|
214
|
+
function getTestTokens(chain) {
|
|
215
|
+
const chainKey = chain.toLowerCase();
|
|
216
|
+
if (!(chainKey in exports.TEST_TOKENS)) {
|
|
217
|
+
throw new Error(`Unsupported chain: ${chain}. Supported chains: ${Object.keys(exports.TEST_TOKENS).join(', ')}`);
|
|
218
|
+
}
|
|
219
|
+
return exports.TEST_TOKENS[chainKey];
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Get available markets (asset addresses) for a specific chain using the Aave Address Book
|
|
223
|
+
*/
|
|
224
|
+
function getAvailableMarkets(chain) {
|
|
225
|
+
const chainKey = chain.toLowerCase();
|
|
226
|
+
// First try to get from the official Address Book
|
|
227
|
+
if (chainKey in exports.CHAIN_TO_AAVE_ADDRESS_BOOK) {
|
|
228
|
+
try {
|
|
229
|
+
const addressBook = exports.CHAIN_TO_AAVE_ADDRESS_BOOK[chainKey]();
|
|
230
|
+
const markets = {};
|
|
231
|
+
// Extract asset addresses from the address book
|
|
232
|
+
// The address book contains ASSETS object with token addresses
|
|
233
|
+
if (addressBook.ASSETS) {
|
|
234
|
+
Object.keys(addressBook.ASSETS).forEach((assetKey) => {
|
|
235
|
+
const asset = addressBook.ASSETS[assetKey];
|
|
236
|
+
if (asset.UNDERLYING) {
|
|
237
|
+
markets[assetKey] = asset.UNDERLYING;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
return markets;
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
console.warn(`Failed to load markets from Address Book for ${chain}:`, error);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// Fall back to hardcoded test tokens for backward compatibility
|
|
248
|
+
if (chainKey in exports.TEST_TOKENS) {
|
|
249
|
+
return exports.TEST_TOKENS[chainKey];
|
|
250
|
+
}
|
|
251
|
+
throw new Error(`No markets available for chain: ${chain}. Supported chains: ${[
|
|
252
|
+
...Object.keys(exports.CHAIN_TO_AAVE_ADDRESS_BOOK),
|
|
253
|
+
...Object.keys(exports.TEST_TOKENS),
|
|
254
|
+
].join(', ')}`);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Get all supported chains
|
|
258
|
+
*/
|
|
259
|
+
function getSupportedChains() {
|
|
260
|
+
return [...Object.keys(exports.CHAIN_TO_AAVE_ADDRESS_BOOK)];
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Utility function to validate Ethereum address
|
|
264
|
+
*/
|
|
265
|
+
function isValidAddress(address) {
|
|
266
|
+
return /^0x[a-fA-F0-9]{40}$/.test(address);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Utility function to parse amount with decimals
|
|
270
|
+
*/
|
|
271
|
+
function parseAmount(amount, decimals = 18) {
|
|
272
|
+
return ethers_1.ethers.utils.parseUnits(amount, decimals).toString();
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Utility function to format amount from wei
|
|
276
|
+
*/
|
|
277
|
+
function formatAmount(amount, decimals = 18) {
|
|
278
|
+
return ethers_1.ethers.utils.formatUnits(amount, decimals);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Validate operation-specific requirements
|
|
282
|
+
*/
|
|
283
|
+
async function validateOperationRequirements(operation, userBalance, allowance, borrowCapacity, convertedAmount, _interestRateMode) {
|
|
284
|
+
const userBalanceBN = BigInt(userBalance);
|
|
285
|
+
const allowanceBN = BigInt(allowance);
|
|
286
|
+
const borrowCapacityBN = BigInt(borrowCapacity);
|
|
287
|
+
const convertedAmountBN = BigInt(convertedAmount);
|
|
288
|
+
switch (operation) {
|
|
289
|
+
case 'supply':
|
|
290
|
+
// Check if user has enough balance
|
|
291
|
+
if (userBalanceBN < convertedAmountBN) {
|
|
292
|
+
return {
|
|
293
|
+
valid: false,
|
|
294
|
+
error: `Insufficient balance for supply operation. You have ${userBalance} and need ${convertedAmount}`,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
// Check if user has approved AAVE to spend tokens
|
|
298
|
+
if (allowanceBN < convertedAmountBN) {
|
|
299
|
+
return {
|
|
300
|
+
valid: false,
|
|
301
|
+
error: `Insufficient allowance for supply operation. Please approve AAVE to spend your tokens first. You have ${allowance} and need ${convertedAmount}`,
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
break;
|
|
305
|
+
case 'withdraw':
|
|
306
|
+
// For withdraw, we need to check if user has enough aTokens (collateral)
|
|
307
|
+
// This would require checking aToken balance, but for now we'll just check if they have any collateral
|
|
308
|
+
if (borrowCapacityBN === 0n && userBalanceBN === 0n) {
|
|
309
|
+
return {
|
|
310
|
+
valid: false,
|
|
311
|
+
error: 'No collateral available for withdrawal',
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
break;
|
|
315
|
+
case 'borrow':
|
|
316
|
+
// Check if user has enough borrowing capacity
|
|
317
|
+
if (borrowCapacityBN < convertedAmountBN) {
|
|
318
|
+
return {
|
|
319
|
+
valid: false,
|
|
320
|
+
error: `Insufficient borrowing capacity. You have ${borrowCapacity} and need ${convertedAmount}`,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
break;
|
|
324
|
+
case 'repay':
|
|
325
|
+
// Check if user has enough balance to repay
|
|
326
|
+
if (userBalanceBN < convertedAmountBN) {
|
|
327
|
+
return {
|
|
328
|
+
valid: false,
|
|
329
|
+
error: `Insufficient balance for repay operation. You have ${userBalance} and need ${convertedAmount}`,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
// Check if user has approved AAVE to spend tokens for repayment
|
|
333
|
+
if (allowanceBN < convertedAmountBN) {
|
|
334
|
+
return {
|
|
335
|
+
valid: false,
|
|
336
|
+
error: `Insufficient allowance for repay operation. Please approve AAVE to spend your tokens first. You have ${allowance} and need ${convertedAmount}`,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
break;
|
|
340
|
+
default:
|
|
341
|
+
return { valid: false, error: `Unsupported operation: ${operation}` };
|
|
342
|
+
}
|
|
343
|
+
return { valid: true };
|
|
344
|
+
}
|
|
345
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/helpers/index.ts"],"names":[],"mappings":";;;AAoMA,4CAqBC;AAKD,sCAQC;AAKD,kDAqCC;AAKD,gDAEC;AAKD,wCAEC;AAKD,kCAEC;AAKD,oCAEC;AAKD,sEA0EC;AA3XD,mCAAgC;AAEhC;;GAEG;AACU,QAAA,WAAW,GAA2C;IACjE,OAAO,EAAE;QACP,IAAI,EAAE,4CAA4C;QAClD,IAAI,EAAE,4CAA4C;QAClD,IAAI,EAAE,4CAA4C;QAClD,IAAI,EAAE,4CAA4C;QAClD,IAAI,EAAE,4CAA4C;KACnD;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,4CAA4C;QAClD,IAAI,EAAE,4CAA4C;QACl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L,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,8CAA8C,cAAc,aAAa,eAAe,EAAE;iBAClG,CAAC;YACJ,CAAC;YACD,MAAM;QAER,KAAK,OAAO;YACV,4CAA4C;YAC5C,IAAI,aAAa,GAAG,iBAAiB,EAAE,CAAC;gBACtC,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,uDAAuD,WAAW,aAAa,eAAe,EAAE;iBACxG,CAAC;YACJ,CAAC;YACD,gEAAgE;YAChE,IAAI,WAAW,GAAG,iBAAiB,EAAE,CAAC;gBACpC,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,wGAAwG,SAAS,aAAa,eAAe,EAAE;iBACvJ,CAAC;YACJ,CAAC;YACD,MAAM;QAER;YACE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAA0B,SAAS,EAAE,EAAE,CAAC;IAC1E,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lit-action.d.ts","sourceRoot":"","sources":["../../../src/lib/lit-action.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vincent_ability_sdk_1 = require("@lit-protocol/vincent-ability-sdk");
|
|
4
|
+
const vincent_ability_1 = require("src/lib/vincent-ability");
|
|
5
|
+
(async () => {
|
|
6
|
+
const func = (0, vincent_ability_sdk_1.vincentAbilityHandler)({
|
|
7
|
+
vincentAbility: vincent_ability_1.vincentAbility,
|
|
8
|
+
context: {
|
|
9
|
+
delegatorPkpEthAddress: context.delegatorPkpEthAddress,
|
|
10
|
+
},
|
|
11
|
+
abilityParams,
|
|
12
|
+
});
|
|
13
|
+
await func();
|
|
14
|
+
})();
|
|
15
|
+
//# sourceMappingURL=lit-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lit-action.js","sourceRoot":"","sources":["../../../src/lib/lit-action.ts"],"names":[],"mappings":";;AAAA,2EAA0E;AAG1E,6DAAyD;AAUzD,CAAC,KAAK,IAAI,EAAE;IACV,MAAM,IAAI,GAAG,IAAA,2CAAqB,EAAC;QACjC,cAAc,EAAE,gCAAc;QAC9B,OAAO,EAAE;YACP,sBAAsB,EAAE,OAAO,CAAC,sBAAsB;SACvD;QACD,aAAa;KACd,CAAC,CAAC;IACH,MAAM,IAAI,EAAE,CAAC;AACf,CAAC,CAAC,EAAE,CAAC"}
|