@jup-ag/lend 0.0.4 → 0.0.6

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.
@@ -8,22 +8,65 @@ type ConnectionParams = {
8
8
  };
9
9
  type DepositContextParams = {
10
10
  asset: PublicKey;
11
- receipient?: PublicKey;
11
+ recipient?: PublicKey;
12
12
  signer: PublicKey;
13
13
  };
14
14
  type DepositParams = {
15
15
  amount: BN;
16
16
  } & DepositContextParams & ConnectionParams;
17
- declare const getDepositIx: ({ amount, asset, receipient, signer, connection, }: DepositParams) => Promise<_solana_web3_js.TransactionInstruction>;
17
+ declare function getDepositContext({ recipient, asset, signer, }: DepositContextParams): {
18
+ signer: PublicKey;
19
+ depositorTokenAccount: PublicKey;
20
+ recipientTokenAccount: PublicKey;
21
+ lendingAdmin: PublicKey;
22
+ lending: PublicKey;
23
+ fTokenMint: PublicKey;
24
+ claimAccount: PublicKey;
25
+ supplyTokenReservesLiquidity: PublicKey;
26
+ borrowTokenReservesLiquidity: PublicKey;
27
+ lendingSupplyPositionOnLiquidity: PublicKey;
28
+ lendingBorrowPositionOnLiquidity: PublicKey;
29
+ rateModel: PublicKey;
30
+ vault: PublicKey;
31
+ liquidity: PublicKey;
32
+ liquidityProgram: PublicKey;
33
+ rewardsRateModel: PublicKey;
34
+ tokenProgram: PublicKey;
35
+ associatedTokenProgram: PublicKey;
36
+ systemProgram: PublicKey;
37
+ sysvarInstruction: PublicKey;
38
+ };
39
+ declare const getDepositIx: ({ amount, asset, recipient, signer, connection, }: DepositParams) => Promise<_solana_web3_js.TransactionInstruction>;
18
40
  type WithdrawContextParams = {
19
41
  asset: PublicKey;
20
- receipient?: PublicKey;
42
+ recipient?: PublicKey;
21
43
  signer: PublicKey;
22
44
  };
23
45
  type WithdrawParams = {
24
46
  amount: BN;
25
47
  } & WithdrawContextParams & ConnectionParams;
26
- declare const getWithdrawIx: ({ amount, asset, receipient, signer, connection, }: DepositParams) => Promise<_solana_web3_js.TransactionInstruction>;
48
+ declare function getWithdrawContext({ asset, recipient, signer, }: WithdrawContextParams): {
49
+ signer: PublicKey;
50
+ ownerTokenAccount: PublicKey;
51
+ recipientTokenAccount: PublicKey;
52
+ lendingAdmin: PublicKey;
53
+ lending: PublicKey;
54
+ mint: PublicKey;
55
+ claimAccount: PublicKey;
56
+ fTokenMint: PublicKey;
57
+ supplyTokenReservesLiquidity: PublicKey;
58
+ lendingSupplyPositionOnLiquidity: PublicKey;
59
+ rateModel: PublicKey;
60
+ vault: PublicKey;
61
+ liquidity: PublicKey;
62
+ liquidityProgram: PublicKey;
63
+ rewardsRateModel: PublicKey;
64
+ tokenProgram: PublicKey;
65
+ associatedTokenProgram: PublicKey;
66
+ systemProgram: PublicKey;
67
+ sysvarInstruction: PublicKey;
68
+ };
69
+ declare const getWithdrawIx: ({ amount, asset, recipient, signer, connection, }: DepositParams) => Promise<_solana_web3_js.TransactionInstruction>;
27
70
 
28
- export { getDepositIx, getWithdrawIx };
71
+ export { getDepositContext, getDepositIx, getWithdrawContext, getWithdrawIx };
29
72
  export type { ConnectionParams, DepositContextParams, DepositParams, WithdrawContextParams, WithdrawParams };
@@ -8,22 +8,65 @@ type ConnectionParams = {
8
8
  };
9
9
  type DepositContextParams = {
10
10
  asset: PublicKey;
11
- receipient?: PublicKey;
11
+ recipient?: PublicKey;
12
12
  signer: PublicKey;
13
13
  };
14
14
  type DepositParams = {
15
15
  amount: BN;
16
16
  } & DepositContextParams & ConnectionParams;
