@jup-ag/lend 0.0.105 → 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.
@@ -2,7 +2,7 @@ import { SYSVAR_INSTRUCTIONS_PUBKEY, SystemProgram, PublicKey } from '@solana/we
2
2
  import { ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from '@solana/spl-token';
3
3
  import { l as liquidity } from '../shared/lend.CioR9-te.mjs';
4
4
  import { Program } from '@coral-xyz/anchor';
5
- import { b as lending, g as getLendingToken, c as getLending, d as getLendingRewardsRateModel, e as getClaimAccount, f as getLendingAdmin } from '../shared/lend.C7OmhOS3.mjs';
5
+ import { b as lending, g as getLendingToken, c as getLending, d as getLendingRewardsRateModel, e as getClaimAccount, f as getLendingAdmin } from '../shared/lend.DS0KoPpL.mjs';
6
6
  import { g as getLiquidity, a as getRateModel, b as getUserBorrowPosition, c as getUserSupplyPosition, d as getTokenReserveFromAsset, e as getReserve } from '../shared/lend.BzG5ldOV.mjs';
7
7
  import BN from 'bn.js';
8
8
 
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export { l as lendingPda, a as lendingRewardRateModelPda } from './shared/lend.C7OmhOS3.mjs';
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.BWTZqUUK.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.105";
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 };
@@ -11,192 +11,6 @@ const metadata = {
11
11
  description: "Created with Anchor"
12
12
  };
13
13
  const instructions = [
14
- {
15
- name: "close_position",
16
- discriminator: [
17
- 123,
18
- 134,
19
- 81,
20
- 0,
21
- 49,
22
- 68,
23
- 98,
24
- 98
25
- ],
26
- accounts: [
27
- {
28
- name: "signer",
29
- writable: true,
30
- signer: true
31
- },
32
- {
33
- name: "vault_admin"
34
- },
35
- {
36
- name: "vault_state",
37
- docs: [
38
- "@dev Verification inside instruction logic"
39
- ],
40
- writable: true
41
- },
42
- {
43
- name: "vault_config",
44
- docs: [
45
- "@dev Verification inside instruction logic"
46
- ],
47
- writable: true
48
- },
49
- {
50
- name: "position",
51
- docs: [
52
- "@dev Verification inside instruction logic"
53
- ],
54
- writable: true
55
- },
56
- {
57
- name: "position_mint",
58
- docs: [
59
- "@dev Verification inside instruction logic"
60
- ],
61
- writable: true
62
- },
63
- {
64
- name: "position_token_account",
65
- docs: [
66
- "@dev Verification inside instruction logic"
67
- ],
68
- writable: true
69
- },
70
- {
71
- name: "metadata_account",
72
- writable: true,
73
- pda: {
74
- seeds: [
75
- {
76
- kind: "const",
77
- value: [
78
- 109,
79
- 101,
80
- 116,
81
- 97,
82
- 100,
83
- 97,
84
- 116,
85
- 97
86
- ]
87
- },
88
- {
89
- kind: "const",
90
- value: [
91
- 11,
92
- 112,
93
- 101,
94
- 177,
95
- 227,
96
- 209,
97
- 124,
98
- 69,
99
- 56,
100
- 157,
101
- 82,
102
- 127,
103
- 107,
104
- 4,
105
- 195,
106
- 205,
107
- 88,
108
- 184,
109
- 108,
110
- 115,
111
- 26,
112
- 160,
113
- 253,
114
- 181,
115
- 73,
116
- 182,
117
- 209,
118
- 188,
119
- 3,
120
- 248,
121
- 41,
122
- 70
123
- ]
124
- },
125
- {
126
- kind: "account",
127
- path: "position_mint"
128
- }
129
- ],
130
- program: {
131
- kind: "const",
132
- value: [
133
- 11,
134
- 112,
135
- 101,
136
- 177,
137
- 227,
138
- 209,
139
- 124,
140
- 69,
141
- 56,
142
- 157,
143
- 82,
144
- 127,
145
- 107,
146
- 4,
147
- 195,
148
- 205,
149
- 88,
150
- 184,
151
- 108,
152
- 115,
153
- 26,
154
- 160,
155
- 253,
156
- 181,
157
- 73,
158
- 182,
159
- 209,
160
- 188,
161
- 3,
162
- 248,
163
- 41,
164
- 70
165
- ]
166
- }
167
- }
168
- },
169
- {
170
- name: "token_program"
171
- },
172
- {
173
- name: "associated_token_program",
174
- address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
175
- },
176
- {
177
- name: "system_program",
178
- address: "11111111111111111111111111111111"
179
- },
180
- {
181
- name: "sysvar_instruction",
182
- address: "Sysvar1nstructions1111111111111111111111111"
183
- },
184
- {
185
- name: "metadata_program",
186
- address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
187
- }
188
- ],
189
- args: [
190
- {
191
- name: "vault_id",
192
- type: "u16"
193
- },
194
- {
195
- name: "position_id",
196
- type: "u32"
197
- }
198
- ]
199
- },
200
14
  {
201
15
  name: "get_exchange_prices",
202
16
  discriminator: [
@@ -2192,10 +2006,6 @@ const instructions = [
2192
2006
  196
2193
2007
  ],
2194
2008
  accounts: [
2195
- {
2196
- name: "signer",
2197
- signer: true
2198
- },
2199
2009
  {
2200
2010
  name: "vault_state",
2201
2011
  docs: [
@@ -4268,6 +4078,9 @@ const types = [
4268
4078
  },
4269
4079
  {
4270
4080
  name: "Chainlink"
4081
+ },
4082
+ {
4083
+ name: "SinglePool"
4271
4084
  }
4272
4085
  ]
4273
4086
  }
@@ -4952,7 +4765,7 @@ const types = [
4952
4765
  }
4953
4766
  }
4954
4767
  ];
4955
- const vaults = {
4768
+ const vaultsIdl = {
4956
4769
  address: address,
4957
4770
  metadata: metadata,
4958
4771
  instructions: instructions,
@@ -5157,4 +4970,4 @@ const borrow = {
5157
4970
  getVaultState: getVaultState
5158
4971
  };
5159
4972
 
5160
- 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 };