@lavarage/sdk 7.5.21 → 8.0.1
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/constants.ts +6 -0
- package/crossbar.ts +53 -0
- package/dist/index.d.mts +5559 -1791
- package/dist/index.d.ts +5559 -1791
- package/dist/index.js +3502 -4975
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3301 -4772
- package/dist/index.mjs.map +1 -1
- package/docs/functions/borrowV1.html +1 -1
- package/docs/functions/borrowV2.html +1 -1
- package/docs/functions/closePositionEvm.html +2 -2
- package/docs/functions/closeTradeV1.html +2 -2
- package/docs/functions/closeTradeV2.html +2 -2
- package/docs/functions/createTpDelegate.html +2 -2
- package/docs/functions/getActiveLoanCountEvm.html +2 -2
- package/docs/functions/getActiveLoansBatchEvm.html +2 -2
- package/docs/functions/getAllPositions.html +2 -2
- package/docs/functions/getAvailableExposureEvm.html +2 -2
- package/docs/functions/getClosedPositions.html +2 -2
- package/docs/functions/getClosedPositionsEvm.html +2 -2
- package/docs/functions/getCollateralExposureEvm.html +2 -2
- package/docs/functions/getCollateralInfoEvm.html +2 -2
- package/docs/functions/getDelegateAccounts.html +2 -2
- package/docs/functions/getLiquidatedPositions.html +2 -2
- package/docs/functions/getLiquidatedPositionsEvm.html +2 -2
- package/docs/functions/getLoanEvm.html +2 -2
- package/docs/functions/getLoansByBorrowerEvm.html +2 -2
- package/docs/functions/getOffers.html +2 -2
- package/docs/functions/getOffersEvm.html +2 -2
- package/docs/functions/getOpenPositions.html +2 -2
- package/docs/functions/getOpeningFeeEvm.html +2 -2
- package/docs/functions/getPda.html +2 -2
- package/docs/functions/getPositionAccountPDA.html +2 -2
- package/docs/functions/getPositionsEvm.html +2 -2
- package/docs/functions/getProfitFeeEvm.html +2 -2
- package/docs/functions/getTokenBalanceEvm.html +2 -2
- package/docs/functions/getUserLoansEvm.html +2 -2
- package/docs/functions/lending.addToWithdrawalAccessList.html +1 -1
- package/docs/functions/lending.createOffer.html +2 -2
- package/docs/functions/lending.depositFunds.html +2 -2
- package/docs/functions/lending.getNodeWalletPDA.html +2 -2
- package/docs/functions/lending.getTradingPoolPDA.html +2 -2
- package/docs/functions/lending.getWithdrawalAccessList.html +1 -1
- package/docs/functions/lending.getWithdrawalAccessListPDA.html +1 -1
- package/docs/functions/lending.removeFromWithdrawalAccessList.html +1 -1
- package/docs/functions/lending.updateInterestRate.html +2 -2
- package/docs/functions/lending.updateMaxBorrow.html +2 -2
- package/docs/functions/lending.updateMaxExposure.html +2 -2
- package/docs/functions/lending.updateOffer.html +2 -2
- package/docs/functions/lending.withdrawFunds.html +2 -2
- package/docs/functions/lending.withdrawFundsV1.html +2 -2
- package/docs/functions/lending.withdrawFundsV2.html +2 -2
- package/docs/functions/liquidatePositionEvm.html +2 -2
- package/docs/functions/mergePositionV2.html +2 -2
- package/docs/functions/modifyTpDelegate.html +2 -2
- package/docs/functions/openPositionEvm.html +2 -2
- package/docs/functions/openTradeV1.html +2 -2
- package/docs/functions/openTradeV2.html +2 -2
- package/docs/functions/partialRepayV1.html +2 -2
- package/docs/functions/partialRepayV2.html +2 -2
- package/docs/functions/removeTpDelegate.html +2 -2
- package/docs/functions/splitPositionV2.html +2 -2
- package/docs/functions/updateMaxLendPerTokenBatchEvm.html +2 -2
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +2 -2
- package/docs/modules/IDLV2.html +2 -2
- package/docs/modules/lending.html +1 -1
- package/docs/modules.html +2 -2
- package/docs/types/IDLV2.Lavarage.html +2 -2
- package/docs/types/Lavarage.html +2 -2
- package/docs/variables/IDL.html +1 -1
- package/docs/variables/IDLV2.IDL.html +1 -1
- package/idl/lavarageSOL.json +1852 -0
- package/idl/lavarageSOL.ts +1858 -0
- package/idl/lavarageUSDC.json +5377 -0
- package/idl/lavarageUSDC.ts +5383 -0
- package/idl/userVault.json +244 -0
- package/idl/userVault.ts +250 -0
- package/index.ts +81 -42
- package/lending.ts +225 -86
- package/package.json +6 -4
- package/switchboard.ts +23 -0
- package/tsconfig.json +2 -1
- package/utils.ts +54 -0
- package/idl/lavarage.ts +0 -3465
- package/idl/lavaragev2.ts +0 -3791
- package/idl/referralVault.ts +0 -276
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
{
|
|
2
|
+
"address": "F7L3T5fjHbD13SH8UhNuYxCdabHX9CRg2zxbPjmiwU7R",
|
|
3
|
+
"metadata": {
|
|
4
|
+
"name": "user_vault",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"spec": "0.1.0",
|
|
7
|
+
"description": "User vault program for holding SOL and SPL tokens"
|
|
8
|
+
},
|
|
9
|
+
"instructions": [
|
|
10
|
+
{
|
|
11
|
+
"name": "claim_sol",
|
|
12
|
+
"discriminator": [
|
|
13
|
+
139,
|
|
14
|
+
113,
|
|
15
|
+
179,
|
|
16
|
+
189,
|
|
17
|
+
190,
|
|
18
|
+
30,
|
|
19
|
+
132,
|
|
20
|
+
195
|
|
21
|
+
],
|
|
22
|
+
"accounts": [
|
|
23
|
+
{
|
|
24
|
+
"name": "user_vault",
|
|
25
|
+
"writable": true,
|
|
26
|
+
"pda": {
|
|
27
|
+
"seeds": [
|
|
28
|
+
{
|
|
29
|
+
"kind": "const",
|
|
30
|
+
"value": [
|
|
31
|
+
117,
|
|
32
|
+
115,
|
|
33
|
+
101,
|
|
34
|
+
114,
|
|
35
|
+
95,
|
|
36
|
+
118,
|
|
37
|
+
97,
|
|
38
|
+
117,
|
|
39
|
+
108,
|
|
40
|
+
116
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"kind": "account",
|
|
45
|
+
"path": "user_vault.user",
|
|
46
|
+
"account": "UserVault"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "signer",
|
|
53
|
+
"signer": true
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "recipient",
|
|
57
|
+
"writable": true
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"args": [
|
|
61
|
+
{
|
|
62
|
+
"name": "amount",
|
|
63
|
+
"type": "u64"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "claim_token",
|
|
69
|
+
"discriminator": [
|
|
70
|
+
116,
|
|
71
|
+
206,
|
|
72
|
+
27,
|
|
73
|
+
191,
|
|
74
|
+
166,
|
|
75
|
+
19,
|
|
76
|
+
0,
|
|
77
|
+
73
|
|
78
|
+
],
|
|
79
|
+
"accounts": [
|
|
80
|
+
{
|
|
81
|
+
"name": "user_vault",
|
|
82
|
+
"pda": {
|
|
83
|
+
"seeds": [
|
|
84
|
+
{
|
|
85
|
+
"kind": "const",
|
|
86
|
+
"value": [
|
|
87
|
+
117,
|
|
88
|
+
115,
|
|
89
|
+
101,
|
|
90
|
+
114,
|
|
91
|
+
95,
|
|
92
|
+
118,
|
|
93
|
+
97,
|
|
94
|
+
117,
|
|
95
|
+
108,
|
|
96
|
+
116
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"kind": "account",
|
|
101
|
+
"path": "user_vault.user",
|
|
102
|
+
"account": "UserVault"
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "vault_token_account",
|
|
109
|
+
"writable": true
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "recipient_token_account",
|
|
113
|
+
"writable": true
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "token_mint"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "signer",
|
|
120
|
+
"signer": true
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "token_program",
|
|
124
|
+
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"args": [
|
|
128
|
+
{
|
|
129
|
+
"name": "amount",
|
|
130
|
+
"type": "u64"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "initialize_vault",
|
|
136
|
+
"discriminator": [
|
|
137
|
+
48,
|
|
138
|
+
191,
|
|
139
|
+
163,
|
|
140
|
+
44,
|
|
141
|
+
71,
|
|
142
|
+
129,
|
|
143
|
+
63,
|
|
144
|
+
164
|
|
145
|
+
],
|
|
146
|
+
"accounts": [
|
|
147
|
+
{
|
|
148
|
+
"name": "user_vault",
|
|
149
|
+
"writable": true,
|
|
150
|
+
"pda": {
|
|
151
|
+
"seeds": [
|
|
152
|
+
{
|
|
153
|
+
"kind": "const",
|
|
154
|
+
"value": [
|
|
155
|
+
117,
|
|
156
|
+
115,
|
|
157
|
+
101,
|
|
158
|
+
114,
|
|
159
|
+
95,
|
|
160
|
+
118,
|
|
161
|
+
97,
|
|
162
|
+
117,
|
|
163
|
+
108,
|
|
164
|
+
116
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"kind": "account",
|
|
169
|
+
"path": "user"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "user",
|
|
176
|
+
"writable": true
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"name": "funder",
|
|
180
|
+
"writable": true,
|
|
181
|
+
"signer": true
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "system_program",
|
|
185
|
+
"address": "11111111111111111111111111111111"
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
"args": []
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"accounts": [
|
|
192
|
+
{
|
|
193
|
+
"name": "UserVault",
|
|
194
|
+
"discriminator": [
|
|
195
|
+
23,
|
|
196
|
+
76,
|
|
197
|
+
96,
|
|
198
|
+
159,
|
|
199
|
+
210,
|
|
200
|
+
10,
|
|
201
|
+
5,
|
|
202
|
+
22
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"errors": [
|
|
207
|
+
{
|
|
208
|
+
"code": 6000,
|
|
209
|
+
"name": "UnauthorizedClaim",
|
|
210
|
+
"msg": "Unauthorized: Only user or authority can claim"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"code": 6001,
|
|
214
|
+
"name": "InsufficientFunds",
|
|
215
|
+
"msg": "Insufficient funds: Vault must maintain rent-exempt balance"
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
"types": [
|
|
219
|
+
{
|
|
220
|
+
"name": "UserVault",
|
|
221
|
+
"type": {
|
|
222
|
+
"kind": "struct",
|
|
223
|
+
"fields": [
|
|
224
|
+
{
|
|
225
|
+
"name": "user",
|
|
226
|
+
"type": "pubkey"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"name": "authority",
|
|
230
|
+
"type": "pubkey"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"name": "bump",
|
|
234
|
+
"type": "u8"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"name": "total_sol_claimed",
|
|
238
|
+
"type": "u64"
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
}
|
package/idl/userVault.ts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
3
|
+
*
|
|
4
|
+
* Note that this is only a type helper and is not the actual IDL. The original
|
|
5
|
+
* IDL can be found at `target/idl/user_vault.json`.
|
|
6
|
+
*/
|
|
7
|
+
export type UserVault = {
|
|
8
|
+
"address": "F7L3T5fjHbD13SH8UhNuYxCdabHX9CRg2zxbPjmiwU7R",
|
|
9
|
+
"metadata": {
|
|
10
|
+
"name": "userVault",
|
|
11
|
+
"version": "0.1.0",
|
|
12
|
+
"spec": "0.1.0",
|
|
13
|
+
"description": "User vault program for holding SOL and SPL tokens"
|
|
14
|
+
},
|
|
15
|
+
"instructions": [
|
|
16
|
+
{
|
|
17
|
+
"name": "claimSol",
|
|
18
|
+
"discriminator": [
|
|
19
|
+
139,
|
|
20
|
+
113,
|
|
21
|
+
179,
|
|
22
|
+
189,
|
|
23
|
+
190,
|
|
24
|
+
30,
|
|
25
|
+
132,
|
|
26
|
+
195
|
|
27
|
+
],
|
|
28
|
+
"accounts": [
|
|
29
|
+
{
|
|
30
|
+
"name": "userVault",
|
|
31
|
+
"writable": true,
|
|
32
|
+
"pda": {
|
|
33
|
+
"seeds": [
|
|
34
|
+
{
|
|
35
|
+
"kind": "const",
|
|
36
|
+
"value": [
|
|
37
|
+
117,
|
|
38
|
+
115,
|
|
39
|
+
101,
|
|
40
|
+
114,
|
|
41
|
+
95,
|
|
42
|
+
118,
|
|
43
|
+
97,
|
|
44
|
+
117,
|
|
45
|
+
108,
|
|
46
|
+
116
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"kind": "account",
|
|
51
|
+
"path": "user_vault.user",
|
|
52
|
+
"account": "userVault"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "signer",
|
|
59
|
+
"signer": true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "recipient",
|
|
63
|
+
"writable": true
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"args": [
|
|
67
|
+
{
|
|
68
|
+
"name": "amount",
|
|
69
|
+
"type": "u64"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "claimToken",
|
|
75
|
+
"discriminator": [
|
|
76
|
+
116,
|
|
77
|
+
206,
|
|
78
|
+
27,
|
|
79
|
+
191,
|
|
80
|
+
166,
|
|
81
|
+
19,
|
|
82
|
+
0,
|
|
83
|
+
73
|
|
84
|
+
],
|
|
85
|
+
"accounts": [
|
|
86
|
+
{
|
|
87
|
+
"name": "userVault",
|
|
88
|
+
"pda": {
|
|
89
|
+
"seeds": [
|
|
90
|
+
{
|
|
91
|
+
"kind": "const",
|
|
92
|
+
"value": [
|
|
93
|
+
117,
|
|
94
|
+
115,
|
|
95
|
+
101,
|
|
96
|
+
114,
|
|
97
|
+
95,
|
|
98
|
+
118,
|
|
99
|
+
97,
|
|
100
|
+
117,
|
|
101
|
+
108,
|
|
102
|
+
116
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"kind": "account",
|
|
107
|
+
"path": "user_vault.user",
|
|
108
|
+
"account": "userVault"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "vaultTokenAccount",
|
|
115
|
+
"writable": true
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "recipientTokenAccount",
|
|
119
|
+
"writable": true
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "tokenMint"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "signer",
|
|
126
|
+
"signer": true
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "tokenProgram",
|
|
130
|
+
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
"args": [
|
|
134
|
+
{
|
|
135
|
+
"name": "amount",
|
|
136
|
+
"type": "u64"
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "initializeVault",
|
|
142
|
+
"discriminator": [
|
|
143
|
+
48,
|
|
144
|
+
191,
|
|
145
|
+
163,
|
|
146
|
+
44,
|
|
147
|
+
71,
|
|
148
|
+
129,
|
|
149
|
+
63,
|
|
150
|
+
164
|
|
151
|
+
],
|
|
152
|
+
"accounts": [
|
|
153
|
+
{
|
|
154
|
+
"name": "userVault",
|
|
155
|
+
"writable": true,
|
|
156
|
+
"pda": {
|
|
157
|
+
"seeds": [
|
|
158
|
+
{
|
|
159
|
+
"kind": "const",
|
|
160
|
+
"value": [
|
|
161
|
+
117,
|
|
162
|
+
115,
|
|
163
|
+
101,
|
|
164
|
+
114,
|
|
165
|
+
95,
|
|
166
|
+
118,
|
|
167
|
+
97,
|
|
168
|
+
117,
|
|
169
|
+
108,
|
|
170
|
+
116
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"kind": "account",
|
|
175
|
+
"path": "user"
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "user",
|
|
182
|
+
"writable": true
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "funder",
|
|
186
|
+
"writable": true,
|
|
187
|
+
"signer": true
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "systemProgram",
|
|
191
|
+
"address": "11111111111111111111111111111111"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"args": []
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"accounts": [
|
|
198
|
+
{
|
|
199
|
+
"name": "userVault",
|
|
200
|
+
"discriminator": [
|
|
201
|
+
23,
|
|
202
|
+
76,
|
|
203
|
+
96,
|
|
204
|
+
159,
|
|
205
|
+
210,
|
|
206
|
+
10,
|
|
207
|
+
5,
|
|
208
|
+
22
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
"errors": [
|
|
213
|
+
{
|
|
214
|
+
"code": 6000,
|
|
215
|
+
"name": "unauthorizedClaim",
|
|
216
|
+
"msg": "Unauthorized: Only user or authority can claim"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"code": 6001,
|
|
220
|
+
"name": "insufficientFunds",
|
|
221
|
+
"msg": "Insufficient funds: Vault must maintain rent-exempt balance"
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
"types": [
|
|
225
|
+
{
|
|
226
|
+
"name": "userVault",
|
|
227
|
+
"type": {
|
|
228
|
+
"kind": "struct",
|
|
229
|
+
"fields": [
|
|
230
|
+
{
|
|
231
|
+
"name": "user",
|
|
232
|
+
"type": "pubkey"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"name": "authority",
|
|
236
|
+
"type": "pubkey"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"name": "bump",
|
|
240
|
+
"type": "u8"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"name": "totalSolClaimed",
|
|
244
|
+
"type": "u64"
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
|
+
};
|