17
- declare const getDepositIx: ({ amount, asset, receipient, signer, connection, }: DepositParams) => Promise<_solana_web3_js.TransactionInstruction>;
17
+ declare function getDepositContext({ recipient, asset, signer, }: DepositContextParams): {
18
+ signer: PublicKey;
19
+ depositorTokenAccount: PublicKey;
20
+ recipientTokenAccount: PublicKey;
21
+ lendingAdmin: PublicKey;
22
+ lending: PublicKey;
23
+ fTokenMint: PublicKey;
24
+ claimAccount: PublicKey;
25
+ supplyTokenReservesLiquidity: PublicKey;
26
+ borrowTokenReservesLiquidity: PublicKey;
27
+ lendingSupplyPositionOnLiquidity: PublicKey;
28
+ lendingBorrowPositionOnLiquidity: PublicKey;
29
+ rateModel: PublicKey;
30
+ vault: PublicKey;
31
+ liquidity: PublicKey;
32
+ liquidityProgram: PublicKey;
33
+ rewardsRateModel: PublicKey;
34
+ tokenProgram: PublicKey;
35
+ associatedTokenProgram: PublicKey;
36
+ systemProgram: PublicKey;
37
+ sysvarInstruction: PublicKey;
38
+ };
39
+ declare const getDepositIx: ({ amount, asset, recipient, signer, connection, }: DepositParams) => Promise<_solana_web3_js.TransactionInstruction>;
18
40
  type WithdrawContextParams = {
19
41
  asset: PublicKey;
20
- receipient?: PublicKey;
42
+ recipient?: PublicKey;
21
43
  signer: PublicKey;
22
44
  };
23
45
  type WithdrawParams = {
24
46
  amount: BN;
25
47
  } & WithdrawContextParams & ConnectionParams;
26
- declare const getWithdrawIx: ({ amount, asset, receipient, signer, connection, }: DepositParams) => Promise<_solana_web3_js.TransactionInstruction>;
48
+ declare function getWithdrawContext({ asset, recipient, signer, }: WithdrawContextParams): {
49
+ signer: PublicKey;
50
+ ownerTokenAccount: PublicKey;
51
+ recipientTokenAccount: PublicKey;
52
+ lendingAdmin: PublicKey;
53
+ lending: PublicKey;
54
+ mint: PublicKey;
55
+ claimAccount: PublicKey;
56
+ fTokenMint: PublicKey;
57
+ supplyTokenReservesLiquidity: PublicKey;
58
+ lendingSupplyPositionOnLiquidity: PublicKey;
59
+ rateModel: PublicKey;
60
+ vault: PublicKey;
61
+ liquidity: PublicKey;
62
+ liquidityProgram: PublicKey;
63
+ rewardsRateModel: PublicKey;
64
+ tokenProgram: PublicKey;
65
+ associatedTokenProgram: PublicKey;
66
+ systemProgram: PublicKey;
67
+ sysvarInstruction: PublicKey;
68
+ };
69
+ declare const getWithdrawIx: ({ amount, asset, recipient, signer, connection, }: DepositParams) => Promise<_solana_web3_js.TransactionInstruction>;
27
70
 
28
- export { getDepositIx, getWithdrawIx };
71
+ export { getDepositContext, getDepositIx, getWithdrawContext, getWithdrawIx };
29
72
  export type { ConnectionParams, DepositContextParams, DepositParams, WithdrawContextParams, WithdrawParams };
@@ -1,23 +1,23 @@
1
1
  import { SYSVAR_INSTRUCTIONS_PUBKEY, SystemProgram, PublicKey } from '@solana/web3.js';
2
2
  import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from '@solana/spl-token';
3
3
  import { Program } from '@coral-xyz/anchor';
4
- import { c as lending, g as getLendingToken, d as getLending, e as getLiquidity, f as getLendingRewardsRateModel, h as getRateModel, i as getUserBorrowPosition, j as getUserSupplyPosition, k as getTokenReserveFromAsset, m as getClaimAccount, n as getLendingAdmin, o as liquidity } from '../shared/lend.CjksRhKO.mjs';
4
+ import { g as getLendingToken, c as getLending, d as getLiquidity, e as getLendingRewardsRateModel, f as getRateModel, h as getUserBorrowPosition, i as getUserSupplyPosition, j as getTokenReserveFromAsset, k as getClaimAccount, m as getLendingAdmin, n as liquidity, o as lending } from '../shared/lend.CVUdR9IA.mjs';
5
5
 
