@jup-ag/lend 0.0.49 → 0.0.50

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
@@ -53,3 +53,13 @@ const { ixs, addressLookupTableAccounts } = await getOperateIx({
53
53
  connection,
54
54
  });
55
55
  ```
56
+
57
+ #### API
58
+
59
+ ```ts
60
+ import { Client } from "@jup-ag/lend/api";
61
+
62
+ const client = new Client(); // or new Client({ apiKey: "my-api-key" });
63
+
64
+ const lendingTokens = await client.earning.getTokens();
65
+ ```
@@ -117,12 +117,36 @@ type LendingToken = {
117
117
  withdrawable: string;
118
118
  };
119
119
  };
120
+ type LendingEarning = {
121
+ address: string;
122
+ ownerAddress: string;
123
+ totalDeposits: string;
124
+ totalWithdraws: string;
125
+ totalBalance: string;
126
+ totalAssets: string;
127
+ earnings: string;
128
+ };
129
+ type LendingPosition = {
130
+ token: LendingToken;
131
+ ownerAddress: string;
132
+ shares: string;
133
+ underlyingAssets: string;
134
+ underlyingBalance: string;
135
+ allowance: string;
136
+ };
120
137
  declare class EarnClient {
121
138
  private http;
122
139
  constructor({ http }: {
123
140
  http: HttpClient;
124
141
  });
125
142
  getTokens(): Promise<LendingToken[]>;
143
+ getEarnings({ user, positions, }: {
144
+ user: string;
145
+ positions: string[];
146
+ }): Promise<LendingEarning[]>;
147
+ getPositions({ users }: {
148
+ users: string[];
149
+ }): Promise<LendingPosition[]>;
126
150
  }
127
151
 
128
152
  type HttpClient = AxiosInstance;
@@ -117,12 +117,36 @@ type LendingToken = {
117
117
  withdrawable: string;
118
118
  };
119
119
  };
120
+ type LendingEarning = {
121
+ address: string;
122
+ ownerAddress: string;
123
+ totalDeposits: string;
124
+ totalWithdraws: string;
125
+ totalBalance: string;
126
+ totalAssets: string;
127
+ earnings: string;
128
+ };
129
+ type LendingPosition = {
130
+ token: LendingToken;
131
+ ownerAddress: string;
132
+ shares: string;
133
+ underlyingAssets: string;
134
+ underlyingBalance: string;
135
+ allowance: string;
136
+ };
120
137
  declare class EarnClient {
121
138
  private http;
122
139
  constructor({ http }: {
123
140
  http: HttpClient;
124
141
  });
125
142
  getTokens(): Promise<LendingToken[]>;
143
+ getEarnings({ user, positions, }: {
144
+ user: string;
145
+ positions: string[];
146
+ }): Promise<LendingEarning[]>;
147
+ getPositions({ users }: {
148
+ users: string[];
149
+ }): Promise<LendingPosition[]>;
126
150
  }
127
151
 
128
152
  type HttpClient = AxiosInstance;
@@ -20,6 +20,32 @@ class EarnClient {
20
20
  const { data } = await this.http.get("/v1/earn/tokens");
21
21
  return data;
22
22
  }
23
+ async getEarnings({
24
+ user,
25
+ positions
26
+ }) {
27
+ const { data } = await this.http.get(
28
+ "/v1/earn/earnings",
29
+ {
30
+ params: {
31
+ user,
32
+ positions
33
+ }
34
+ }
35
+ );
36
+ return data;
37
+ }
38
+ async getPositions({ users }) {
39
+ const { data } = await this.http.get(
40
+ "/v1/earn/positions",
41
+ {
42
+ params: {
43
+ users
44
+ }
45
+ }
46
+ );
47
+ return data;
48
+ }
23
49
  }
24
50
 
25
51
  class Client {
package/dist/index.mjs CHANGED
@@ -5,6 +5,6 @@ import '@solana/web3.js';
5
5
  import '@solana/spl-token';
6
6
  import 'bn.js';
7
7
 
8
- const version = "0.0.49";
8
+ const version = "0.0.50";
9
9
 
10
10
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jup-ag/lend",
3
- "version": "0.0.49",
3
+ "version": "0.0.50",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "type": "module",