@jup-ag/lend 0.0.106 → 0.0.107-beta.0

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/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  export { l as lendingPda, a as lendingRewardRateModelPda } from './shared/lend.DS0KoPpL.mjs';
2
2
  export { l as liquidityPda } from './shared/lend.BzG5ldOV.mjs';
3
- export { b as borrowPda } from './shared/lend.BGZ9rdrj.mjs';
3
+ export { b as borrowPda } from './shared/lend.C2-jCLFw.mjs';
4
4
  export { f as flashloanPda } from './shared/lend.Cr2l14_0.mjs';
5
5
  export { m as merkleDistributorPda } from './shared/lend.Bpqe1Iia.mjs';
6
6
  import '@solana/web3.js';
@@ -8,6 +8,6 @@ import './shared/lend.CioR9-te.mjs';
8
8
  import '@solana/spl-token';
9
9
  import 'bn.js';
10
10
 
11
- const version = "0.0.106";
11
+ const version = "0.0.107-beta.0";
12
12
 
13
13
  export { version };
@@ -0,0 +1,58 @@
1
+ import * as _solana_web3_js from '@solana/web3.js';
2
+ import { PublicKey } from '@solana/web3.js';
3
+ import { O as OperateContextParams } from '../shared/lend.DNFQlLzM.mjs';
4
+ import 'bn.js';
5
+ import '@coral-xyz/anchor';
6
+
7
+ declare function getRefinanceIx(params: OperateContextParams): Promise<{
8
+ nftId: number;
9
+ accounts: {
10
+ signer: PublicKey;
11
+ signerSupplyTokenAccount: PublicKey;
12
+ signerBorrowTokenAccount: PublicKey;
13
+ recipient: PublicKey | null;
14
+ recipientSupplyTokenAccount: PublicKey | null;
15
+ recipientBorrowTokenAccount: PublicKey | null;
16
+ vaultConfig: PublicKey;
17
+ vaultState: PublicKey;
18
+ supplyToken: PublicKey;
19
+ borrowToken: PublicKey;
20
+ oracle: PublicKey;
21
+ position: PublicKey;
22
+ positionTokenAccount: PublicKey;
23
+ currentPositionTick: PublicKey;
24
+ finalPositionTick: PublicKey;
25
+ currentPositionTickId: PublicKey;
26
+ finalPositionTickId: PublicKey;
27
+ newBranch: PublicKey;
28
+ supplyTokenReservesLiquidity: PublicKey;
29
+ borrowTokenReservesLiquidity: PublicKey;
30
+ vaultSupplyPositionOnLiquidity: PublicKey;
31
+ vaultBorrowPositionOnLiquidity: PublicKey;
32
+ supplyRateModel: PublicKey;
33
+ borrowRateModel: PublicKey;
34
+ supplyTokenClaimAccount: null;
35
+ borrowTokenClaimAccount: null;
36
+ liquidity: PublicKey;
37
+ liquidityProgram: PublicKey;
38
+ vaultSupplyTokenAccount: PublicKey;
39
+ vaultBorrowTokenAccount: PublicKey;
40
+ oracleProgram: PublicKey;
41
+ supplyTokenProgram: PublicKey;
42
+ borrowTokenProgram: PublicKey;
43
+ associatedTokenProgram: PublicKey;
44
+ systemProgram: PublicKey;
45
+ };
46
+ remainingAccounts: {
47
+ pubkey: PublicKey;
48
+ isWritable: boolean;
49
+ isSigner: boolean;
50
+ }[];
51
+ remainingAccountsIndices: number[];
52
+ addressLookupTableAccounts: _solana_web3_js.AddressLookupTableAccount[];
53
+ addressLookupTableAddresses: PublicKey[];
54
+ otherIxs: _solana_web3_js.TransactionInstruction[];
55
+ operateIx: _solana_web3_js.TransactionInstruction;
56
+ }>;
57
+
58
+ export { getRefinanceIx };
@@ -0,0 +1,58 @@
1
+ import * as _solana_web3_js from '@solana/web3.js';
2
+ import { PublicKey } from '@solana/web3.js';
3
+ import { O as OperateContextParams } from '../shared/lend.DNFQlLzM.js';
4
+ import 'bn.js';
5
+ import '@coral-xyz/anchor';
6
+
7
+ declare function getRefinanceIx(params: OperateContextParams): Promise<{
8
+ nftId: number;
9
+ accounts: {
10
+ signer: PublicKey;
11
+ signerSupplyTokenAccount: PublicKey;
12
+ signerBorrowTokenAccount: PublicKey;
13
+ recipient: PublicKey | null;
14
+ recipientSupplyTokenAccount: PublicKey | null;
15
+ recipientBorrowTokenAccount: PublicKey | null;
16
+ vaultConfig: PublicKey;
17
+ vaultState: PublicKey;
18
+ supplyToken: PublicKey;
19
+ borrowToken: PublicKey;
20
+ oracle: PublicKey;
21
+ position: PublicKey;
22
+ positionTokenAccount: PublicKey;
23
+ currentPositionTick: PublicKey;
24
+ finalPositionTick: PublicKey;
25
+ currentPositionTickId: PublicKey;
26
+ finalPositionTickId: PublicKey;
27
+ newBranch: PublicKey;
28
+ supplyTokenReservesLiquidity: PublicKey;
29
+ borrowTokenReservesLiquidity: PublicKey;
30
+ vaultSupplyPositionOnLiquidity: PublicKey;
31
+ vaultBorrowPositionOnLiquidity: PublicKey;
32
+ supplyRateModel: PublicKey;
33
+ borrowRateModel: PublicKey;
34
+ supplyTokenClaimAccount: null;
35
+ borrowTokenClaimAccount: null;
36
+ liquidity: PublicKey;
37
+ liquidityProgram: PublicKey;
38
+ vaultSupplyTokenAccount: PublicKey;
39
+ vaultBorrowTokenAccount: PublicKey;
40
+ oracleProgram: PublicKey;
41
+ supplyTokenProgram: PublicKey;
42
+ borrowTokenProgram: PublicKey;
43
+ associatedTokenProgram: PublicKey;
44
+ systemProgram: PublicKey;
45
+ };
46
+ remainingAccounts: {
47
+ pubkey: PublicKey;
48
+ isWritable: boolean;
49
+ isSigner: boolean;
50
+ }[];
51
+ remainingAccountsIndices: number[];
52
+ addressLookupTableAccounts: _solana_web3_js.AddressLookupTableAccount[];
53
+ addressLookupTableAddresses: PublicKey[];
54
+ otherIxs: _solana_web3_js.TransactionInstruction[];
55
+ operateIx: _solana_web3_js.TransactionInstruction;
56
+ }>;
57
+
58
+ export { getRefinanceIx };
@@ -0,0 +1,270 @@
1
+ import { v as vaultsIdl } from '../shared/lend.C2-jCLFw.mjs';
2
+ import { e as getOperateIx } from '../shared/lend.yP9-PjAh.mjs';
3
+ import { PublicKey } from '@solana/web3.js';
4
+ import { Program } from '@coral-xyz/anchor';
5
+ import '../shared/lend.CioR9-te.mjs';
6
+ import '@solana/spl-token';
7
+ import 'bn.js';
8
+ import '../shared/lend.BzG5ldOV.mjs';
9
+
10
+ const address = "jup8QcdtqecBGw1iXHW3hQAsHQbTgEqbLbNMvvULmeK";
11
+ const metadata = {
12
+ name: "refinance",
13
+ version: "0.1.0",
14
+ spec: "0.1.0",
15
+ description: "Created with Anchor"
16
+ };
17
+ const instructions = [
18
+ {
19
+ name: "operate",
20
+ discriminator: [
21
+ 217,
22
+ 106,
23
+ 208,
24
+ 99,
25
+ 116,
26
+ 151,
27
+ 42,
28
+ 135
29
+ ],
30
+ accounts: [
31
+ {
32
+ name: "signer",
33
+ writable: true,
34
+ signer: true
35
+ },
36
+ {
37
+ name: "signer_supply_token_account",
38
+ writable: true
39
+ },
40
+ {
41
+ name: "signer_borrow_token_account",
42
+ writable: true
43
+ },
44
+ {
45
+ name: "recipient",
46
+ optional: true
47
+ },
48
+ {
49
+ name: "recipient_borrow_token_account",
50
+ optional: true
51
+ },
52
+ {
53
+ name: "recipient_supply_token_account",
54
+ optional: true
55
+ },
56
+ {
57
+ name: "vault_config",
58
+ docs: [
59
+ "@dev mut because this PDA signs the CPI to liquidity program",
60
+ "@dev verification inside instruction logic"
61
+ ]
62
+ },
63
+ {
64
+ name: "vault_state",
65
+ docs: [
66
+ "@dev verification inside instruction logic"
67
+ ],
68
+ writable: true
69
+ },
70
+ {
71
+ name: "supply_token"
72
+ },
73
+ {
74
+ name: "borrow_token"
75
+ },
76
+ {
77
+ name: "oracle"
78
+ },
79
+ {
80
+ name: "position",
81
+ writable: true
82
+ },
83
+ {
84
+ name: "position_token_account",
85
+ docs: [
86
+ "@dev verification inside instruction logic"
87
+ ]
88
+ },
89
+ {
90
+ name: "current_position_tick",
91
+ writable: true
92
+ },
93
+ {
94
+ name: "final_position_tick",
95
+ writable: true
96
+ },
97
+ {
98
+ name: "current_position_tick_id"
99
+ },
100
+ {
101
+ name: "final_position_tick_id",
102
+ writable: true
103
+ },
104
+ {
105
+ name: "new_branch",
106
+ writable: true
107
+ },
108
+ {
109
+ name: "supply_token_reserves_liquidity",
110
+ writable: true
111
+ },
112
+ {
113
+ name: "borrow_token_reserves_liquidity",
114
+ writable: true
115
+ },
116
+ {
117
+ name: "vault_supply_position_on_liquidity",
118
+ writable: true
119
+ },
120
+ {
121
+ name: "vault_borrow_position_on_liquidity",
122
+ writable: true
123
+ },
124
+ {
125
+ name: "supply_rate_model"
126
+ },
127
+ {
128
+ name: "borrow_rate_model"
129
+ },
130
+ {
131
+ name: "vault_supply_token_account",
132
+ writable: true
133
+ },
134
+ {
135
+ name: "vault_borrow_token_account",
136
+ writable: true
137
+ },
138
+ {
139
+ name: "supply_token_claim_account",
140
+ writable: true,
141
+ optional: true
142
+ },
143
+ {
144
+ name: "borrow_token_claim_account",
145
+ writable: true,
146
+ optional: true
147
+ },
148
+ {
149
+ name: "liquidity"
150
+ },
151
+ {
152
+ name: "liquidity_program"
153
+ },
154
+ {
155
+ name: "oracle_program"
156
+ },
157
+ {
158
+ name: "supply_token_program"
159
+ },
160
+ {
161
+ name: "borrow_token_program"
162
+ },
163
+ {
164
+ name: "associated_token_program"
165
+ },
166
+ {
167
+ name: "system_program",
168
+ address: "11111111111111111111111111111111"
169
+ },
170
+ {
171
+ name: "vaults_program",
172
+ address: "jupr81YtYssSyPt8jbnGuiWon5f6x9TcDEFxYe3Bdzi"
173
+ }
174
+ ],
175
+ args: [
176
+ {
177
+ name: "new_col",
178
+ type: "i128"
179
+ },
180
+ {
181
+ name: "new_debt",
182
+ type: "i128"
183
+ },
184
+ {
185
+ name: "transfer_type",
186
+ type: {
187
+ option: {
188
+ defined: {
189
+ name: "TransferType"
190
+ }
191
+ }
192
+ }
193
+ },
194
+ {
195
+ name: "remaining_accounts_indices",
196
+ type: "bytes"
197
+ }
198
+ ]
199
+ }
200
+ ];
201
+ const types = [
202
+ {
203
+ name: "TransferType",
204
+ type: {
205
+ kind: "enum",
206
+ variants: [
207
+ {
208
+ name: "SKIP"
209
+ },
210
+ {
211
+ name: "DIRECT"
212
+ },
213
+ {
214
+ name: "CLAIM"
215
+ }
216
+ ]
217
+ }
218
+ }
219
+ ];
220
+ const refinanceIdl = {
221
+ address: address,
222
+ metadata: metadata,
223
+ instructions: instructions,
224
+ types: types
225
+ };
226
+
227
+ const getRefinanceProgram = ({
228
+ connection,
229
+ signer
230
+ }) => new Program(refinanceIdl, {
231
+ connection,
232
+ publicKey: signer
233
+ });
234
+ async function getRefinanceIx(params) {
235
+ let {
236
+ nftId,
237
+ accounts,
238
+ remainingAccounts,
239
+ remainingAccountsIndices,
240
+ ixs,
241
+ addressLookupTableAccounts,
242
+ addressLookupTableAddresses
243
+ } = await getOperateIx(params);
244
+ accounts = {
245
+ ...accounts,
246
+ vaultsProgram: new PublicKey(vaultsIdl.address)
247
+ };
248
+ const program = getRefinanceProgram({
249
+ connection: params.connection,
250
+ signer: params.signer
251
+ });
252
+ const operateIx = await program.methods.operate(
253
+ params.colAmount,
254
+ params.debtAmount,
255
+ { direct: {} },
256
+ Buffer.from(remainingAccountsIndices)
257
+ ).accounts(accounts).remainingAccounts(remainingAccounts).instruction();
258
+ return {
259
+ nftId,
260
+ accounts,
261
+ remainingAccounts,
262
+ remainingAccountsIndices,
263
+ addressLookupTableAccounts,
264
+ addressLookupTableAddresses,
265
+ otherIxs: ixs.slice(0, -1),
266
+ operateIx
267
+ };
268
+ }
269
+
270
+ export { getRefinanceIx };
@@ -4765,7 +4765,7 @@ const types = [
4765
4765
  }
