@curvefi/llamalend-api 1.0.3 → 1.0.6
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/.github/workflows/lint.yml +2 -2
- package/.github/workflows/publish.yml +11 -7
- package/eslint.config.mjs +87 -0
- package/lib/cache/index.js +18 -19
- package/lib/constants/L2Networks.js +1 -1
- package/lib/constants/abis/crvUSD/controller_v2.json +979 -0
- package/lib/constants/aliases.js +34 -34
- package/lib/constants/coins.js +16 -16
- package/lib/constants/llammas.js +1 -1
- package/lib/constants/utils.js +8 -10
- package/lib/external-api.d.ts +8 -6
- package/lib/external-api.js +136 -397
- package/lib/index.d.ts +9 -10
- package/lib/index.js +46 -81
- package/lib/interfaces.d.ts +2 -20
- package/lib/lendMarkets/LendMarketTemplate.js +2438 -4419
- package/lib/lendMarkets/lendMarketConstructor.js +2 -2
- package/lib/llamalend.js +511 -696
- package/lib/mintMarkets/MintMarketTemplate.js +1469 -2799
- package/lib/mintMarkets/mintMarketConstructor.js +1 -1
- package/lib/st-crvUSD.js +172 -488
- package/lib/utils.d.ts +2 -2
- package/lib/utils.js +318 -548
- package/package.json +21 -16
- package/src/cache/index.ts +1 -0
- package/src/constants/abis/crvUSD/controller_v2.json +979 -0
- package/src/constants/aliases.ts +7 -7
- package/src/external-api.ts +25 -148
- package/src/interfaces.ts +2 -21
- package/src/lendMarkets/LendMarketTemplate.ts +31 -6
- package/src/llamalend.ts +36 -6
- package/src/mintMarkets/MintMarketTemplate.ts +2 -2
- package/src/utils.ts +8 -8
- package/tsconfig.json +1 -1
- package/.eslintrc.json +0 -40
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
steps:
|
|
13
13
|
- name: Checkout code
|
|
14
|
-
uses: actions/checkout@
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
15
|
- name: get-npm-version
|
|
16
16
|
id: package-version
|
|
17
17
|
uses: martinbeentjes/npm-get-version-action@main
|
|
@@ -38,18 +38,22 @@ jobs:
|
|
|
38
38
|
|
|
39
39
|
publish:
|
|
40
40
|
runs-on: ubuntu-latest
|
|
41
|
+
permissions:
|
|
42
|
+
contents: read
|
|
43
|
+
id-token: write
|
|
41
44
|
steps:
|
|
42
|
-
- uses: actions/checkout@
|
|
43
|
-
- name: Setup
|
|
44
|
-
uses: actions/setup-node@
|
|
45
|
+
- uses: actions/checkout@v4
|
|
46
|
+
- name: Setup node version
|
|
47
|
+
uses: actions/setup-node@v4
|
|
45
48
|
with:
|
|
46
|
-
node-version: '
|
|
49
|
+
node-version: '22'
|
|
50
|
+
cache: npm
|
|
47
51
|
registry-url: 'https://registry.npmjs.org'
|
|
48
52
|
- name: Install modules
|
|
49
|
-
run: npm
|
|
53
|
+
run: npm ci
|
|
50
54
|
- name: Build
|
|
51
55
|
run: npm run build
|
|
52
56
|
- name: Publish to npm
|
|
53
57
|
run: npm publish --access public
|
|
54
58
|
env:
|
|
55
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
59
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { defineConfig } from "eslint/config";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import parser from "vue-eslint-parser";
|
|
4
|
+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
|
5
|
+
import tsParser from "@typescript-eslint/parser";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import js from "@eslint/js";
|
|
9
|
+
import { FlatCompat } from "@eslint/eslintrc";
|
|
10
|
+
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = path.dirname(__filename);
|
|
13
|
+
const compat = new FlatCompat({
|
|
14
|
+
baseDirectory: __dirname,
|
|
15
|
+
recommendedConfig: js.configs.recommended,
|
|
16
|
+
allConfig: js.configs.all
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default defineConfig([{
|
|
20
|
+
extends: compat.extends("eslint:recommended"),
|
|
21
|
+
|
|
22
|
+
languageOptions: {
|
|
23
|
+
globals: {
|
|
24
|
+
...globals.browser,
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
parser: parser,
|
|
28
|
+
ecmaVersion: 5,
|
|
29
|
+
sourceType: "module",
|
|
30
|
+
|
|
31
|
+
parserOptions: {
|
|
32
|
+
parser: "babel-eslint",
|
|
33
|
+
allowImportExportEverywhere: false,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
rules: {
|
|
38
|
+
"func-names": 0,
|
|
39
|
+
"no-nested-ternary": 0,
|
|
40
|
+
"max-len": 0,
|
|
41
|
+
"arrow-parens": ["error", "always"],
|
|
42
|
+
"no-underscore-dangle": 0,
|
|
43
|
+
|
|
44
|
+
"comma-dangle": ["error", {
|
|
45
|
+
arrays: "always-multiline",
|
|
46
|
+
objects: "always-multiline",
|
|
47
|
+
imports: "always-multiline",
|
|
48
|
+
exports: "always-multiline",
|
|
49
|
+
functions: "never",
|
|
50
|
+
}],
|
|
51
|
+
|
|
52
|
+
"no-use-before-define": ["error", "nofunc"],
|
|
53
|
+
|
|
54
|
+
"no-empty": ["error", {
|
|
55
|
+
allowEmptyCatch: true,
|
|
56
|
+
}],
|
|
57
|
+
|
|
58
|
+
"no-mixed-operators": ["error", {
|
|
59
|
+
allowSamePrecedence: true,
|
|
60
|
+
}],
|
|
61
|
+
|
|
62
|
+
indent: ["error", 4, {
|
|
63
|
+
flatTernaryExpressions: true,
|
|
64
|
+
SwitchCase: 1,
|
|
65
|
+
}],
|
|
66
|
+
},
|
|
67
|
+
}, {
|
|
68
|
+
files: ["**/*.ts"],
|
|
69
|
+
|
|
70
|
+
extends: compat.extends(
|
|
71
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
72
|
+
"plugin:@typescript-eslint/recommended",
|
|
73
|
+
),
|
|
74
|
+
|
|
75
|
+
plugins: {
|
|
76
|
+
"@typescript-eslint": typescriptEslint,
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
languageOptions: {
|
|
80
|
+
parser: tsParser,
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
rules: {
|
|
84
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
85
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
86
|
+
},
|
|
87
|
+
}]);
|
package/lib/cache/index.js
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
class Cache {
|
|
2
|
+
constructor() {
|
|
3
3
|
this.cache = new Map();
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
static getInstance() {
|
|
6
6
|
if (!Cache.instance) {
|
|
7
7
|
Cache.instance = new Cache();
|
|
8
8
|
}
|
|
9
9
|
return Cache.instance;
|
|
10
|
-
}
|
|
11
|
-
|
|
10
|
+
}
|
|
11
|
+
set(key, value) {
|
|
12
12
|
this.cache.set(key, value);
|
|
13
|
-
}
|
|
14
|
-
|
|
13
|
+
}
|
|
14
|
+
get(key) {
|
|
15
15
|
return this.cache.get(key);
|
|
16
|
-
}
|
|
17
|
-
|
|
16
|
+
}
|
|
17
|
+
has(key) {
|
|
18
18
|
return this.cache.has(key);
|
|
19
|
-
}
|
|
20
|
-
|
|
19
|
+
}
|
|
20
|
+
printCache() {
|
|
21
21
|
console.log(this.cache);
|
|
22
|
-
}
|
|
23
|
-
|
|
22
|
+
}
|
|
23
|
+
clear() {
|
|
24
24
|
this.cache.clear();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return "".concat(contractAddress, "-").concat(methodName, "-").concat(param ? param : '|');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export const cacheKey = (contractAddress, methodName, param) => {
|
|
28
|
+
return `${contractAddress}-${methodName}-${param ? param : '|'}`;
|
|
30
29
|
};
|
|
31
|
-
export
|
|
30
|
+
export const cacheStats = Cache.getInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const L2Networks = [10, 8453]; // 42161 (arbitrum) is L2 network, but does not need a change to estimateGas.
|