6
6
  function getDepositContext({
7
- receipient,
7
+ recipient,
8
8
  asset,
9
9
  signer
10
10
  }) {
11
11
  const lendingToken = getLendingToken(asset);
12
12
  const lending2 = getLending(asset);
13
13
  const liquidityKey = getLiquidity();
14
- receipient = receipient ?? signer;
14
+ recipient = recipient ?? signer;
15
15
  return {
16
16
  signer,
17
17
  depositorTokenAccount: getAssociatedTokenAddressSync(asset, signer),
18
- receipientTokenAccount: getAssociatedTokenAddressSync(
18
+ recipientTokenAccount: getAssociatedTokenAddressSync(
19
19
  lendingToken,
20
- receipient,
20
+ recipient,
21
21
  false
22
22
  ),
23
23
  lendingAdmin: getLendingAdmin(),
@@ -56,7 +56,7 @@ function getDepositContext({
56
56
  const getDepositIx = async ({
57
57
  amount,
58
58
  asset,
59
- receipient,
59
+ recipient,
60
60
  signer,
61
61
  connection
62
62
  }) => {
@@ -67,46 +67,41 @@ const getDepositIx = async ({
67
67
  return await program.methods.deposit(amount).accounts(
68
68
  getDepositContext({
69
69
  asset,
70
- receipient,
70
+ recipient,
71
71
  signer
72
72
  })
73
73
  ).instruction();
74
74
  };
75
75
  function getWithdrawContext({
76
76
  asset,
77
- receipient,
77
+ recipient,
78
78
  signer
79
79
  }) {
80
80
  const lendingToken = getLendingToken(asset);
81
81
  const lending2 = getLending(asset);
82
82
  const liquidityKey = getLiquidity();
83
- receipient = receipient ?? signer;
83
+ recipient = recipient ?? signer;
84
84
  return {
85
85
  signer,
86
86
  ownerTokenAccount: getAssociatedTokenAddressSync(lendingToken, signer),
87
- receipientTokenAccount: getAssociatedTokenAddressSync(
87
+ recipientTokenAccount: getAssociatedTokenAddressSync(
88
88
  asset,
89
- receipient,
89
+ recipient,
90
90
  false
91
91
  ),
92
92
  lendingAdmin: getLendingAdmin(),
93
93
  lending: lending2,
94
94
  mint: asset,
95
- fTokenMint: lendingToken,
96
95
  claimAccount: getClaimAccount(
97
96
  asset,
98
97
  getLendingAdmin()
99
98
  ),
99
+ fTokenMint: lendingToken,
100
100
  supplyTokenReservesLiquidity: getTokenReserveFromAsset(asset),
101
- borrowTokenReservesLiquidity: getTokenReserveFromAsset(asset),
102
101
  lendingSupplyPositionOnLiquidity: getUserSupplyPosition(
103
102
  asset,
104
103
  lending2
105
104
  ),
106
- lendingBorrowPositionOnLiquidity: getUserBorrowPosition(
107
- asset,
108
- lending2
109
- ),
110
105
  rateModel: getRateModel(asset),
111
106
  vault: getAssociatedTokenAddressSync(
112
107
  asset,
@@ -126,7 +121,7 @@ function getWithdrawContext({
126
121
  const getWithdrawIx = async ({
127
122
  amount,
128
123
  asset,
129
- receipient,
124
+ recipient,
130
125
  signer,
131
126
  connection
132
127
  }) => {
@@ -137,10 +132,10 @@ const getWithdrawIx = async ({
137
132
  return await program.methods.withdraw(amount).accounts(
138
133
  getWithdrawContext({
139
134
  asset,
140
- receipient,
135
+ recipient,
141
136
  signer
142
137
  })
143
138
  ).instruction();
144
139
  };
145
140
 
146
- export { getDepositIx, getWithdrawIx };
141
+ export { getDepositContext, getDepositIx, getWithdrawContext, getWithdrawIx };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export { l as lendingPda, b as lendingRewardRateModelPda, a as liquidityPda } from './shared/lend.CjksRhKO.mjs';
1
+ export { l as lendingPda, b as lendingRewardRateModelPda, a as liquidityPda } from './shared/lend.CVUdR9IA.mjs';
2
2
  import '@solana/web3.js';
@@ -3022,4 +3022,4 @@ const lendingRewardRateModel = {
3022
3022
  getLendingRewardsRateModel: getLendingRewardsRateModel
3023
3023
  };
3024
3024
 
3025
- export { liquidity as a, lendingRewardRateModel as b, lending$1 as c, getLending as d, getLiquidity as e, getLendingRewardsRateModel as f, getLendingToken as g, getRateModel as h, getUserBorrowPosition as i, getUserSupplyPosition as j, getTokenReserveFromAsset as k, lending as l, getClaimAccount as m, getLendingAdmin as n, liquidity$1 as o };
3025
+ export { liquidity as a, lendingRewardRateModel as b, getLending as c, getLiquidity as d, getLendingRewardsRateModel as e, getRateModel as f, getLendingToken as g, getUserBorrowPosition as h, getUserSupplyPosition as i, getTokenReserveFromAsset as j, getClaimAccount as k, lending as l, getLendingAdmin as m, liquidity$1 as n, lending$1 as o };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jup-ag/lend",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "type": "module",