4766
4766
  }
4767
4767
  ];
4768
- const vaults = {
4768
+ const vaultsIdl = {
4769
4769
  address: address,
4770
4770
  metadata: metadata,
4771
4771
  instructions: instructions,
@@ -4970,4 +4970,4 @@ const borrow = {
4970
4970
  getVaultState: getVaultState
4971
4971
  };
4972
4972
 
4973
- export { getPosition as a, borrow as b, getTick as c, getTickIdLiquidation as d, getVaultConfig as e, getBranch as f, getTickHasDebt as g, getVaultState as h, getVaultMetadata as i, getLiquidity as j, getRateModel as k, getUserBorrowPosition as l, getUserSupplyPosition as m, getLiquidityReserve as n, getPositionTokenAccount as o, getPositionMetadata as p, getPositionMint as q, getVaultAdmin as r, getClaimAccount as s, vaults as v };
4973
+ export { getTickHasDebt as a, borrow as b, getPosition as c, getTick as d, getTickIdLiquidation as e, getVaultConfig as f, getVaultAdmin as g, getBranch as h, getVaultState as i, getVaultMetadata as j, getLiquidity as k, getRateModel as l, getUserBorrowPosition as m, getUserSupplyPosition as n, getLiquidityReserve as o, getPositionTokenAccount as p, getPositionMetadata as q, getPositionMint as r, getClaimAccount as s, vaultsIdl as v };