@jup-ag/lend 0.0.49 → 0.0.51
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 +10 -0
- package/dist/api/index.d.mts +83 -0
- package/dist/api/index.d.ts +83 -0
- package/dist/api/index.mjs +134 -0
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
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.earn.getTokens();
|
|
65
|
+
```
|
package/dist/api/index.d.mts
CHANGED
|
@@ -117,12 +117,95 @@ 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
|
+
};
|
|
137
|
+
type InstructionsResult = {
|
|
138
|
+
instructions: Array<{
|
|
139
|
+
programId: string;
|
|
140
|
+
accounts: Array<{
|
|
141
|
+
pubkey: string;
|
|
142
|
+
isSigner: boolean;
|
|
143
|
+
isWritable: boolean;
|
|
144
|
+
}>;
|
|
145
|
+
data: string;
|
|
146
|
+
}>;
|
|
147
|
+
};
|
|
120
148
|
declare class EarnClient {
|
|
121
149
|
private http;
|
|
122
150
|
constructor({ http }: {
|
|
123
151
|
http: HttpClient;
|
|
124
152
|
});
|
|
125
153
|
getTokens(): Promise<LendingToken[]>;
|
|
154
|
+
getEarnings({ user, positions, }: {
|
|
155
|
+
user: string;
|
|
156
|
+
positions: string[];
|
|
157
|
+
}): Promise<LendingEarning[]>;
|
|
158
|
+
getPositions({ users }: {
|
|
159
|
+
users: string[];
|
|
160
|
+
}): Promise<LendingPosition[]>;
|
|
161
|
+
deposit({ asset, signer, amount, }: {
|
|
162
|
+
asset: string;
|
|
163
|
+
signer: string;
|
|
164
|
+
amount: string;
|
|
165
|
+
}): Promise<{
|
|
166
|
+
transaction: string;
|
|
167
|
+
}>;
|
|
168
|
+
depositInstructions({ asset, signer, amount, }: {
|
|
169
|
+
asset: string;
|
|
170
|
+
signer: string;
|
|
171
|
+
amount: string;
|
|
172
|
+
}): Promise<InstructionsResult>;
|
|
173
|
+
withdraw({ asset, signer, amount, }: {
|
|
174
|
+
asset: string;
|
|
175
|
+
signer: string;
|
|
176
|
+
amount: string;
|
|
177
|
+
}): Promise<{
|
|
178
|
+
transaction: string;
|
|
179
|
+
}>;
|
|
180
|
+
withdrawInstructions({ asset, signer, amount, }: {
|
|
181
|
+
asset: string;
|
|
182
|
+
signer: string;
|
|
183
|
+
amount: string;
|
|
184
|
+
}): Promise<InstructionsResult>;
|
|
185
|
+
mint({ asset, signer, shares, }: {
|
|
186
|
+
asset: string;
|
|
187
|
+
signer: string;
|
|
188
|
+
shares: string;
|
|
189
|
+
}): Promise<{
|
|
190
|
+
transaction: string;
|
|
191
|
+
}>;
|
|
192
|
+
mintInstructions({ asset, signer, shares, }: {
|
|
193
|
+
asset: string;
|
|
194
|
+
signer: string;
|
|
195
|
+
shares: string;
|
|
196
|
+
}): Promise<InstructionsResult>;
|
|
197
|
+
redeen({ asset, signer, shares, }: {
|
|
198
|
+
asset: string;
|
|
199
|
+
signer: string;
|
|
200
|
+
shares: string;
|
|
201
|
+
}): Promise<{
|
|
202
|
+
transaction: string;
|
|
203
|
+
}>;
|
|
204
|
+
redeenInstructions({ asset, signer, shares, }: {
|
|
205
|
+
asset: string;
|
|
206
|
+
signer: string;
|
|
207
|
+
shares: string;
|
|
208
|
+
}): Promise<InstructionsResult>;
|
|
126
209
|
}
|
|
127
210
|
|
|
128
211
|
type HttpClient = AxiosInstance;
|
package/dist/api/index.d.ts
CHANGED
|
@@ -117,12 +117,95 @@ 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
|
+
};
|
|
137
|
+
type InstructionsResult = {
|
|
138
|
+
instructions: Array<{
|
|
139
|
+
programId: string;
|
|
140
|
+
accounts: Array<{
|
|
141
|
+
pubkey: string;
|
|
142
|
+
isSigner: boolean;
|
|
143
|
+
isWritable: boolean;
|
|
144
|
+
}>;
|
|
145
|
+
data: string;
|
|
146
|
+
}>;
|
|
147
|
+
};
|
|
120
148
|
declare class EarnClient {
|
|
121
149
|
private http;
|
|
122
150
|
constructor({ http }: {
|
|
123
151
|
http: HttpClient;
|
|
124
152
|
});
|
|
125
153
|
getTokens(): Promise<LendingToken[]>;
|
|
154
|
+
getEarnings({ user, positions, }: {
|
|
155
|
+
user: string;
|
|
156
|
+
positions: string[];
|
|
157
|
+
}): Promise<LendingEarning[]>;
|
|
158
|
+
getPositions({ users }: {
|
|
159
|
+
users: string[];
|
|
160
|
+
}): Promise<LendingPosition[]>;
|
|
161
|
+
deposit({ asset, signer, amount, }: {
|
|
162
|
+
asset: string;
|
|
163
|
+
signer: string;
|
|
164
|
+
amount: string;
|
|
165
|
+
}): Promise<{
|
|
166
|
+
transaction: string;
|
|
167
|
+
}>;
|
|
168
|
+
depositInstructions({ asset, signer, amount, }: {
|
|
169
|
+
asset: string;
|
|
170
|
+
signer: string;
|
|
171
|
+
amount: string;
|
|
172
|
+
}): Promise<InstructionsResult>;
|
|
173
|
+
withdraw({ asset, signer, amount, }: {
|
|
174
|
+
asset: string;
|
|
175
|
+
signer: string;
|
|
176
|
+
amount: string;
|
|
177
|
+
}): Promise<{
|
|
178
|
+
transaction: string;
|
|
179
|
+
}>;
|
|
180
|
+
withdrawInstructions({ asset, signer, amount, }: {
|
|
181
|
+
asset: string;
|
|
182
|
+
signer: string;
|
|
183
|
+
amount: string;
|
|
184
|
+
}): Promise<InstructionsResult>;
|
|
185
|
+
mint({ asset, signer, shares, }: {
|
|
186
|
+
asset: string;
|
|
187
|
+
signer: string;
|
|
188
|
+
shares: string;
|
|
189
|
+
}): Promise<{
|
|
190
|
+
transaction: string;
|
|
191
|
+
}>;
|
|
192
|
+
mintInstructions({ asset, signer, shares, }: {
|
|
193
|
+
asset: string;
|
|
194
|
+
signer: string;
|
|
195
|
+
shares: string;
|
|
196
|
+
}): Promise<InstructionsResult>;
|
|
197
|
+
redeen({ asset, signer, shares, }: {
|
|
198
|
+
asset: string;
|
|
199
|
+
signer: string;
|
|
200
|
+
shares: string;
|
|
201
|
+
}): Promise<{
|
|
202
|
+
transaction: string;
|
|
203
|
+
}>;
|
|
204
|
+
redeenInstructions({ asset, signer, shares, }: {
|
|
205
|
+
asset: string;
|
|
206
|
+
signer: string;
|
|
207
|
+
shares: string;
|
|
208
|
+
}): Promise<InstructionsResult>;
|
|
126
209
|
}
|
|
127
210
|
|
|
128
211
|
type HttpClient = AxiosInstance;
|
package/dist/api/index.mjs
CHANGED
|
@@ -20,6 +20,140 @@ 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
|
+
}
|
|
49
|
+
async deposit({
|
|
50
|
+
asset,
|
|
51
|
+
signer,
|
|
52
|
+
amount
|
|
53
|
+
}) {
|
|
54
|
+
const { data } = await this.http.post("/v1/earn/deposit", {
|
|
55
|
+
asset,
|
|
56
|
+
signer,
|
|
57
|
+
amount
|
|
58
|
+
});
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
61
|
+
async depositInstructions({
|
|
62
|
+
asset,
|
|
63
|
+
signer,
|
|
64
|
+
amount
|
|
65
|
+
}) {
|
|
66
|
+
const { data } = await this.http.post(
|
|
67
|
+
"/v1/earn/deposit-instructions",
|
|
68
|
+
{
|
|
69
|
+
asset,
|
|
70
|
+
signer,
|
|
71
|
+
amount
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
return data;
|
|
75
|
+
}
|
|
76
|
+
async withdraw({
|
|
77
|
+
asset,
|
|
78
|
+
signer,
|
|
79
|
+
amount
|
|
80
|
+
}) {
|
|
81
|
+
const { data } = await this.http.post("/v1/earn/withdraw", {
|
|
82
|
+
asset,
|
|
83
|
+
signer,
|
|
84
|
+
amount
|
|
85
|
+
});
|
|
86
|
+
return data;
|
|
87
|
+
}
|
|
88
|
+
async withdrawInstructions({
|
|
89
|
+
asset,
|
|
90
|
+
signer,
|
|
91
|
+
amount
|
|
92
|
+
}) {
|
|
93
|
+
const { data } = await this.http.post(
|
|
94
|
+
"/v1/earn/withdraw-instructions",
|
|
95
|
+
{
|
|
96
|
+
asset,
|
|
97
|
+
signer,
|
|
98
|
+
amount
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
return data;
|
|
102
|
+
}
|
|
103
|
+
async mint({
|
|
104
|
+
asset,
|
|
105
|
+
signer,
|
|
106
|
+
shares
|
|
107
|
+
}) {
|
|
108
|
+
const { data } = await this.http.post("/v1/earn/mint", {
|
|
109
|
+
asset,
|
|
110
|
+
signer,
|
|
111
|
+
shares
|
|
112
|
+
});
|
|
113
|
+
return data;
|
|
114
|
+
}
|
|
115
|
+
async mintInstructions({
|
|
116
|
+
asset,
|
|
117
|
+
signer,
|
|
118
|
+
shares
|
|
119
|
+
}) {
|
|
120
|
+
const { data } = await this.http.post(
|
|
121
|
+
"/v1/earn/mint-instructions",
|
|
122
|
+
{
|
|
123
|
+
asset,
|
|
124
|
+
signer,
|
|
125
|
+
shares
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
return data;
|
|
129
|
+
}
|
|
130
|
+
async redeen({
|
|
131
|
+
asset,
|
|
132
|
+
signer,
|
|
133
|
+
shares
|
|
134
|
+
}) {
|
|
135
|
+
const { data } = await this.http.post("/v1/earn/redeen", {
|
|
136
|
+
asset,
|
|
137
|
+
signer,
|
|
138
|
+
shares
|
|
139
|
+
});
|
|
140
|
+
return data;
|
|
141
|
+
}
|
|
142
|
+
async redeenInstructions({
|
|
143
|
+
asset,
|
|
144
|
+
signer,
|
|
145
|
+
shares
|
|
146
|
+
}) {
|
|
147
|
+
const { data } = await this.http.post(
|
|
148
|
+
"/v1/earn/redeen-instructions",
|
|
149
|
+
{
|
|
150
|
+
asset,
|
|
151
|
+
signer,
|
|
152
|
+
shares
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
return data;
|
|
156
|
+
}
|
|
23
157
|
}
|
|
24
158
|
|
|
25
159
|
class Client {
|
package/dist/index.mjs
CHANGED