@aave/cli 4.1.0-next.36 → 4.1.0-next.38

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/README.md CHANGED
@@ -20,7 +20,7 @@ $ npm install -g @aave/cli
20
20
  $ aave COMMAND
21
21
  running command...
22
22
  $ aave (--version)
23
- @aave/cli/4.1.0-next.35 darwin-arm64 node-v22.17.0
23
+ @aave/cli/4.1.0-next.37 darwin-arm64 node-v22.17.0
24
24
  $ aave --help [COMMAND]
25
25
  USAGE
26
26
  $ aave COMMAND
@@ -29,9 +29,33 @@ USAGE
29
29
  <!-- usagestop -->
30
30
  # Commands
31
31
  <!-- commands -->
32
+ * [`aave borrows list`](#aave-borrows-list)
32
33
  * [`aave hubs list`](#aave-hubs-list)
34
+ * [`aave positions list`](#aave-positions-list)
33
35
  * [`aave reserves list`](#aave-reserves-list)
34
36
  * [`aave spokes list`](#aave-spokes-list)
37
+ * [`aave supplies list`](#aave-supplies-list)
38
+
39
+ ## `aave borrows list`
40
+
41
+ List user borrows for a specific chain
42
+
43
+ ```
44
+ USAGE
45
+ $ aave borrows list --user <evm-address> -c <chain-id> [--json]
46
+
47
+ FLAGS
48
+ -c, --chain_id=<chain-id> (required) Chain ID to query borrows from
49
+ --user=<evm-address> (required) User address
50
+
51
+ GLOBAL FLAGS
52
+ --json Format output as json.
53
+
54
+ DESCRIPTION
55
+ List user borrows for a specific chain
56
+ ```
57
+
58
+ _See code: [src/commands/borrows/list.ts](https://github.com/aave/aave-v4-sdk/blob/v4.1.0-next.37/src/commands/borrows/list.ts)_
35
59
 
36
60
  ## `aave hubs list`
37
61
 
@@ -51,7 +75,28 @@ DESCRIPTION
51
75
  List Aave v4 liquidity hubs
52
76
  ```
53
77
 
54
- _See code: [src/commands/hubs/list.ts](https://github.com/aave/aave-v4-sdk/blob/v4.1.0-next.35/src/commands/hubs/list.ts)_
78
+ _See code: [src/commands/hubs/list.ts](https://github.com/aave/aave-v4-sdk/blob/v4.1.0-next.37/src/commands/hubs/list.ts)_
79
+
80
+ ## `aave positions list`
81
+
82
+ List user positions across chains
83
+
84
+ ```
85
+ USAGE
86
+ $ aave positions list --user <evm-address> -c <chain-id> [--json]
87
+
88
+ FLAGS
89
+ -c, --chain_id=<chain-id> (required) Filter by chain ID
90
+ --user=<evm-address> (required) User address
91
+
92
+ GLOBAL FLAGS
93
+ --json Format output as json.
94
+
95
+ DESCRIPTION
96
+ List user positions across chains
97
+ ```
98
+
99
+ _See code: [src/commands/positions/list.ts](https://github.com/aave/aave-v4-sdk/blob/v4.1.0-next.37/src/commands/positions/list.ts)_
55
100
 
56
101
  ## `aave reserves list`
57
102
 
@@ -74,7 +119,7 @@ DESCRIPTION
74
119
  List Aave v4 reserves
75
120
  ```
76
121
 
77
- _See code: [src/commands/reserves/list.ts](https://github.com/aave/aave-v4-sdk/blob/v4.1.0-next.35/src/commands/reserves/list.ts)_
122
+ _See code: [src/commands/reserves/list.ts](https://github.com/aave/aave-v4-sdk/blob/v4.1.0-next.37/src/commands/reserves/list.ts)_
78
123
 
79
124
  ## `aave spokes list`
80
125
 
@@ -96,5 +141,26 @@ DESCRIPTION
96
141
  List Aave v4 spokes
97
142
  ```
98
143
 
99
- _See code: [src/commands/spokes/list.ts](https://github.com/aave/aave-v4-sdk/blob/v4.1.0-next.35/src/commands/spokes/list.ts)_
144
+ _See code: [src/commands/spokes/list.ts](https://github.com/aave/aave-v4-sdk/blob/v4.1.0-next.37/src/commands/spokes/list.ts)_
145
+
146
+ ## `aave supplies list`
147
+
148
+ List user supplies for a specific chain
149
+
150
+ ```
151
+ USAGE
152
+ $ aave supplies list --user <evm-address> -c <chain-id> [--json]
153
+
154
+ FLAGS
155
+ -c, --chain_id=<chain-id> (required) Chain ID to query supplies from
156
+ --user=<evm-address> (required) User address
157
+
158
+ GLOBAL FLAGS
159
+ --json Format output as json.
160
+
161
+ DESCRIPTION
162
+ List user supplies for a specific chain
163
+ ```
164
+
165
+ _See code: [src/commands/supplies/list.ts](https://github.com/aave/aave-v4-sdk/blob/v4.1.0-next.37/src/commands/supplies/list.ts)_
100
166
  <!-- commandsstop -->
@@ -0,0 +1,14 @@
1
+ import { type ChainId, type EvmAddress, InvariantError, type UnexpectedError, type UserBorrowItem } from '@aave/client';
2
+ import * as common from '../../common.js';
3
+ export default class ListBorrows extends common.V4Command {
4
+ static description: string;
5
+ static flags: {
6
+ user: import("@oclif/core/interfaces").OptionFlag<EvmAddress, import("@oclif/core/interfaces").CustomOptions>;
7
+ chain_id: import("@oclif/core/interfaces").OptionFlag<ChainId, import("@oclif/core/interfaces").CustomOptions>;
8
+ };
9
+ headers: {
10
+ value: string;
11
+ }[];
12
+ private getBorrowsRequest;
13
+ run(): Promise<UserBorrowItem[] | InvariantError | UnexpectedError>;
14
+ }
@@ -0,0 +1,63 @@
1
+ import { InvariantError, invariant, ok, ResultAsync, } from '@aave/client';
2
+ import { userBorrows } from '@aave/client/actions';
3
+ import * as common from '../../common.js';
4
+ export default class ListBorrows extends common.V4Command {
5
+ static description = 'List user borrows for a specific chain';
6
+ static flags = {
7
+ user: common.address({
8
+ required: true,
9
+ description: 'User address',
10
+ }),
11
+ chain_id: common.chain({
12
+ required: true,
13
+ description: 'Chain ID to query borrows from',
14
+ }),
15
+ };
16
+ headers = [
17
+ { value: 'Asset' },
18
+ { value: 'Borrowed' },
19
+ { value: 'Interest Owed' },
20
+ { value: 'Total Debt' },
21
+ { value: 'Borrow APY' },
22
+ { value: 'Spoke' },
23
+ ];
24
+ getBorrowsRequest() {
25
+ return ResultAsync.fromPromise(this.parse(ListBorrows), (error) => new InvariantError(String(error))).andThen(({ flags }) => {
26
+ const user = flags.user;
27
+ const chainId = flags.chain_id;
28
+ invariant(user, 'You must provide a user address');
29
+ invariant(chainId, 'You must provide a chain ID');
30
+ return ok({
31
+ query: {
32
+ userChains: {
33
+ user,
34
+ chainIds: [chainId],
35
+ },
36
+ },
37
+ });
38
+ });
39
+ }
40
+ async run() {
41
+ const result = await this.getBorrowsRequest()
42
+ .andThen((request) => userBorrows(this.client, request))
43
+ .andThen((borrows) => {
44
+ if (borrows.length === 0) {
45
+ this.log('No borrows found for this user.');
46
+ return ok(borrows);
47
+ }
48
+ this.display(borrows.map((item) => [
49
+ item.principal.token.info.name,
50
+ `${item.principal.amount.value.toFixed(4)} `,
51
+ `${item.interest.amount.value.toFixed(4)} `,
52
+ `${(item.debt.amount.value).toFixed(4)} `,
53
+ `${item.reserve.summary.borrowApy.normalized.toFixed(4)}%`,
54
+ item.reserve.spoke.name,
55
+ ]));
56
+ return ok(borrows);
57
+ });
58
+ if (result.isErr()) {
59
+ this.error(result.error);
60
+ }
61
+ return result.value;
62
+ }
63
+ }
@@ -0,0 +1,14 @@
1
+ import { type ChainId, type EvmAddress, InvariantError, type UnexpectedError, type UserPosition } from '@aave/client';
2
+ import * as common from '../../common.js';
3
+ export default class ListPositions extends common.V4Command {
4
+ static description: string;
5
+ static flags: {
6
+ user: import("@oclif/core/interfaces").OptionFlag<EvmAddress, import("@oclif/core/interfaces").CustomOptions>;
7
+ chain_id: import("@oclif/core/interfaces").OptionFlag<ChainId, import("@oclif/core/interfaces").CustomOptions>;
8
+ };
9
+ headers: {
10
+ value: string;
11
+ }[];
12
+ private getPositionsRequest;
13
+ run(): Promise<UserPosition[] | InvariantError | UnexpectedError>;
14
+ }
@@ -0,0 +1,65 @@
1
+ import { InvariantError, invariant, ok, ResultAsync, } from '@aave/client';
2
+ import { userPositions } from '@aave/client/actions';
3
+ import * as common from '../../common.js';
4
+ export default class ListPositions extends common.V4Command {
5
+ static description = 'List user positions across chains';
6
+ static flags = {
7
+ user: common.address({
8
+ required: true,
9
+ description: 'User address',
10
+ }),
11
+ chain_id: common.chain({
12
+ required: true,
13
+ description: 'Filter by chain ID',
14
+ }),
15
+ };
16
+ headers = [
17
+ { value: 'Position ID' },
18
+ { value: 'Spoke' },
19
+ { value: 'Chain' },
20
+ { value: 'Total Supplied' },
21
+ { value: 'Total Borrowed' },
22
+ { value: 'Health Factor' },
23
+ { value: 'Collateral Enabled' },
24
+ ];
25
+ getPositionsRequest() {
26
+ return ResultAsync.fromPromise(this.parse(ListPositions), (error) => new InvariantError(String(error))).andThen(({ flags }) => {
27
+ const user = flags.user;
28
+ const chainId = flags.chain_id;
29
+ invariant(user, 'You must provide a user address');
30
+ invariant(chainId, 'You must provide a chain ID');
31
+ return ok({
32
+ user,
33
+ filter: {
34
+ chainIds: [chainId],
35
+ },
36
+ });
37
+ });
38
+ }
39
+ async run() {
40
+ const result = await this.getPositionsRequest()
41
+ .andThen((request) => userPositions(this.client, request))
42
+ .andThen((positions) => {
43
+ if (positions.length === 0) {
44
+ this.log('No positions found for this user');
45
+ return ok(positions);
46
+ }
47
+ this.display(positions.map((item) => [
48
+ item.id,
49
+ item.spoke.name,
50
+ `${item.spoke.chain.name} (id=${item.spoke.chain.chainId})`,
51
+ `${item.totalSupplied.current.symbol}${item.totalSupplied.current.value.toFixed(2)}`,
52
+ `${item.totalDebt.current.symbol}${item.totalDebt.current.value.toFixed(2)}`,
53
+ item.healthFactor.current?.toFixed(2) ?? 'N/A',
54
+ Number(item.totalCollateral.current.value.toFixed(0)) > 0
55
+ ? 'Yes'
56
+ : 'No',
57
+ ]));
58
+ return ok(positions);
59
+ });
60
+ if (result.isErr()) {
61
+ this.error(result.error);
62
+ }
63
+ return result.value;
64
+ }
65
+ }
@@ -0,0 +1,14 @@
1
+ import { type ChainId, type EvmAddress, InvariantError, type UnexpectedError, type UserSupplyItem } from '@aave/client';
2
+ import * as common from '../../common.js';
3
+ export default class ListSupplies extends common.V4Command {
4
+ static description: string;
5
+ static flags: {
6
+ user: import("@oclif/core/interfaces").OptionFlag<EvmAddress, import("@oclif/core/interfaces").CustomOptions>;
7
+ chain_id: import("@oclif/core/interfaces").OptionFlag<ChainId, import("@oclif/core/interfaces").CustomOptions>;
8
+ };
9
+ headers: {
10
+ value: string;
11
+ }[];
12
+ private getSuppliesRequest;
13
+ run(): Promise<UserSupplyItem[] | InvariantError | UnexpectedError>;
14
+ }
@@ -0,0 +1,65 @@
1
+ import { InvariantError, invariant, ok, ResultAsync, } from '@aave/client';
2
+ import { userSupplies } from '@aave/client/actions';
3
+ import * as common from '../../common.js';
4
+ export default class ListSupplies extends common.V4Command {
5
+ static description = 'List user supplies for a specific chain';
6
+ static flags = {
7
+ user: common.address({
8
+ required: true,
9
+ description: 'User address',
10
+ }),
11
+ chain_id: common.chain({
12
+ required: true,
13
+ description: 'Chain ID to query supplies from',
14
+ }),
15
+ };
16
+ headers = [
17
+ { value: 'Asset' },
18
+ { value: 'Supplied' },
19
+ { value: 'Interest Earned' },
20
+ { value: 'Withdrawable' },
21
+ { value: 'APY' },
22
+ { value: 'Collateral' },
23
+ { value: 'Spoke' },
24
+ ];
25
+ getSuppliesRequest() {
26
+ return ResultAsync.fromPromise(this.parse(ListSupplies), (error) => new InvariantError(String(error))).andThen(({ flags }) => {
27
+ const user = flags.user;
28
+ const chainId = flags.chain_id;
29
+ invariant(user, 'You must provide a user address');
30
+ invariant(chainId, 'You must provide a chain ID');
31
+ return ok({
32
+ query: {
33
+ userChains: {
34
+ user,
35
+ chainIds: [chainId],
36
+ },
37
+ },
38
+ });
39
+ });
40
+ }
41
+ async run() {
42
+ const result = await this.getSuppliesRequest()
43
+ .andThen((request) => userSupplies(this.client, request))
44
+ .andThen((supplies) => {
45
+ if (supplies.length === 0) {
46
+ this.log('No supplies found for this user');
47
+ return ok(supplies);
48
+ }
49
+ this.display(supplies.map((item) => [
50
+ `${item.reserve.asset.underlying.info.name} (${item.reserve.asset.underlying.info.symbol})`,
51
+ `${item.principal.amount.value.toFixed(4)} `,
52
+ `${item.interest.amount.value.toFixed(4)} `,
53
+ `${item.withdrawable.amount.value.toFixed(4)}`,
54
+ `${item.reserve.summary.supplyApy.normalized.toFixed(4)}%`,
55
+ item.isCollateral ? 'Yes' : 'No',
56
+ item.reserve.spoke.name,
57
+ ]));
58
+ return ok(supplies);
59
+ });
60
+ if (result.isErr()) {
61
+ this.error(result.error);
62
+ }
63
+ return result.value;
64
+ }
65
+ }
@@ -1,5 +1,60 @@
1
1
  {
2
2
  "commands": {
3
+ "borrows:list": {
4
+ "aliases": [],
5
+ "args": {},
6
+ "description": "List user borrows for a specific chain",
7
+ "flags": {
8
+ "json": {
9
+ "description": "Format output as json.",
10
+ "helpGroup": "GLOBAL",
11
+ "name": "json",
12
+ "allowNo": false,
13
+ "type": "boolean"
14
+ },
15
+ "staging": {
16
+ "description": "Use staging environment",
17
+ "hidden": true,
18
+ "name": "staging",
19
+ "allowNo": false,
20
+ "type": "boolean"
21
+ },
22
+ "user": {
23
+ "description": "User address",
24
+ "name": "user",
25
+ "required": true,
26
+ "hasDynamicHelp": false,
27
+ "helpValue": "<evm-address>",
28
+ "multiple": false,
29
+ "type": "option"
30
+ },
31
+ "chain_id": {
32
+ "char": "c",
33
+ "description": "Chain ID to query borrows from",
34
+ "name": "chain_id",
35
+ "required": true,
36
+ "hasDynamicHelp": false,
37
+ "helpValue": "<chain-id>",
38
+ "multiple": false,
39
+ "type": "option"
40
+ }
41
+ },
42
+ "hasDynamicHelp": false,
43
+ "hiddenAliases": [],
44
+ "id": "borrows:list",
45
+ "pluginAlias": "@aave/cli",
46
+ "pluginName": "@aave/cli",
47
+ "pluginType": "core",
48
+ "strict": true,
49
+ "enableJsonFlag": true,
50
+ "isESM": true,
51
+ "relativePath": [
52
+ "dist",
53
+ "commands",
54
+ "borrows",
55
+ "list.js"
56
+ ]
57
+ },
3
58
  "hubs:list": {
4
59
  "aliases": [],
5
60
  "args": {},
@@ -166,6 +221,61 @@
166
221
  "list.js"
167
222
  ]
168
223
  },
224
+ "positions:list": {
225
+ "aliases": [],
226
+ "args": {},
227
+ "description": "List user positions across chains",
228
+ "flags": {
229
+ "json": {
230
+ "description": "Format output as json.",
231
+ "helpGroup": "GLOBAL",
232
+ "name": "json",
233
+ "allowNo": false,
234
+ "type": "boolean"
235
+ },
236
+ "staging": {
237
+ "description": "Use staging environment",
238
+ "hidden": true,
239
+ "name": "staging",
240
+ "allowNo": false,
241
+ "type": "boolean"
242
+ },
243
+ "user": {
244
+ "description": "User address",
245
+ "name": "user",
246
+ "required": true,
247
+ "hasDynamicHelp": false,
248
+ "helpValue": "<evm-address>",
249
+ "multiple": false,
250
+ "type": "option"
251
+ },
252
+ "chain_id": {
253
+ "char": "c",
254
+ "description": "Filter by chain ID",
255
+ "name": "chain_id",
256
+ "required": true,
257
+ "hasDynamicHelp": false,
258
+ "helpValue": "<chain-id>",
259
+ "multiple": false,
260
+ "type": "option"
261
+ }
262
+ },
263
+ "hasDynamicHelp": false,
264
+ "hiddenAliases": [],
265
+ "id": "positions:list",
266
+ "pluginAlias": "@aave/cli",
267
+ "pluginName": "@aave/cli",
268
+ "pluginType": "core",
269
+ "strict": true,
270
+ "enableJsonFlag": true,
271
+ "isESM": true,
272
+ "relativePath": [
273
+ "dist",
274
+ "commands",
275
+ "positions",
276
+ "list.js"
277
+ ]
278
+ },
169
279
  "spokes:list": {
170
280
  "aliases": [],
171
281
  "args": {},
@@ -262,7 +372,62 @@
262
372
  "spokes",
263
373
  "list.js"
264
374
  ]
375
+ },
376
+ "supplies:list": {
377
+ "aliases": [],
378
+ "args": {},
379
+ "description": "List user supplies for a specific chain",
380
+ "flags": {
381
+ "json": {
382
+ "description": "Format output as json.",
383
+ "helpGroup": "GLOBAL",
384
+ "name": "json",
385
+ "allowNo": false,
386
+ "type": "boolean"
387
+ },
388
+ "staging": {
389
+ "description": "Use staging environment",
390
+ "hidden": true,
391
+ "name": "staging",
392
+ "allowNo": false,
393
+ "type": "boolean"
394
+ },
395
+ "user": {
396
+ "description": "User address",
397
+ "name": "user",
398
+ "required": true,
399
+ "hasDynamicHelp": false,
400
+ "helpValue": "<evm-address>",
401
+ "multiple": false,
402
+ "type": "option"
403
+ },
404
+ "chain_id": {
405
+ "char": "c",
406
+ "description": "Chain ID to query supplies from",
407
+ "name": "chain_id",
408
+ "required": true,
409
+ "hasDynamicHelp": false,
410
+ "helpValue": "<chain-id>",
411
+ "multiple": false,
412
+ "type": "option"
413
+ }
414
+ },
415
+ "hasDynamicHelp": false,
416
+ "hiddenAliases": [],
417
+ "id": "supplies:list",
418
+ "pluginAlias": "@aave/cli",
419
+ "pluginName": "@aave/cli",
420
+ "pluginType": "core",
421
+ "strict": true,
422
+ "enableJsonFlag": true,
423
+ "isESM": true,
424
+ "relativePath": [
425
+ "dist",
426
+ "commands",
427
+ "supplies",
428
+ "list.js"
429
+ ]
265
430
  }
266
431
  },
267
- "version": "4.1.0-next.36"
432
+ "version": "4.1.0-next.38"
268
433
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aave/cli",
3
- "version": "4.1.0-next.36",
3
+ "version": "4.1.0-next.38",
4
4
  "description": "CLI to interact with AaveKit API",
5
5
  "keywords": [
6
6
  "aave",
@@ -30,7 +30,7 @@
30
30
  "@oclif/plugin-help": "^6",
31
31
  "@oclif/plugin-plugins": "^5",
32
32
  "tty-table": "^5.0.0",
33
- "@aave/client": "4.0.0-next.44"
33
+ "@aave/client": "4.0.0-next.46"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@oclif/test": "^4",