@glamsystems/glam-sdk 1.0.12-alpha.1 → 1.0.12-alpha.3

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.
Files changed (53) hide show
  1. package/index.cjs.js +1307 -2196
  2. package/index.esm.js +1305 -2197
  3. package/package.json +1 -1
  4. package/src/client/base.d.ts +1 -1
  5. package/src/client/fees.d.ts +0 -3
  6. package/src/client/jupiter.d.ts +3 -0
  7. package/src/client/kamino/lending.d.ts +6 -0
  8. package/src/client/stake.d.ts +1 -1
  9. package/src/client/state.d.ts +0 -2
  10. package/src/deser/driftLayouts.d.ts +4 -0
  11. package/src/deser/integrationPolicies.d.ts +3 -3
  12. package/src/error.d.ts +23 -2
  13. package/src/glamExports.d.ts +29 -0
  14. package/src/models/state.d.ts +0 -4
  15. package/src/react/query-keys.d.ts +1 -0
  16. package/src/utils/transaction.d.ts +5 -2
  17. package/target/idl/ext_cctp.json +0 -6
  18. package/target/idl/ext_drift-staging.json +0 -6
  19. package/target/idl/ext_drift.json +0 -6
  20. package/target/idl/ext_kamino-staging.json +313 -6
  21. package/target/idl/ext_kamino.json +205 -6
  22. package/target/idl/ext_marinade.json +0 -6
  23. package/target/idl/ext_spl-staging.json +0 -6
  24. package/target/idl/ext_spl.json +0 -6
  25. package/target/idl/ext_stake_pool-staging.json +0 -6
  26. package/target/idl/ext_stake_pool.json +0 -6
  27. package/target/idl/glam_mint-staging.json +0 -6
  28. package/target/idl/glam_mint.json +0 -229
  29. package/target/idl/glam_protocol-staging.json +0 -271
  30. package/target/idl/glam_protocol.json +129 -1086
  31. package/target/types/ext_cctp.d.ts +0 -6
  32. package/target/types/ext_cctp.ts +0 -6
  33. package/target/types/ext_drift-staging.ts +0 -6
  34. package/target/types/ext_drift.d.ts +0 -6
  35. package/target/types/ext_drift.ts +0 -6
  36. package/target/types/ext_kamino-staging.ts +313 -6
  37. package/target/types/ext_kamino.d.ts +205 -6
  38. package/target/types/ext_kamino.ts +205 -6
  39. package/target/types/ext_marinade.d.ts +0 -6
  40. package/target/types/ext_marinade.ts +0 -6
  41. package/target/types/ext_offchain.d.ts +0 -6
  42. package/target/types/ext_spl-staging.ts +0 -6
  43. package/target/types/ext_spl.d.ts +0 -6
  44. package/target/types/ext_spl.ts +0 -6
  45. package/target/types/ext_stake_pool-staging.ts +0 -6
  46. package/target/types/ext_stake_pool.d.ts +0 -6
  47. package/target/types/ext_stake_pool.ts +0 -6
  48. package/target/types/glam_mint-staging.ts +0 -6
  49. package/target/types/glam_mint.d.ts +0 -229
  50. package/target/types/glam_mint.ts +0 -229
  51. package/target/types/glam_protocol-staging.ts +0 -271
  52. package/target/types/glam_protocol.d.ts +129 -1086
  53. package/target/types/glam_protocol.ts +128 -1085
package/index.cjs.js CHANGED
@@ -6,7 +6,7 @@ var splToken = require('@solana/spl-token');
6
6
  var splTokenMetadata = require('@solana/spl-token-metadata');
7
7
  var borsh = require('@coral-xyz/borsh');
8
8
  var bytes = require('@coral-xyz/anchor/dist/cjs/utils/bytes');
9
- var fzstd = require('fzstd');
9
+ require('fzstd');
10
10
  var Decimal = require('decimal.js');
11
11
  var zod = require('zod');
12
12
  var sanctumLstList = require('@glamsystems/sanctum-lst-list');
@@ -66,327 +66,6 @@ var instructions$h = [
66
66
  ],
67
67
  args: []
68
68
  },
69
- {
70
- name: "charge_protocol_fee",
71
- docs: [
72
- "Charges protocol base fee on non-tokenized vaults"
73
- ],
74
- discriminator: [
75
- 48,
76
- 225,
77
- 89,
78
- 103,
79
- 48,
80
- 65,
81
- 183,
82
- 238
83
- ],
84
- accounts: [
85
- {
86
- name: "glam_state",
87
- writable: true
88
- },
89
- {
90
- name: "glam_vault",
91
- writable: true,
92
- pda: {
93
- seeds: [
94
- {
95
- kind: "const",
96
- value: [
97
- 118,
98
- 97,
99
- 117,
100
- 108,
101
- 116
102
- ]
103
- },
104
- {
105
- kind: "account",
106
- path: "glam_state"
107
- }
108
- ]
109
- }
110
- },
111
- {
112
- name: "signer",
113
- writable: true,
114
- signer: true
115
- },
116
- {
117
- name: "deposit_asset"
118
- },
119
- {
120
- name: "vault_deposit_ata",
121
- writable: true,
122
- pda: {
123
- seeds: [
124
- {
125
- kind: "account",
126
- path: "glam_vault"
127
- },
128
- {
129
- kind: "account",
130
- path: "deposit_token_program"
131
- },
132
- {
133
- kind: "account",
134
- path: "deposit_asset"
135
- }
136
- ],
137
- program: {
138
- kind: "const",
139
- value: [
140
- 140,
141
- 151,
142
- 37,
143
- 143,
144
- 78,
145
- 36,
146
- 137,
147
- 241,
148
- 187,
149
- 61,
150
- 16,
151
- 41,
152
- 20,
153
- 142,
154
- 13,
155
- 131,
156
- 11,
157
- 90,
158
- 19,
159
- 153,
160
- 218,
161
- 255,
162
- 16,
163
- 132,
164
- 4,
165
- 142,
166
- 123,
167
- 216,
168
- 219,
169
- 233,
170
- 248,
171
- 89
172
- ]
173
- }
174
- }
175
- },
176
- {
177
- name: "protocol_fee_authority"
178
- },
179
- {
180
- name: "protocol_fee_authority_ata",
181
- writable: true,
182
- pda: {
183
- seeds: [
184
- {
185
- kind: "account",
186
- path: "protocol_fee_authority"
187
- },
188
- {
189
- kind: "account",
190
- path: "deposit_token_program"
191
- },
192
- {
193
- kind: "account",
194
- path: "deposit_asset"
195
- }
196
- ],
197
- program: {
198
- kind: "const",
199
- value: [
200
- 140,
201
- 151,
202
- 37,
203
- 143,
204
- 78,
205
- 36,
206
- 137,
207
- 241,
208
- 187,
209
- 61,
210
- 16,
211
- 41,
212
- 20,
213
- 142,
214
- 13,
215
- 131,
216
- 11,
217
- 90,
218
- 19,
219
- 153,
220
- 218,
221
- 255,
222
- 16,
223
- 132,
224
- 4,
225
- 142,
226
- 123,
227
- 216,
228
- 219,
229
- 233,
230
- 248,
231
- 89
232
- ]
233
- }
234
- }
235
- },
236
- {
237
- name: "glam_config",
238
- pda: {
239
- seeds: [
240
- {
241
- kind: "const",
242
- value: [
243
- 103,
244
- 108,
245
- 111,
246
- 98,
247
- 97,
248
- 108,
249
- 45,
250
- 99,
251
- 111,
252
- 110,
253
- 102,
254
- 105,
255
- 103
256
- ]
257
- }
258
- ],
259
- program: {
260
- kind: "const",
261
- value: [
262
- 10,
263
- 11,
264
- 0,
265
- 83,
266
- 72,
267
- 16,
268
- 46,
269
- 144,
270
- 46,
271
- 42,
272
- 79,
273
- 22,
274
- 157,
275
- 123,
276
- 21,
277
- 242,
278
- 192,
279
- 146,
280
- 1,
281
- 78,
282
- 88,
283
- 59,
284
- 102,
285
- 9,
286
- 190,
287
- 226,
288
- 92,
289
- 189,
290
- 187,
291
- 232,
292
- 83,
293
- 220
294
- ]
295
- }
296
- }
297
- },
298
- {
299
- name: "system_program",
300
- address: "11111111111111111111111111111111"
301
- },
302
- {
303
- name: "associated_token_program",
304
- address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
305
- },
306
- {
307
- name: "deposit_token_program"
308
- }
309
- ],
310
- args: []
311
- },
312
- {
313
- name: "check_and_update_transfer_tracker",
314
- discriminator: [
315
- 180,
316
- 225,
317
- 201,
318
- 123,
319
- 192,
320
- 30,
321
- 178,
322
- 195
323
- ],
324
- accounts: [
325
- {
326
- name: "glam_state"
327
- },
328
- {
329
- name: "glam_signer",
330
- writable: true,
331
- signer: true
332
- },
333
- {
334
- name: "transfer_tracker",
335
- writable: true,
336
- pda: {
337
- seeds: [
338
- {
339
- kind: "const",
340
- value: [
341
- 116,
342
- 114,
343
- 97,
344
- 110,
345
- 115,
346
- 102,
347
- 101,
348
- 114,
349
- 45,
350
- 116,
351
- 114,
352
- 97,
353
- 99,
354
- 107,
355
- 101,
356
- 114
357
- ]
358
- },
359
- {
360
- kind: "account",
361
- path: "glam_state"
362
- },
363
- {
364
- kind: "account",
365
- path: "glam_signer"
366
- },
367
- {
368
- kind: "arg",
369
- path: "mint"
370
- }
371
- ]
372
- }
373
- },
374
- {
375
- name: "system_program",
376
- address: "11111111111111111111111111111111"
377
- }
378
- ],
379
- args: [
380
- {
381
- name: "mint",
382
- type: "pubkey"
383
- },
384
- {
385
- name: "amount",
386
- type: "u64"
387
- }
388
- ]
389
- },
390
69
  {
391
70
  name: "close_state",
392
71
  discriminator: [
@@ -781,755 +460,192 @@ var instructions$h = [
781
460
  },
782
461
  {
783
462
  name: "cpi_program",
784
- address: "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
785
- },
786
- {
787
- name: "input_stake_pool",
788
- optional: true
789
- },
790
- {
791
- name: "output_stake_pool",
792
- optional: true
793
- }
794
- ],
795
- args: [
796
- {
797
- name: "data",
798
- type: "bytes"
799
- }
800
- ]
801
- },
802
- {
803
- name: "link_unlink_mint_by_mint_authority",
804
- docs: [
805
- "For glam mint program's use only"
806
- ],
807
- discriminator: [
808
- 85,
809
- 67,
810
- 58,
811
- 245,
812
- 175,
813
- 14,
814
- 122,
815
- 6
816
- ],
817
- accounts: [
818
- {
819
- name: "glam_state",
820
- writable: true
821
- },
822
- {
823
- name: "glam_mint"
824
- },
825
- {
826
- name: "glam_mint_authority",
827
- signer: true
828
- }
829
- ],
830
- args: [
831
- {
832
- name: "link",
833
- type: "bool"
834
- }
835
- ]
836
- },
837
- {
838
- name: "reset_priced_protocols_by_mint_authority",
839
- docs: [
840
- "For glam mint program's use only"
841
- ],
842
- discriminator: [
843
- 86,
844
- 95,
845
- 153,
846
- 145,
847
- 179,
848
- 181,
849
- 107,
850
- 235
851
- ],
852
- accounts: [
853
- {
854
- name: "glam_state",
855
- writable: true
856
- },
857
- {
858
- name: "glam_mint"
859
- },
860
- {
861
- name: "glam_mint_authority",
862
- signer: true
863
- }
864
- ],
865
- args: []
866
- },
867
- {
868
- name: "set_jupiter_swap_policy",
869
- discriminator: [
870
- 189,
871
- 182,
872
- 227,
873
- 165,
874
- 127,
875
- 148,
876
- 246,
877
- 189
878
- ],
879
- accounts: [
880
- {
881
- name: "glam_state",
882
- writable: true
883
- },
884
- {
885
- name: "glam_signer",
886
- writable: true,
887
- signer: true
888
- }
889
- ],
890
- args: [
891
- {
892
- name: "policy",
893
- type: {
894
- defined: {
895
- name: "JupiterSwapPolicy"
896
- }
897
- }
898
- }
899
- ]
900
- },
901
- {
902
- name: "set_protocol_policy",
903
- discriminator: [
904
- 37,
905
- 99,
906
- 61,
907
- 122,
908
- 227,
909
- 102,
910
- 182,
911
- 180
912
- ],
913
- accounts: [
914
- {
915
- name: "glam_state",
916
- writable: true
917
- },
918
- {
919
- name: "glam_signer",
920
- writable: true,
921
- signer: true
922
- }
923
- ],
924
- args: [
925
- {
926
- name: "integration_program",
927
- type: "pubkey"
928
- },
929
- {
930
- name: "protocol_bitflag",
931
- type: "u16"
932
- },
933
- {
934
- name: "data",
935
- type: "bytes"
936
- }
937
- ]
938
- },
939
- {
940
- name: "set_system_transfer_policy",
941
- discriminator: [
942
- 102,
943
- 21,
944
- 157,
945
- 101,
946
- 19,
947
- 4,
948
- 100,
949
- 213
950
- ],
951
- accounts: [
952
- {
953
- name: "glam_state",
954
- writable: true
955
- },
956
- {
957
- name: "glam_signer",
958
- writable: true,
959
- signer: true
960
- }
961
- ],
962
- args: [
963
- {
964
- name: "policy",
965
- type: {
966
- defined: {
967
- name: "TransferPolicy"
968
- }
969
- }
970
- }
971
- ]
972
- },
973
- {
974
- name: "set_transfer_rate_limit_policy",
975
- discriminator: [
976
- 27,
977
- 40,
978
- 234,
979
- 194,
980
- 151,
981
- 218,
982
- 55,
983
- 203
984
- ],
985
- accounts: [
986
- {
987
- name: "glam_state",
988
- writable: true
989
- },
990
- {
991
- name: "glam_signer",
992
- writable: true,
993
- signer: true
994
- }
995
- ],
996
- args: [
997
- {
998
- name: "policy",
999
- type: {
1000
- defined: {
1001
- name: "TransferRateLimitPolicy"
1002
- }
1003
- }
1004
- }
1005
- ]
1006
- },
1007
- {
1008
- name: "stake_authorize",
1009
- discriminator: [
1010
- 127,
1011
- 247,
1012
- 88,
1013
- 164,
1014
- 201,
1015
- 0,
1016
- 79,
1017
- 7
1018
- ],
1019
- accounts: [
1020
- {
1021
- name: "glam_state",
1022
- writable: true
1023
- },
1024
- {
1025
- name: "glam_vault",
1026
- writable: true,
1027
- pda: {
1028
- seeds: [
1029
- {
1030
- kind: "const",
1031
- value: [
1032
- 118,
1033
- 97,
1034
- 117,
1035
- 108,
1036
- 116
1037
- ]
1038
- },
1039
- {
1040
- kind: "account",
1041
- path: "glam_state"
1042
- }
1043
- ]
1044
- }
1045
- },
1046
- {
1047
- name: "glam_signer",
1048
- writable: true,
1049
- signer: true
1050
- },
1051
- {
1052
- name: "cpi_program",
1053
- address: "Stake11111111111111111111111111111111111111"
1054
- },
1055
- {
1056
- name: "stake",
1057
- writable: true
1058
- },
1059
- {
1060
- name: "clock",
1061
- address: "SysvarC1ock11111111111111111111111111111111"
1062
- }
1063
- ],
1064
- args: [
1065
- {
1066
- name: "new_authority",
1067
- type: "pubkey"
1068
- },
1069
- {
1070
- name: "staker_or_withdrawer",
1071
- type: "u32"
1072
- }
1073
- ]
1074
- },
1075
- {
1076
- name: "stake_deactivate",
1077
- discriminator: [
1078
- 224,
1079
- 10,
1080
- 93,
1081
- 175,
1082
- 175,
1083
- 145,
1084
- 237,
1085
- 169
1086
- ],
1087
- accounts: [
1088
- {
1089
- name: "glam_state"
1090
- },
1091
- {
1092
- name: "glam_vault",
1093
- writable: true,
1094
- pda: {
1095
- seeds: [
1096
- {
1097
- kind: "const",
1098
- value: [
1099
- 118,
1100
- 97,
1101
- 117,
1102
- 108,
1103
- 116
1104
- ]
1105
- },
1106
- {
1107
- kind: "account",
1108
- path: "glam_state"
1109
- }
1110
- ]
1111
- }
1112
- },
1113
- {
1114
- name: "glam_signer",
1115
- writable: true,
1116
- signer: true
1117
- },
1118
- {
1119
- name: "cpi_program",
1120
- address: "Stake11111111111111111111111111111111111111"
1121
- },
1122
- {
1123
- name: "stake",
1124
- writable: true
1125
- },
1126
- {
1127
- name: "clock",
1128
- address: "SysvarC1ock11111111111111111111111111111111"
1129
- }
1130
- ],
1131
- args: []
1132
- },
1133
- {
1134
- name: "stake_delegate_stake",
1135
- discriminator: [
1136
- 202,
1137
- 40,
1138
- 152,
1139
- 239,
1140
- 175,
1141
- 251,
1142
- 66,
1143
- 228
1144
- ],
1145
- accounts: [
1146
- {
1147
- name: "glam_state",
1148
- writable: true
1149
- },
1150
- {
1151
- name: "glam_vault",
1152
- writable: true,
1153
- pda: {
1154
- seeds: [
1155
- {
1156
- kind: "const",
1157
- value: [
1158
- 118,
1159
- 97,
1160
- 117,
1161
- 108,
1162
- 116
1163
- ]
1164
- },
1165
- {
1166
- kind: "account",
1167
- path: "glam_state"
1168
- }
1169
- ]
1170
- }
1171
- },
1172
- {
1173
- name: "glam_signer",
1174
- writable: true,
1175
- signer: true
1176
- },
1177
- {
1178
- name: "cpi_program",
1179
- address: "Stake11111111111111111111111111111111111111"
1180
- },
1181
- {
1182
- name: "stake",
1183
- writable: true
1184
- },
1185
- {
1186
- name: "vote"
1187
- },
1188
- {
1189
- name: "clock",
1190
- address: "SysvarC1ock11111111111111111111111111111111"
1191
- },
1192
- {
1193
- name: "stake_history",
1194
- address: "SysvarStakeHistory1111111111111111111111111"
1195
- },
1196
- {
1197
- name: "stake_config"
1198
- }
1199
- ],
1200
- args: []
1201
- },
1202
- {
1203
- name: "stake_initialize",
1204
- discriminator: [
1205
- 68,
1206
- 66,
1207
- 118,
1208
- 79,
1209
- 15,
1210
- 144,
1211
- 190,
1212
- 190
1213
- ],
1214
- accounts: [
1215
- {
1216
- name: "glam_state",
1217
- writable: true
1218
- },
1219
- {
1220
- name: "glam_vault",
1221
- writable: true,
1222
- pda: {
1223
- seeds: [
1224
- {
1225
- kind: "const",
1226
- value: [
1227
- 118,
1228
- 97,
1229
- 117,
1230
- 108,
1231
- 116
1232
- ]
1233
- },
1234
- {
1235
- kind: "account",
1236
- path: "glam_state"
1237
- }
1238
- ]
1239
- }
1240
- },
1241
- {
1242
- name: "glam_signer",
1243
- writable: true,
1244
- signer: true
1245
- },
1246
- {
1247
- name: "cpi_program",
1248
- address: "Stake11111111111111111111111111111111111111"
1249
- },
1250
- {
1251
- name: "stake",
1252
- writable: true
1253
- },
1254
- {
1255
- name: "rent",
1256
- address: "SysvarRent111111111111111111111111111111111"
1257
- },
1258
- {
1259
- name: "system_program",
1260
- address: "11111111111111111111111111111111"
1261
- }
1262
- ],
1263
- args: []
1264
- },
1265
- {
1266
- name: "stake_merge",
1267
- discriminator: [
1268
- 46,
1269
- 181,
1270
- 125,
1271
- 12,
1272
- 51,
1273
- 179,
1274
- 134,
1275
- 176
1276
- ],
1277
- accounts: [
1278
- {
1279
- name: "glam_state",
1280
- writable: true
1281
- },
1282
- {
1283
- name: "glam_vault",
1284
- writable: true,
1285
- pda: {
1286
- seeds: [
1287
- {
1288
- kind: "const",
1289
- value: [
1290
- 118,
1291
- 97,
1292
- 117,
1293
- 108,
1294
- 116
1295
- ]
1296
- },
1297
- {
1298
- kind: "account",
1299
- path: "glam_state"
1300
- }
1301
- ]
1302
- }
1303
- },
1304
- {
1305
- name: "glam_signer",
1306
- writable: true,
1307
- signer: true
1308
- },
1309
- {
1310
- name: "cpi_program",
1311
- address: "Stake11111111111111111111111111111111111111"
1312
- },
1313
- {
1314
- name: "destination_stake",
1315
- writable: true
1316
- },
1317
- {
1318
- name: "source_stake",
1319
- writable: true
1320
- },
1321
- {
1322
- name: "clock",
1323
- address: "SysvarC1ock11111111111111111111111111111111"
1324
- },
1325
- {
1326
- name: "stake_history",
1327
- address: "SysvarStakeHistory1111111111111111111111111"
1328
- }
1329
- ],
1330
- args: []
1331
- },
1332
- {
1333
- name: "stake_move",
1334
- discriminator: [
1335
- 165,
1336
- 157,
1337
- 188,
1338
- 245,
1339
- 244,
1340
- 234,
1341
- 42,
1342
- 186
1343
- ],
1344
- accounts: [
1345
- {
1346
- name: "glam_state",
1347
- writable: true
1348
- },
1349
- {
1350
- name: "glam_vault",
1351
- writable: true,
1352
- pda: {
1353
- seeds: [
1354
- {
1355
- kind: "const",
1356
- value: [
1357
- 118,
1358
- 97,
1359
- 117,
1360
- 108,
1361
- 116
1362
- ]
1363
- },
1364
- {
1365
- kind: "account",
1366
- path: "glam_state"
1367
- }
1368
- ]
1369
- }
1370
- },
1371
- {
1372
- name: "glam_signer",
1373
- writable: true,
1374
- signer: true
1375
- },
1376
- {
1377
- name: "cpi_program",
1378
- address: "Stake11111111111111111111111111111111111111"
1379
- },
1380
- {
1381
- name: "source_stake",
1382
- writable: true
1383
- },
1384
- {
1385
- name: "destination_stake",
1386
- writable: true
1387
- }
1388
- ],
1389
- args: [
1390
- {
1391
- name: "move_stake",
1392
- type: "bool"
1393
- },
1394
- {
1395
- name: "lamports",
1396
- type: "u64"
1397
- }
1398
- ]
1399
- },
1400
- {
1401
- name: "stake_split",
1402
- discriminator: [
1403
- 63,
1404
- 128,
1405
- 169,
1406
- 206,
1407
- 158,
1408
- 60,
1409
- 135,
1410
- 48
1411
- ],
1412
- accounts: [
1413
- {
1414
- name: "glam_state",
1415
- writable: true
1416
- },
1417
- {
1418
- name: "glam_vault",
1419
- writable: true,
1420
- pda: {
1421
- seeds: [
1422
- {
1423
- kind: "const",
1424
- value: [
1425
- 118,
1426
- 97,
1427
- 117,
1428
- 108,
1429
- 116
1430
- ]
1431
- },
1432
- {
1433
- kind: "account",
1434
- path: "glam_state"
1435
- }
1436
- ]
1437
- }
1438
- },
1439
- {
1440
- name: "glam_signer",
1441
- writable: true,
1442
- signer: true
1443
- },
1444
- {
1445
- name: "cpi_program",
1446
- address: "Stake11111111111111111111111111111111111111"
1447
- },
1448
- {
1449
- name: "stake",
1450
- writable: true
1451
- },
1452
- {
1453
- name: "split_stake",
1454
- writable: true
1455
- }
1456
- ],
1457
- args: [
1458
- {
1459
- name: "lamports",
1460
- type: "u64"
1461
- }
1462
- ]
1463
- },
1464
- {
1465
- name: "stake_withdraw",
1466
- discriminator: [
1467
- 199,
1468
- 13,
1469
- 168,
1470
- 20,
1471
- 92,
1472
- 151,
1473
- 29,
1474
- 56
1475
- ],
1476
- accounts: [
1477
- {
1478
- name: "glam_state",
1479
- writable: true
1480
- },
1481
- {
1482
- name: "glam_vault",
1483
- writable: true,
1484
- pda: {
1485
- seeds: [
1486
- {
1487
- kind: "const",
1488
- value: [
1489
- 118,
1490
- 97,
1491
- 117,
1492
- 108,
1493
- 116
1494
- ]
1495
- },
1496
- {
1497
- kind: "account",
1498
- path: "glam_state"
1499
- }
1500
- ]
1501
- }
1502
- },
1503
- {
1504
- name: "glam_signer",
1505
- writable: true,
1506
- signer: true
1507
- },
1508
- {
1509
- name: "cpi_program",
1510
- address: "Stake11111111111111111111111111111111111111"
463
+ address: "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
1511
464
  },
1512
465
  {
1513
- name: "stake",
466
+ name: "input_stake_pool",
467
+ optional: true
468
+ },
469
+ {
470
+ name: "output_stake_pool",
471
+ optional: true
472
+ }
473
+ ],
474
+ args: [
475
+ {
476
+ name: "data",
477
+ type: "bytes"
478
+ }
479
+ ]
480
+ },
481
+ {
482
+ name: "link_unlink_mint_by_mint_authority",
483
+ docs: [
484
+ "For glam mint program's use only"
485
+ ],
486
+ discriminator: [
487
+ 85,
488
+ 67,
489
+ 58,
490
+ 245,
491
+ 175,
492
+ 14,
493
+ 122,
494
+ 6
495
+ ],
496
+ accounts: [
497
+ {
498
+ name: "glam_state",
1514
499
  writable: true
1515
500
  },
1516
501
  {
1517
- name: "clock",
1518
- address: "SysvarC1ock11111111111111111111111111111111"
502
+ name: "glam_mint"
1519
503
  },
1520
504
  {
1521
- name: "stake_history",
1522
- address: "SysvarStakeHistory1111111111111111111111111"
505
+ name: "glam_mint_authority",
506
+ signer: true
507
+ }
508
+ ],
509
+ args: [
510
+ {
511
+ name: "link",
512
+ type: "bool"
513
+ }
514
+ ]
515
+ },
516
+ {
517
+ name: "reset_priced_protocols_by_mint_authority",
518
+ docs: [
519
+ "For glam mint program's use only"
520
+ ],
521
+ discriminator: [
522
+ 86,
523
+ 95,
524
+ 153,
525
+ 145,
526
+ 179,
527
+ 181,
528
+ 107,
529
+ 235
530
+ ],
531
+ accounts: [
532
+ {
533
+ name: "glam_state",
534
+ writable: true
1523
535
  },
1524
536
  {
1525
- name: "system_program",
1526
- address: "11111111111111111111111111111111"
537
+ name: "glam_mint"
538
+ },
539
+ {
540
+ name: "glam_mint_authority",
541
+ signer: true
542
+ }
543
+ ],
544
+ args: []
545
+ },
546
+ {
547
+ name: "set_jupiter_swap_policy",
548
+ discriminator: [
549
+ 189,
550
+ 182,
551
+ 227,
552
+ 165,
553
+ 127,
554
+ 148,
555
+ 246,
556
+ 189
557
+ ],
558
+ accounts: [
559
+ {
560
+ name: "glam_state",
561
+ writable: true
562
+ },
563
+ {
564
+ name: "glam_signer",
565
+ writable: true,
566
+ signer: true
1527
567
  }
1528
568
  ],
1529
569
  args: [
1530
570
  {
1531
- name: "lamports",
1532
- type: "u64"
571
+ name: "policy",
572
+ type: {
573
+ defined: {
574
+ name: "JupiterSwapPolicy"
575
+ }
576
+ }
577
+ }
578
+ ]
579
+ },
580
+ {
581
+ name: "set_protocol_policy",
582
+ discriminator: [
583
+ 37,
584
+ 99,
585
+ 61,
586
+ 122,
587
+ 227,
588
+ 102,
589
+ 182,
590
+ 180
591
+ ],
592
+ accounts: [
593
+ {
594
+ name: "glam_state",
595
+ writable: true
596
+ },
597
+ {
598
+ name: "glam_signer",
599
+ writable: true,
600
+ signer: true
601
+ }
602
+ ],
603
+ args: [
604
+ {
605
+ name: "integration_program",
606
+ type: "pubkey"
607
+ },
608
+ {
609
+ name: "protocol_bitflag",
610
+ type: "u16"
611
+ },
612
+ {
613
+ name: "data",
614
+ type: "bytes"
615
+ }
616
+ ]
617
+ },
618
+ {
619
+ name: "set_system_transfer_policy",
620
+ discriminator: [
621
+ 102,
622
+ 21,
623
+ 157,
624
+ 101,
625
+ 19,
626
+ 4,
627
+ 100,
628
+ 213
629
+ ],
630
+ accounts: [
631
+ {
632
+ name: "glam_state",
633
+ writable: true
634
+ },
635
+ {
636
+ name: "glam_signer",
637
+ writable: true,
638
+ signer: true
639
+ }
640
+ ],
641
+ args: [
642
+ {
643
+ name: "policy",
644
+ type: {
645
+ defined: {
646
+ name: "TransferPolicy"
647
+ }
648
+ }
1533
649
  }
1534
650
  ]
1535
651
  },
@@ -1859,19 +975,6 @@ var accounts$h = [
1859
975
  249,
1860
976
  103
1861
977
  ]
1862
- },
1863
- {
1864
- name: "TransferTracker",
1865
- discriminator: [
1866
- 153,
1867
- 136,
1868
- 2,
1869
- 106,
1870
- 24,
1871
- 146,
1872
- 147,
1873
- 60
1874
- ]
1875
978
  }
1876
979
  ];
1877
980
  var errors$4 = [
@@ -2470,12 +1573,6 @@ var types$h = [
2470
1573
  },
2471
1574
  {
2472
1575
  name: "OracleConfigs"
2473
- },
2474
- {
2475
- name: "ReduceOnly"
2476
- },
2477
- {
2478
- name: "AnyLst"
2479
1576
  }
2480
1577
  ]
2481
1578
  }
@@ -3367,18 +2464,6 @@ var types$h = [
3367
2464
  }
3368
2465
  }
3369
2466
  },
3370
- {
3371
- name: "reduce_only",
3372
- type: {
3373
- option: "bool"
3374
- }
3375
- },
3376
- {
3377
- name: "any_lst",
3378
- type: {
3379
- option: "bool"
3380
- }
3381
- },
3382
2467
  {
3383
2468
  name: "timelock_duration",
3384
2469
  type: {
@@ -3408,16 +2493,6 @@ var types$h = [
3408
2493
  }
3409
2494
  }
3410
2495
  }
3411
- },
3412
- {
3413
- name: "fee_structure",
3414
- type: {
3415
- option: {
3416
- defined: {
3417
- name: "FeeStructure"
3418
- }
3419
- }
3420
- }
3421
2496
  }
3422
2497
  ]
3423
2498
  }
@@ -3478,38 +2553,6 @@ var types$h = [
3478
2553
  ]
3479
2554
  }
3480
2555
  },
3481
- {
3482
- name: "TransferTracker",
3483
- type: {
3484
- kind: "struct",
3485
- fields: [
3486
- {
3487
- name: "vault",
3488
- type: "pubkey"
3489
- },
3490
- {
3491
- name: "signer",
3492
- type: "pubkey"
3493
- },
3494
- {
3495
- name: "mint",
3496
- type: "pubkey"
3497
- },
3498
- {
3499
- name: "period_start",
3500
- type: "i64"
3501
- },
3502
- {
3503
- name: "amount_transferred",
3504
- type: "u64"
3505
- },
3506
- {
3507
- name: "bump",
3508
- type: "u8"
3509
- }
3510
- ]
3511
- }
3512
- },
3513
2556
  {
3514
2557
  name: "ValuationModel",
3515
2558
  type: {
@@ -7269,229 +6312,6 @@ var instructions$f = [
7269
6312
  ],
7270
6313
  args: []
7271
6314
  },
7272
- {
7273
- name: "price_stake_accounts",
7274
- discriminator: [
7275
- 119,
7276
- 137,
7277
- 9,
7278
- 15,
7279
- 196,
7280
- 73,
7281
- 30,
7282
- 27
7283
- ],
7284
- accounts: [
7285
- {
7286
- name: "glam_state",
7287
- writable: true
7288
- },
7289
- {
7290
- name: "glam_vault",
7291
- pda: {
7292
- seeds: [
7293
- {
7294
- kind: "const",
7295
- value: [
7296
- 118,
7297
- 97,
7298
- 117,
7299
- 108,
7300
- 116
7301
- ]
7302
- },
7303
- {
7304
- kind: "account",
7305
- path: "glam_state"
7306
- }
7307
- ],
7308
- program: {
7309
- kind: "const",
7310
- value: [
7311
- 227,
7312
- 199,
7313
- 235,
7314
- 230,
7315
- 176,
7316
- 132,
7317
- 243,
7318
- 117,
7319
- 43,
7320
- 131,
7321
- 173,
7322
- 18,
7323
- 78,
7324
- 255,
7325
- 26,
7326
- 50,
7327
- 209,
7328
- 135,
7329
- 86,
7330
- 219,
7331
- 140,
7332
- 126,
7333
- 61,
7334
- 255,
7335
- 0,
7336
- 218,
7337
- 252,
7338
- 224,
7339
- 172,
7340
- 8,
7341
- 223,
7342
- 207
7343
- ]
7344
- }
7345
- }
7346
- },
7347
- {
7348
- name: "signer",
7349
- writable: true,
7350
- signer: true
7351
- },
7352
- {
7353
- name: "sol_usd_oracle"
7354
- },
7355
- {
7356
- name: "base_asset_oracle"
7357
- },
7358
- {
7359
- name: "integration_authority",
7360
- pda: {
7361
- seeds: [
7362
- {
7363
- kind: "const",
7364
- value: [
7365
- 105,
7366
- 110,
7367
- 116,
7368
- 101,
7369
- 103,
7370
- 114,
7371
- 97,
7372
- 116,
7373
- 105,
7374
- 111,
7375
- 110,
7376
- 45,
7377
- 97,
7378
- 117,
7379
- 116,
7380
- 104,
7381
- 111,
7382
- 114,
7383
- 105,
7384
- 116,
7385
- 121
7386
- ]
7387
- }
7388
- ]
7389
- }
7390
- },
7391
- {
7392
- name: "glam_config",
7393
- pda: {
7394
- seeds: [
7395
- {
7396
- kind: "const",
7397
- value: [
7398
- 103,
7399
- 108,
7400
- 111,
7401
- 98,
7402
- 97,
7403
- 108,
7404
- 45,
7405
- 99,
7406
- 111,
7407
- 110,
7408
- 102,
7409
- 105,
7410
- 103
7411
- ]
7412
- }
7413
- ],
7414
- program: {
7415
- kind: "const",
7416
- value: [
7417
- 10,
7418
- 11,
7419
- 0,
7420
- 83,
7421
- 72,
7422
- 16,
7423
- 46,
7424
- 144,
7425
- 46,
7426
- 42,
7427
- 79,
7428
- 22,
7429
- 157,
7430
- 123,
7431
- 21,
7432
- 242,
7433
- 192,
7434
- 146,
7435
- 1,
7436
- 78,
7437
- 88,
7438
- 59,
7439
- 102,
7440
- 9,
7441
- 190,
7442
- 226,
7443
- 92,
7444
- 189,
7445
- 187,
7446
- 232,
7447
- 83,
7448
- 220
7449
- ]
7450
- }
7451
- }
7452
- },
7453
- {
7454
- name: "glam_protocol",
7455
- address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
7456
- },
7457
- {
7458
- name: "event_authority",
7459
- optional: true,
7460
- pda: {
7461
- seeds: [
7462
- {
7463
- kind: "const",
7464
- value: [
7465
- 95,
7466
- 95,
7467
- 101,
7468
- 118,
7469
- 101,
7470
- 110,
7471
- 116,
7472
- 95,
7473
- 97,
7474
- 117,
7475
- 116,
7476
- 104,
7477
- 111,
7478
- 114,
7479
- 105,
7480
- 116,
7481
- 121
7482
- ]
7483
- }
7484
- ]
7485
- }
7486
- },
7487
- {
7488
- name: "event_program",
7489
- optional: true,
7490
- address: "GM1NtvvnSXUptTrMCqbogAdZJydZSNv98DoU5AZVLmGh"
7491
- }
7492
- ],
7493
- args: []
7494
- },
7495
6315
  {
7496
6316
  name: "price_vault_tokens",
7497
6317
  docs: [
@@ -9292,12 +8112,6 @@ var types$f = [
9292
8112
  },
9293
8113
  {
9294
8114
  name: "OracleConfigs"
9295
- },
9296
- {
9297
- name: "ReduceOnly"
9298
- },
9299
- {
9300
- name: "AnyLst"
9301
8115
  }
9302
8116
  ]
9303
8117
  }
@@ -10863,12 +9677,6 @@ var types$e = [
10863
9677
  },
10864
9678
  {
10865
9679
  name: "OracleConfigs"
10866
- },
10867
- {
10868
- name: "ReduceOnly"
10869
- },
10870
- {
10871
- name: "AnyLst"
10872
9680
  }
10873
9681
  ]
10874
9682
  }
@@ -14484,12 +13292,6 @@ var types$d = [
14484
13292
  },
14485
13293
  {
14486
13294
  name: "OracleConfigs"
14487
- },
14488
- {
14489
- name: "ReduceOnly"
14490
- },
14491
- {
14492
- name: "AnyLst"
14493
13295
  }
14494
13296
  ]
14495
13297
  }
@@ -15930,23 +14732,263 @@ var instructions$c = [
15930
14732
  writable: true
15931
14733
  },
15932
14734
  {
15933
- name: "rent",
15934
- address: "SysvarRent111111111111111111111111111111111"
14735
+ name: "rent",
14736
+ address: "SysvarRent111111111111111111111111111111111"
14737
+ }
14738
+ ],
14739
+ args: []
14740
+ },
14741
+ {
14742
+ name: "farms_stake",
14743
+ discriminator: [
14744
+ 224,
14745
+ 105,
14746
+ 208,
14747
+ 179,
14748
+ 98,
14749
+ 200,
14750
+ 213,
14751
+ 238
14752
+ ],
14753
+ accounts: [
14754
+ {
14755
+ name: "glam_state",
14756
+ writable: true
14757
+ },
14758
+ {
14759
+ name: "glam_vault",
14760
+ writable: true,
14761
+ pda: {
14762
+ seeds: [
14763
+ {
14764
+ kind: "const",
14765
+ value: [
14766
+ 118,
14767
+ 97,
14768
+ 117,
14769
+ 108,
14770
+ 116
14771
+ ]
14772
+ },
14773
+ {
14774
+ kind: "account",
14775
+ path: "glam_state"
14776
+ }
14777
+ ],
14778
+ program: {
14779
+ kind: "account",
14780
+ path: "glam_protocol_program"
14781
+ }
14782
+ }
14783
+ },
14784
+ {
14785
+ name: "glam_signer",
14786
+ writable: true,
14787
+ signer: true
14788
+ },
14789
+ {
14790
+ name: "integration_authority",
14791
+ pda: {
14792
+ seeds: [
14793
+ {
14794
+ kind: "const",
14795
+ value: [
14796
+ 105,
14797
+ 110,
14798
+ 116,
14799
+ 101,
14800
+ 103,
14801
+ 114,
14802
+ 97,
14803
+ 116,
14804
+ 105,
14805
+ 111,
14806
+ 110,
14807
+ 45,
14808
+ 97,
14809
+ 117,
14810
+ 116,
14811
+ 104,
14812
+ 111,
14813
+ 114,
14814
+ 105,
14815
+ 116,
14816
+ 121
14817
+ ]
14818
+ }
14819
+ ]
14820
+ }
14821
+ },
14822
+ {
14823
+ name: "cpi_program",
14824
+ address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"
14825
+ },
14826
+ {
14827
+ name: "glam_protocol_program",
14828
+ address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
14829
+ },
14830
+ {
14831
+ name: "system_program",
14832
+ address: "11111111111111111111111111111111"
14833
+ },
14834
+ {
14835
+ name: "user_state",
14836
+ writable: true
14837
+ },
14838
+ {
14839
+ name: "farm_state",
14840
+ writable: true
14841
+ },
14842
+ {
14843
+ name: "farm_vault",
14844
+ writable: true
14845
+ },
14846
+ {
14847
+ name: "user_ata",
14848
+ writable: true
14849
+ },
14850
+ {
14851
+ name: "token_mint"
14852
+ },
14853
+ {
14854
+ name: "scope_prices",
14855
+ optional: true
14856
+ },
14857
+ {
14858
+ name: "token_program"
14859
+ }
14860
+ ],
14861
+ args: [
14862
+ {
14863
+ name: "amount",
14864
+ type: "u64"
14865
+ }
14866
+ ]
14867
+ },
14868
+ {
14869
+ name: "farms_unstake",
14870
+ discriminator: [
14871
+ 180,
14872
+ 131,
14873
+ 50,
14874
+ 144,
14875
+ 26,
14876
+ 242,
14877
+ 175,
14878
+ 242
14879
+ ],
14880
+ accounts: [
14881
+ {
14882
+ name: "glam_state",
14883
+ writable: true
14884
+ },
14885
+ {
14886
+ name: "glam_vault",
14887
+ writable: true,
14888
+ pda: {
14889
+ seeds: [
14890
+ {
14891
+ kind: "const",
14892
+ value: [
14893
+ 118,
14894
+ 97,
14895
+ 117,
14896
+ 108,
14897
+ 116
14898
+ ]
14899
+ },
14900
+ {
14901
+ kind: "account",
14902
+ path: "glam_state"
14903
+ }
14904
+ ],
14905
+ program: {
14906
+ kind: "account",
14907
+ path: "glam_protocol_program"
14908
+ }
14909
+ }
14910
+ },
14911
+ {
14912
+ name: "glam_signer",
14913
+ writable: true,
14914
+ signer: true
14915
+ },
14916
+ {
14917
+ name: "integration_authority",
14918
+ pda: {
14919
+ seeds: [
14920
+ {
14921
+ kind: "const",
14922
+ value: [
14923
+ 105,
14924
+ 110,
14925
+ 116,
14926
+ 101,
14927
+ 103,
14928
+ 114,
14929
+ 97,
14930
+ 116,
14931
+ 105,
14932
+ 111,
14933
+ 110,
14934
+ 45,
14935
+ 97,
14936
+ 117,
14937
+ 116,
14938
+ 104,
14939
+ 111,
14940
+ 114,
14941
+ 105,
14942
+ 116,
14943
+ 121
14944
+ ]
14945
+ }
14946
+ ]
14947
+ }
14948
+ },
14949
+ {
14950
+ name: "cpi_program",
14951
+ address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"
14952
+ },
14953
+ {
14954
+ name: "glam_protocol_program",
14955
+ address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
14956
+ },
14957
+ {
14958
+ name: "system_program",
14959
+ address: "11111111111111111111111111111111"
14960
+ },
14961
+ {
14962
+ name: "user_state",
14963
+ writable: true
14964
+ },
14965
+ {
14966
+ name: "farm_state",
14967
+ writable: true
14968
+ },
14969
+ {
14970
+ name: "scope_prices",
14971
+ optional: true
15935
14972
  }
15936
14973
  ],
15937
- args: []
14974
+ args: [
14975
+ {
14976
+ name: "amount",
14977
+ type: "u128"
14978
+ }
14979
+ ]
15938
14980
  },
15939
14981
  {
15940
- name: "farms_stake",
14982
+ name: "farms_withdraw_unstaked_deposits",
15941
14983
  discriminator: [
15942
- 224,
15943
- 105,
15944
- 208,
15945
- 179,
15946
- 98,
15947
- 200,
15948
- 213,
15949
- 238
14984
+ 107,
14985
+ 97,
14986
+ 50,
14987
+ 15,
14988
+ 211,
14989
+ 245,
14990
+ 52,
14991
+ 96
15950
14992
  ],
15951
14993
  accounts: [
15952
14994
  {
@@ -16037,43 +15079,34 @@ var instructions$c = [
16037
15079
  name: "farm_state",
16038
15080
  writable: true
16039
15081
  },
16040
- {
16041
- name: "farm_vault",
16042
- writable: true
16043
- },
16044
15082
  {
16045
15083
  name: "user_ata",
16046
15084
  writable: true
16047
15085
  },
16048
15086
  {
16049
- name: "token_mint"
15087
+ name: "farm_vault",
15088
+ writable: true
16050
15089
  },
16051
15090
  {
16052
- name: "scope_prices",
16053
- optional: true
15091
+ name: "farm_vaults_authority"
16054
15092
  },
16055
15093
  {
16056
15094
  name: "token_program"
16057
15095
  }
16058
15096
  ],
16059
- args: [
16060
- {
16061
- name: "amount",
16062
- type: "u64"
16063
- }
16064
- ]
15097
+ args: []
16065
15098
  },
16066
15099
  {
16067
- name: "farms_unstake",
15100
+ name: "lending_borrow_obligation_liquidity_v2",
16068
15101
  discriminator: [
16069
- 180,
16070
- 131,
16071
- 50,
16072
- 144,
16073
- 26,
16074
- 242,
16075
- 175,
16076
- 242
15102
+ 149,
15103
+ 226,
15104
+ 84,
15105
+ 157,
15106
+ 124,
15107
+ 178,
15108
+ 35,
15109
+ 122
16077
15110
  ],
16078
15111
  accounts: [
16079
15112
  {
@@ -16146,7 +15179,7 @@ var instructions$c = [
16146
15179
  },
16147
15180
  {
16148
15181
  name: "cpi_program",
16149
- address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"
15182
+ address: "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
16150
15183
  },
16151
15184
  {
16152
15185
  name: "glam_protocol_program",
@@ -16157,36 +15190,77 @@ var instructions$c = [
16157
15190
  address: "11111111111111111111111111111111"
16158
15191
  },
16159
15192
  {
16160
- name: "user_state",
15193
+ name: "obligation",
16161
15194
  writable: true
16162
15195
  },
16163
15196
  {
16164
- name: "farm_state",
15197
+ name: "lending_market"
15198
+ },
15199
+ {
15200
+ name: "lending_market_authority"
15201
+ },
15202
+ {
15203
+ name: "borrow_reserve",
16165
15204
  writable: true
16166
15205
  },
16167
15206
  {
16168
- name: "scope_prices",
15207
+ name: "borrow_reserve_liquidity_mint"
15208
+ },
15209
+ {
15210
+ name: "reserve_source_liquidity",
15211
+ writable: true
15212
+ },
15213
+ {
15214
+ name: "borrow_reserve_liquidity_fee_receiver",
15215
+ writable: true
15216
+ },
15217
+ {
15218
+ name: "user_destination_liquidity",
15219
+ writable: true
15220
+ },
15221
+ {
15222
+ name: "referrer_token_state",
15223
+ writable: true,
15224
+ optional: true
15225
+ },
15226
+ {
15227
+ name: "token_program"
15228
+ },
15229
+ {
15230
+ name: "instruction_sysvar_account"
15231
+ },
15232
+ {
15233
+ name: "obligation_farm_user_state",
15234
+ writable: true,
16169
15235
  optional: true
15236
+ },
15237
+ {
15238
+ name: "reserve_farm_state",
15239
+ writable: true,
15240
+ optional: true
15241
+ },
15242
+ {
15243
+ name: "farms_program"
16170
15244
  }
16171
15245
  ],
16172
15246
  args: [
16173
15247
  {
16174
- name: "amount",
16175
- type: "u128"
15248
+ name: "liquidity_amount",
15249
+ type: "u64"
16176
15250
  }
16177
15251
  ]
16178
15252
  },
16179
15253
  {
16180
- name: "farms_withdraw_unstaked_deposits",
15254
+ name: "lending_deposit_reserve_liquidity_and_obligation_collateral_v2",
16181
15255
  discriminator: [
16182
- 107,
16183
- 97,
15256
+ 33,
15257
+ 146,
16184
15258
  50,
16185
- 15,
16186
- 211,
16187
- 245,
16188
- 52,
16189
- 96
15259
+ 121,
15260
+ 127,
15261
+ 94,
15262
+ 92,
15263
+ 192
16190
15264
  ],
16191
15265
  accounts: [
16192
15266
  {
@@ -16259,7 +15333,7 @@ var instructions$c = [
16259
15333
  },
16260
15334
  {
16261
15335
  name: "cpi_program",
16262
- address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"
15336
+ address: "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
16263
15337
  },
16264
15338
  {
16265
15339
  name: "glam_protocol_program",
@@ -16270,41 +15344,83 @@ var instructions$c = [
16270
15344
  address: "11111111111111111111111111111111"
16271
15345
  },
16272
15346
  {
16273
- name: "user_state",
15347
+ name: "obligation",
16274
15348
  writable: true
16275
15349
  },
16276
15350
  {
16277
- name: "farm_state",
15351
+ name: "lending_market"
15352
+ },
15353
+ {
15354
+ name: "lending_market_authority"
15355
+ },
15356
+ {
15357
+ name: "reserve",
16278
15358
  writable: true
16279
15359
  },
16280
15360
  {
16281
- name: "user_ata",
15361
+ name: "reserve_liquidity_mint"
15362
+ },
15363
+ {
15364
+ name: "reserve_liquidity_supply",
16282
15365
  writable: true
16283
15366
  },
16284
15367
  {
16285
- name: "farm_vault",
15368
+ name: "reserve_collateral_mint",
16286
15369
  writable: true
16287
15370
  },
16288
15371
  {
16289
- name: "farm_vaults_authority"
15372
+ name: "reserve_destination_deposit_collateral",
15373
+ writable: true
16290
15374
  },
16291
15375
  {
16292
- name: "token_program"
15376
+ name: "user_source_liquidity",
15377
+ writable: true
15378
+ },
15379
+ {
15380
+ name: "placeholder_user_destination_collateral",
15381
+ optional: true
15382
+ },
15383
+ {
15384
+ name: "collateral_token_program"
15385
+ },
15386
+ {
15387
+ name: "liquidity_token_program"
15388
+ },
15389
+ {
15390
+ name: "instruction_sysvar_account"
15391
+ },
15392
+ {
15393
+ name: "obligation_farm_user_state",
15394
+ writable: true,
15395
+ optional: true
15396
+ },
15397
+ {
15398
+ name: "reserve_farm_state",
15399
+ writable: true,
15400
+ optional: true
15401
+ },
15402
+ {
15403
+ name: "farms_program"
16293
15404
  }
16294
15405
  ],
16295
- args: []
15406
+ args: [
15407
+ {
15408
+ name: "liquidity_amount",
15409
+ type: "u64"
15410
+ }
15411
+ ]
16296
15412
  },
16297
15413
  {
16298
- name: "lending_borrow_obligation_liquidity_v2",
15414
+ name: "lending_init_obligation",
16299
15415
  discriminator: [
16300
- 149,
16301
- 226,
16302
- 84,
16303
- 157,
16304
- 124,
16305
- 178,
16306
- 35,
16307
- 122
15416
+ 188,
15417
+ 161,
15418
+ 62,
15419
+ 142,
15420
+ 106,
15421
+ 232,
15422
+ 77,
15423
+ 135
16308
15424
  ],
16309
15425
  accounts: [
16310
15426
  {
@@ -16384,8 +15500,9 @@ var instructions$c = [
16384
15500
  address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
16385
15501
  },
16386
15502
  {
16387
- name: "system_program",
16388
- address: "11111111111111111111111111111111"
15503
+ name: "fee_payer",
15504
+ writable: true,
15505
+ signer: true
16389
15506
  },
16390
15507
  {
16391
15508
  name: "obligation",
@@ -16395,70 +15512,45 @@ var instructions$c = [
16395
15512
  name: "lending_market"
16396
15513
  },
16397
15514
  {
16398
- name: "lending_market_authority"
16399
- },
16400
- {
16401
- name: "borrow_reserve",
16402
- writable: true
16403
- },
16404
- {
16405
- name: "borrow_reserve_liquidity_mint"
16406
- },
16407
- {
16408
- name: "reserve_source_liquidity",
16409
- writable: true
16410
- },
16411
- {
16412
- name: "borrow_reserve_liquidity_fee_receiver",
16413
- writable: true
16414
- },
16415
- {
16416
- name: "user_destination_liquidity",
16417
- writable: true
16418
- },
16419
- {
16420
- name: "referrer_token_state",
16421
- writable: true,
16422
- optional: true
16423
- },
16424
- {
16425
- name: "token_program"
15515
+ name: "seed1_account"
16426
15516
  },
16427
15517
  {
16428
- name: "instruction_sysvar_account"
15518
+ name: "seed2_account"
16429
15519
  },
16430
15520
  {
16431
- name: "obligation_farm_user_state",
16432
- writable: true,
16433
- optional: true
15521
+ name: "owner_user_metadata"
16434
15522
  },
16435
15523
  {
16436
- name: "reserve_farm_state",
16437
- writable: true,
16438
- optional: true
15524
+ name: "rent",
15525
+ address: "SysvarRent111111111111111111111111111111111"
16439
15526
  },
16440
15527
  {
16441
- name: "farms_program"
15528
+ name: "system_program",
15529
+ address: "11111111111111111111111111111111"
16442
15530
  }
16443
15531
  ],
16444
15532
  args: [
16445
15533
  {
16446
- name: "liquidity_amount",
16447
- type: "u64"
15534
+ name: "args",
15535
+ type: {
15536
+ defined: {
15537
+ name: "InitObligationArgs"
15538
+ }
15539
+ }
16448
15540
  }
16449
15541
  ]
16450
15542
  },
16451
15543
  {
16452
- name: "lending_deposit_reserve_liquidity_and_obligation_collateral_v2",
15544
+ name: "lending_init_obligation_farms_for_reserve",
16453
15545
  discriminator: [
16454
- 33,
16455
- 146,
16456
- 50,
16457
- 121,
16458
- 127,
16459
- 94,
16460
- 92,
16461
- 192
15546
+ 3,
15547
+ 234,
15548
+ 110,
15549
+ 39,
15550
+ 12,
15551
+ 147,
15552
+ 175,
15553
+ 185
16462
15554
  ],
16463
15555
  accounts: [
16464
15556
  {
@@ -16538,16 +15630,14 @@ var instructions$c = [
16538
15630
  address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
16539
15631
  },
16540
15632
  {
16541
- name: "system_program",
16542
- address: "11111111111111111111111111111111"
15633
+ name: "payer",
15634
+ writable: true,
15635
+ signer: true
16543
15636
  },
16544
15637
  {
16545
15638
  name: "obligation",
16546
15639
  writable: true
16547
15640
  },
16548
- {
16549
- name: "lending_market"
16550
- },
16551
15641
  {
16552
15642
  name: "lending_market_authority"
16553
15643
  },
@@ -16556,69 +15646,46 @@ var instructions$c = [
16556
15646
  writable: true
16557
15647
  },
16558
15648
  {
16559
- name: "reserve_liquidity_mint"
16560
- },
16561
- {
16562
- name: "reserve_liquidity_supply",
16563
- writable: true
16564
- },
16565
- {
16566
- name: "reserve_collateral_mint",
16567
- writable: true
16568
- },
16569
- {
16570
- name: "reserve_destination_deposit_collateral",
15649
+ name: "reserve_farm_state",
16571
15650
  writable: true
16572
15651
  },
16573
15652
  {
16574
- name: "user_source_liquidity",
15653
+ name: "obligation_farm",
16575
15654
  writable: true
16576
15655
  },
16577
15656
  {
16578
- name: "placeholder_user_destination_collateral",
16579
- optional: true
16580
- },
16581
- {
16582
- name: "collateral_token_program"
16583
- },
16584
- {
16585
- name: "liquidity_token_program"
16586
- },
16587
- {
16588
- name: "instruction_sysvar_account"
15657
+ name: "lending_market"
16589
15658
  },
16590
15659
  {
16591
- name: "obligation_farm_user_state",
16592
- writable: true,
16593
- optional: true
15660
+ name: "farms_program"
16594
15661
  },
16595
15662
  {
16596
- name: "reserve_farm_state",
16597
- writable: true,
16598
- optional: true
15663
+ name: "rent",
15664
+ address: "SysvarRent111111111111111111111111111111111"
16599
15665
  },
16600
15666
  {
16601
- name: "farms_program"
15667
+ name: "system_program",
15668
+ address: "11111111111111111111111111111111"
16602
15669
  }
16603
15670
  ],
16604
15671
  args: [
16605
15672
  {
16606
- name: "liquidity_amount",
16607
- type: "u64"
15673
+ name: "mode",
15674
+ type: "u8"
16608
15675
  }
16609
15676
  ]
16610
15677
  },
16611
15678
  {
16612
- name: "lending_init_obligation",
15679
+ name: "lending_init_user_metadata",
16613
15680
  discriminator: [
16614
- 188,
16615
- 161,
16616
- 62,
16617
- 142,
16618
- 106,
16619
- 232,
16620
- 77,
16621
- 135
15681
+ 68,
15682
+ 236,
15683
+ 138,
15684
+ 146,
15685
+ 124,
15686
+ 228,
15687
+ 247,
15688
+ 241
16622
15689
  ],
16623
15690
  accounts: [
16624
15691
  {
@@ -16703,20 +15770,12 @@ var instructions$c = [
16703
15770
  signer: true
16704
15771
  },
16705
15772
  {
16706
- name: "obligation",
15773
+ name: "user_metadata",
16707
15774
  writable: true
16708
15775
  },
16709
15776
  {
16710
- name: "lending_market"
16711
- },
16712
- {
16713
- name: "seed1_account"
16714
- },
16715
- {
16716
- name: "seed2_account"
16717
- },
16718
- {
16719
- name: "owner_user_metadata"
15777
+ name: "referrer_user_metadata",
15778
+ optional: true
16720
15779
  },
16721
15780
  {
16722
15781
  name: "rent",
@@ -16729,26 +15788,22 @@ var instructions$c = [
16729
15788
  ],
16730
15789
  args: [
16731
15790
  {
16732
- name: "args",
16733
- type: {
16734
- defined: {
16735
- name: "InitObligationArgs"
16736
- }
16737
- }
15791
+ name: "user_lookup_table",
15792
+ type: "pubkey"
16738
15793
  }
16739
15794
  ]
16740
15795
  },
16741
15796
  {
16742
- name: "lending_init_obligation_farms_for_reserve",
15797
+ name: "lending_liquidate_obligation_and_redeem_reserve_collateral_v2",
16743
15798
  discriminator: [
16744
- 3,
16745
- 234,
16746
- 110,
16747
- 39,
16748
- 12,
16749
- 147,
16750
- 175,
16751
- 185
15799
+ 179,
15800
+ 45,
15801
+ 146,
15802
+ 167,
15803
+ 246,
15804
+ 239,
15805
+ 18,
15806
+ 242
16752
15807
  ],
16753
15808
  accounts: [
16754
15809
  {
@@ -16828,166 +15883,113 @@ var instructions$c = [
16828
15883
  address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
16829
15884
  },
16830
15885
  {
16831
- name: "payer",
16832
- writable: true,
16833
- signer: true
15886
+ name: "system_program",
15887
+ address: "11111111111111111111111111111111"
16834
15888
  },
16835
15889
  {
16836
15890
  name: "obligation",
16837
15891
  writable: true
16838
15892
  },
15893
+ {
15894
+ name: "lending_market"
15895
+ },
16839
15896
  {
16840
15897
  name: "lending_market_authority"
16841
15898
  },
16842
15899
  {
16843
- name: "reserve",
15900
+ name: "repay_reserve",
16844
15901
  writable: true
16845
15902
  },
16846
15903
  {
16847
- name: "reserve_farm_state",
15904
+ name: "repay_reserve_liquidity_mint"
15905
+ },
15906
+ {
15907
+ name: "repay_reserve_liquidity_supply",
16848
15908
  writable: true
16849
15909
  },
16850
15910
  {
16851
- name: "obligation_farm",
15911
+ name: "withdraw_reserve",
16852
15912
  writable: true
16853
15913
  },
16854
15914
  {
16855
- name: "lending_market"
15915
+ name: "withdraw_reserve_liquidity_mint"
16856
15916
  },
16857
15917
  {
16858
- name: "farms_program"
15918
+ name: "withdraw_reserve_collateral_mint",
15919
+ writable: true
16859
15920
  },
16860
15921
  {
16861
- name: "rent",
16862
- address: "SysvarRent111111111111111111111111111111111"
15922
+ name: "withdraw_reserve_collateral_supply",
15923
+ writable: true
16863
15924
  },
16864
15925
  {
16865
- name: "system_program",
16866
- address: "11111111111111111111111111111111"
16867
- }
16868
- ],
16869
- args: [
15926
+ name: "withdraw_reserve_liquidity_supply",
15927
+ writable: true
15928
+ },
16870
15929
  {
16871
- name: "mode",
16872
- type: "u8"
16873
- }
16874
- ]
16875
- },
16876
- {
16877
- name: "lending_init_user_metadata",
16878
- discriminator: [
16879
- 68,
16880
- 236,
16881
- 138,
16882
- 146,
16883
- 124,
16884
- 228,
16885
- 247,
16886
- 241
16887
- ],
16888
- accounts: [
15930
+ name: "withdraw_reserve_liquidity_fee_receiver",
15931
+ writable: true
15932
+ },
16889
15933
  {
16890
- name: "glam_state",
15934
+ name: "user_source_liquidity",
16891
15935
  writable: true
16892
15936
  },
16893
15937
  {
16894
- name: "glam_vault",
16895
- writable: true,
16896
- pda: {
16897
- seeds: [
16898
- {
16899
- kind: "const",
16900
- value: [
16901
- 118,
16902
- 97,
16903
- 117,
16904
- 108,
16905
- 116
16906
- ]
16907
- },
16908
- {
16909
- kind: "account",
16910
- path: "glam_state"
16911
- }
16912
- ],
16913
- program: {
16914
- kind: "account",
16915
- path: "glam_protocol_program"
16916
- }
16917
- }
15938
+ name: "user_destination_collateral",
15939
+ writable: true
16918
15940
  },
16919
15941
  {
16920
- name: "glam_signer",
16921
- writable: true,
16922
- signer: true
15942
+ name: "user_destination_liquidity",
15943
+ writable: true
16923
15944
  },
16924
15945
  {
16925
- name: "integration_authority",
16926
- pda: {
16927
- seeds: [
16928
- {
16929
- kind: "const",
16930
- value: [
16931
- 105,
16932
- 110,
16933
- 116,
16934
- 101,
16935
- 103,
16936
- 114,
16937
- 97,
16938
- 116,
16939
- 105,
16940
- 111,
16941
- 110,
16942
- 45,
16943
- 97,
16944
- 117,
16945
- 116,
16946
- 104,
16947
- 111,
16948
- 114,
16949
- 105,
16950
- 116,
16951
- 121
16952
- ]
16953
- }
16954
- ]
16955
- }
15946
+ name: "collateral_token_program"
16956
15947
  },
16957
15948
  {
16958
- name: "cpi_program",
16959
- address: "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
15949
+ name: "repay_liquidity_token_program"
16960
15950
  },
16961
15951
  {
16962
- name: "glam_protocol_program",
16963
- address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
15952
+ name: "withdraw_liquidity_token_program"
16964
15953
  },
16965
15954
  {
16966
- name: "fee_payer",
15955
+ name: "instruction_sysvar_account"
15956
+ },
15957
+ {
15958
+ name: "collateral_obligation_farm_user_state",
16967
15959
  writable: true,
16968
- signer: true
15960
+ optional: true
16969
15961
  },
16970
15962
  {
16971
- name: "user_metadata",
16972
- writable: true
15963
+ name: "collateral_reserve_farm_state",
15964
+ writable: true,
15965
+ optional: true
16973
15966
  },
16974
15967
  {
16975
- name: "referrer_user_metadata",
15968
+ name: "debt_obligation_farm_user_state",
15969
+ writable: true,
16976
15970
  optional: true
16977
15971
  },
16978
15972
  {
16979
- name: "rent",
16980
- address: "SysvarRent111111111111111111111111111111111"
15973
+ name: "debt_reserve_farm_state",
15974
+ writable: true,
15975
+ optional: true
16981
15976
  },
16982
15977
  {
16983
- name: "system_program",
16984
- address: "11111111111111111111111111111111"
15978
+ name: "farms_program"
16985
15979
  }
16986
15980
  ],
16987
15981
  args: [
16988
15982
  {
16989
- name: "user_lookup_table",
16990
- type: "pubkey"
15983
+ name: "liquidity_amount",
15984
+ type: "u64"
15985
+ },
15986
+ {
15987
+ name: "min_acceptable_received_liquidity_amount",
15988
+ type: "u64"
15989
+ },
15990
+ {
15991
+ name: "max_allowed_ltv_override_percent",
15992
+ type: "u64"
16991
15993
  }
16992
15994
  ]
16993
15995
  },
@@ -17905,12 +16907,6 @@ var types$c = [
17905
16907
  },
17906
16908
  {
17907
16909
  name: "OracleConfigs"
17908
- },
17909
- {
17910
- name: "ReduceOnly"
17911
- },
17912
- {
17913
- name: "AnyLst"
17914
16910
  }
17915
16911
  ]
17916
16912
  }
@@ -18775,6 +17771,11 @@ var constants$c = [
18775
17771
  type: "u64",
18776
17772
  value: "1"
18777
17773
  },
17774
+ {
17775
+ name: "PROTO_KAMINO_LENDING_PERM_LIQUIDATE",
17776
+ type: "u64",
17777
+ value: "32"
17778
+ },
18778
17779
  {
18779
17780
  name: "PROTO_KAMINO_LENDING_PERM_REPAY",
18780
17781
  type: "u64",
@@ -19605,12 +18606,6 @@ var types$b = [
19605
18606
  },
19606
18607
  {
19607
18608
  name: "OracleConfigs"
19608
- },
19609
- {
19610
- name: "ReduceOnly"
19611
- },
19612
- {
19613
- name: "AnyLst"
19614
18609
  }
19615
18610
  ]
19616
18611
  }
@@ -21204,12 +20199,6 @@ var types$a = [
21204
20199
  },
21205
20200
  {
21206
20201
  name: "OracleConfigs"
21207
- },
21208
- {
21209
- name: "ReduceOnly"
21210
- },
21211
- {
21212
- name: "AnyLst"
21213
20202
  }
21214
20203
  ]
21215
20204
  }
@@ -22514,12 +21503,6 @@ var types$9 = [
22514
21503
  },
22515
21504
  {
22516
21505
  name: "OracleConfigs"
22517
- },
22518
- {
22519
- name: "ReduceOnly"
22520
- },
22521
- {
22522
- name: "AnyLst"
22523
21506
  }
22524
21507
  ]
22525
21508
  }
@@ -23595,12 +22578,6 @@ var types$8 = [
23595
22578
  },
23596
22579
  {
23597
22580
  name: "OracleConfigs"
23598
- },
23599
- {
23600
- name: "ReduceOnly"
23601
- },
23602
- {
23603
- name: "AnyLst"
23604
22581
  }
23605
22582
  ]
23606
22583
  }
@@ -24428,249 +23405,6 @@ var instructions$7 = [
24428
23405
  ],
24429
23406
  args: []
24430
23407
  },
24431
- {
24432
- name: "charge_protocol_fee",
24433
- docs: [
24434
- "Charges protocol base fee on non-tokenized vaults"
24435
- ],
24436
- discriminator: [
24437
- 48,
24438
- 225,
24439
- 89,
24440
- 103,
24441
- 48,
24442
- 65,
24443
- 183,
24444
- 238
24445
- ],
24446
- accounts: [
24447
- {
24448
- name: "glam_state",
24449
- writable: true
24450
- },
24451
- {
24452
- name: "glam_vault",
24453
- writable: true,
24454
- pda: {
24455
- seeds: [
24456
- {
24457
- kind: "const",
24458
- value: [
24459
- 118,
24460
- 97,
24461
- 117,
24462
- 108,
24463
- 116
24464
- ]
24465
- },
24466
- {
24467
- kind: "account",
24468
- path: "glam_state"
24469
- }
24470
- ]
24471
- }
24472
- },
24473
- {
24474
- name: "signer",
24475
- writable: true,
24476
- signer: true
24477
- },
24478
- {
24479
- name: "deposit_asset"
24480
- },
24481
- {
24482
- name: "vault_deposit_ata",
24483
- writable: true,
24484
- pda: {
24485
- seeds: [
24486
- {
24487
- kind: "account",
24488
- path: "glam_vault"
24489
- },
24490
- {
24491
- kind: "account",
24492
- path: "deposit_token_program"
24493
- },
24494
- {
24495
- kind: "account",
24496
- path: "deposit_asset"
24497
- }
24498
- ],
24499
- program: {
24500
- kind: "const",
24501
- value: [
24502
- 140,
24503
- 151,
24504
- 37,
24505
- 143,
24506
- 78,
24507
- 36,
24508
- 137,
24509
- 241,
24510
- 187,
24511
- 61,
24512
- 16,
24513
- 41,
24514
- 20,
24515
- 142,
24516
- 13,
24517
- 131,
24518
- 11,
24519
- 90,
24520
- 19,
24521
- 153,
24522
- 218,
24523
- 255,
24524
- 16,
24525
- 132,
24526
- 4,
24527
- 142,
24528
- 123,
24529
- 216,
24530
- 219,
24531
- 233,
24532
- 248,
24533
- 89
24534
- ]
24535
- }
24536
- }
24537
- },
24538
- {
24539
- name: "protocol_fee_authority"
24540
- },
24541
- {
24542
- name: "protocol_fee_authority_ata",
24543
- writable: true,
24544
- pda: {
24545
- seeds: [
24546
- {
24547
- kind: "account",
24548
- path: "protocol_fee_authority"
24549
- },
24550
- {
24551
- kind: "account",
24552
- path: "deposit_token_program"
24553
- },
24554
- {
24555
- kind: "account",
24556
- path: "deposit_asset"
24557
- }
24558
- ],
24559
- program: {
24560
- kind: "const",
24561
- value: [
24562
- 140,
24563
- 151,
24564
- 37,
24565
- 143,
24566
- 78,
24567
- 36,
24568
- 137,
24569
- 241,
24570
- 187,
24571
- 61,
24572
- 16,
24573
- 41,
24574
- 20,
24575
- 142,
24576
- 13,
24577
- 131,
24578
- 11,
24579
- 90,
24580
- 19,
24581
- 153,
24582
- 218,
24583
- 255,
24584
- 16,
24585
- 132,
24586
- 4,
24587
- 142,
24588
- 123,
24589
- 216,
24590
- 219,
24591
- 233,
24592
- 248,
24593
- 89
24594
- ]
24595
- }
24596
- }
24597
- },
24598
- {
24599
- name: "glam_config",
24600
- pda: {
24601
- seeds: [
24602
- {
24603
- kind: "const",
24604
- value: [
24605
- 103,
24606
- 108,
24607
- 111,
24608
- 98,
24609
- 97,
24610
- 108,
24611
- 45,
24612
- 99,
24613
- 111,
24614
- 110,
24615
- 102,
24616
- 105,
24617
- 103
24618
- ]
24619
- }
24620
- ],
24621
- program: {
24622
- kind: "const",
24623
- value: [
24624
- 10,
24625
- 11,
24626
- 0,
24627
- 83,
24628
- 72,
24629
- 16,
24630
- 46,
24631
- 144,
24632
- 46,
24633
- 42,
24634
- 79,
24635
- 22,
24636
- 157,
24637
- 123,
24638
- 21,
24639
- 242,
24640
- 192,
24641
- 146,
24642
- 1,
24643
- 78,
24644
- 88,
24645
- 59,
24646
- 102,
24647
- 9,
24648
- 190,
24649
- 226,
24650
- 92,
24651
- 189,
24652
- 187,
24653
- 232,
24654
- 83,
24655
- 220
24656
- ]
24657
- }
24658
- }
24659
- },
24660
- {
24661
- name: "system_program",
24662
- address: "11111111111111111111111111111111"
24663
- },
24664
- {
24665
- name: "associated_token_program",
24666
- address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
24667
- },
24668
- {
24669
- name: "deposit_token_program"
24670
- }
24671
- ],
24672
- args: []
24673
- },
24674
23408
  {
24675
23409
  name: "check_and_update_transfer_tracker",
24676
23410
  discriminator: [
@@ -26907,12 +25641,6 @@ var types$7 = [
26907
25641
  },
26908
25642
  {
26909
25643
  name: "OracleConfigs"
26910
- },
26911
- {
26912
- name: "ReduceOnly"
26913
- },
26914
- {
26915
- name: "AnyLst"
26916
25644
  }
26917
25645
  ]
26918
25646
  }
@@ -27804,18 +26532,6 @@ var types$7 = [
27804
26532
  }
27805
26533
  }
27806
26534
  },
27807
- {
27808
- name: "reduce_only",
27809
- type: {
27810
- option: "bool"
27811
- }
27812
- },
27813
- {
27814
- name: "any_lst",
27815
- type: {
27816
- option: "bool"
27817
- }
27818
- },
27819
26535
  {
27820
26536
  name: "timelock_duration",
27821
26537
  type: {
@@ -27845,16 +26561,6 @@ var types$7 = [
27845
26561
  }
27846
26562
  }
27847
26563
  }
27848
- },
27849
- {
27850
- name: "fee_structure",
27851
- type: {
27852
- option: {
27853
- defined: {
27854
- name: "FeeStructure"
27855
- }
27856
- }
27857
- }
27858
26564
  }
27859
26565
  ]
27860
26566
  }
@@ -33042,12 +31748,6 @@ var types$6 = [
33042
31748
  },
33043
31749
  {
33044
31750
  name: "OracleConfigs"
33045
- },
33046
- {
33047
- name: "ReduceOnly"
33048
- },
33049
- {
33050
- name: "AnyLst"
33051
31751
  }
33052
31752
  ]
33053
31753
  }
@@ -34613,12 +33313,6 @@ var types$5 = [
34613
33313
  },
34614
33314
  {
34615
33315
  name: "OracleConfigs"
34616
- },
34617
- {
34618
- name: "ReduceOnly"
34619
- },
34620
- {
34621
- name: "AnyLst"
34622
33316
  }
34623
33317
  ]
34624
33318
  }
@@ -38234,12 +36928,6 @@ var types$4 = [
38234
36928
  },
38235
36929
  {
38236
36930
  name: "OracleConfigs"
38237
- },
38238
- {
38239
- name: "ReduceOnly"
38240
- },
38241
- {
38242
- name: "AnyLst"
38243
36931
  }
38244
36932
  ]
38245
36933
  }
@@ -40713,31 +39401,231 @@ var instructions$3 = [
40713
39401
  address: "gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"
40714
39402
  },
40715
39403
  {
40716
- name: "fee_payer",
40717
- writable: true,
40718
- signer: true
39404
+ name: "fee_payer",
39405
+ writable: true,
39406
+ signer: true
39407
+ },
39408
+ {
39409
+ name: "user_metadata",
39410
+ writable: true
39411
+ },
39412
+ {
39413
+ name: "referrer_user_metadata",
39414
+ optional: true
39415
+ },
39416
+ {
39417
+ name: "rent",
39418
+ address: "SysvarRent111111111111111111111111111111111"
39419
+ },
39420
+ {
39421
+ name: "system_program",
39422
+ address: "11111111111111111111111111111111"
39423
+ }
39424
+ ],
39425
+ args: [
39426
+ {
39427
+ name: "user_lookup_table",
39428
+ type: "pubkey"
39429
+ }
39430
+ ]
39431
+ },
39432
+ {
39433
+ name: "lending_liquidate_obligation_and_redeem_reserve_collateral_v2",
39434
+ discriminator: [
39435
+ 179,
39436
+ 45,
39437
+ 146,
39438
+ 167,
39439
+ 246,
39440
+ 239,
39441
+ 18,
39442
+ 242
39443
+ ],
39444
+ accounts: [
39445
+ {
39446
+ name: "glam_state",
39447
+ writable: true
39448
+ },
39449
+ {
39450
+ name: "glam_vault",
39451
+ writable: true,
39452
+ pda: {
39453
+ seeds: [
39454
+ {
39455
+ kind: "const",
39456
+ value: [
39457
+ 118,
39458
+ 97,
39459
+ 117,
39460
+ 108,
39461
+ 116
39462
+ ]
39463
+ },
39464
+ {
39465
+ kind: "account",
39466
+ path: "glam_state"
39467
+ }
39468
+ ],
39469
+ program: {
39470
+ kind: "account",
39471
+ path: "glam_protocol_program"
39472
+ }
39473
+ }
39474
+ },
39475
+ {
39476
+ name: "glam_signer",
39477
+ writable: true,
39478
+ signer: true
39479
+ },
39480
+ {
39481
+ name: "integration_authority",
39482
+ pda: {
39483
+ seeds: [
39484
+ {
39485
+ kind: "const",
39486
+ value: [
39487
+ 105,
39488
+ 110,
39489
+ 116,
39490
+ 101,
39491
+ 103,
39492
+ 114,
39493
+ 97,
39494
+ 116,
39495
+ 105,
39496
+ 111,
39497
+ 110,
39498
+ 45,
39499
+ 97,
39500
+ 117,
39501
+ 116,
39502
+ 104,
39503
+ 111,
39504
+ 114,
39505
+ 105,
39506
+ 116,
39507
+ 121
39508
+ ]
39509
+ }
39510
+ ]
39511
+ }
39512
+ },
39513
+ {
39514
+ name: "cpi_program",
39515
+ address: "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
39516
+ },
39517
+ {
39518
+ name: "glam_protocol_program",
39519
+ address: "gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"
39520
+ },
39521
+ {
39522
+ name: "system_program",
39523
+ address: "11111111111111111111111111111111"
40719
39524
  },
40720
39525
  {
40721
- name: "user_metadata",
39526
+ name: "obligation",
40722
39527
  writable: true
40723
39528
  },
40724
39529
  {
40725
- name: "referrer_user_metadata",
39530
+ name: "lending_market"
39531
+ },
39532
+ {
39533
+ name: "lending_market_authority"
39534
+ },
39535
+ {
39536
+ name: "repay_reserve",
39537
+ writable: true
39538
+ },
39539
+ {
39540
+ name: "repay_reserve_liquidity_mint"
39541
+ },
39542
+ {
39543
+ name: "repay_reserve_liquidity_supply",
39544
+ writable: true
39545
+ },
39546
+ {
39547
+ name: "withdraw_reserve",
39548
+ writable: true
39549
+ },
39550
+ {
39551
+ name: "withdraw_reserve_liquidity_mint"
39552
+ },
39553
+ {
39554
+ name: "withdraw_reserve_collateral_mint",
39555
+ writable: true
39556
+ },
39557
+ {
39558
+ name: "withdraw_reserve_collateral_supply",
39559
+ writable: true
39560
+ },
39561
+ {
39562
+ name: "withdraw_reserve_liquidity_supply",
39563
+ writable: true
39564
+ },
39565
+ {
39566
+ name: "withdraw_reserve_liquidity_fee_receiver",
39567
+ writable: true
39568
+ },
39569
+ {
39570
+ name: "user_source_liquidity",
39571
+ writable: true
39572
+ },
39573
+ {
39574
+ name: "user_destination_collateral",
39575
+ writable: true
39576
+ },
39577
+ {
39578
+ name: "user_destination_liquidity",
39579
+ writable: true
39580
+ },
39581
+ {
39582
+ name: "collateral_token_program"
39583
+ },
39584
+ {
39585
+ name: "repay_liquidity_token_program"
39586
+ },
39587
+ {
39588
+ name: "withdraw_liquidity_token_program"
39589
+ },
39590
+ {
39591
+ name: "instruction_sysvar_account"
39592
+ },
39593
+ {
39594
+ name: "collateral_obligation_farm_user_state",
39595
+ writable: true,
40726
39596
  optional: true
40727
39597
  },
40728
39598
  {
40729
- name: "rent",
40730
- address: "SysvarRent111111111111111111111111111111111"
39599
+ name: "collateral_reserve_farm_state",
39600
+ writable: true,
39601
+ optional: true
40731
39602
  },
40732
39603
  {
40733
- name: "system_program",
40734
- address: "11111111111111111111111111111111"
39604
+ name: "debt_obligation_farm_user_state",
39605
+ writable: true,
39606
+ optional: true
39607
+ },
39608
+ {
39609
+ name: "debt_reserve_farm_state",
39610
+ writable: true,
39611
+ optional: true
39612
+ },
39613
+ {
39614
+ name: "farms_program"
40735
39615
  }
40736
39616
  ],
40737
39617
  args: [
40738
39618
  {
40739
- name: "user_lookup_table",
40740
- type: "pubkey"
39619
+ name: "liquidity_amount",
39620
+ type: "u64"
39621
+ },
39622
+ {
39623
+ name: "min_acceptable_received_liquidity_amount",
39624
+ type: "u64"
39625
+ },
39626
+ {
39627
+ name: "max_allowed_ltv_override_percent",
39628
+ type: "u64"
40741
39629
  }
40742
39630
  ]
40743
39631
  },
@@ -40886,6 +39774,114 @@ var instructions$3 = [
40886
39774
  }
40887
39775
  ]
40888
39776
  },
39777
+ {
39778
+ name: "lending_request_elevation_group",
39779
+ discriminator: [
39780
+ 162,
39781
+ 119,
39782
+ 197,
39783
+ 54,
39784
+ 246,
39785
+ 84,
39786
+ 55,
39787
+ 153
39788
+ ],
39789
+ accounts: [
39790
+ {
39791
+ name: "glam_state",
39792
+ writable: true
39793
+ },
39794
+ {
39795
+ name: "glam_vault",
39796
+ writable: true,
39797
+ pda: {
39798
+ seeds: [
39799
+ {
39800
+ kind: "const",
39801
+ value: [
39802
+ 118,
39803
+ 97,
39804
+ 117,
39805
+ 108,
39806
+ 116
39807
+ ]
39808
+ },
39809
+ {
39810
+ kind: "account",
39811
+ path: "glam_state"
39812
+ }
39813
+ ],
39814
+ program: {
39815
+ kind: "account",
39816
+ path: "glam_protocol_program"
39817
+ }
39818
+ }
39819
+ },
39820
+ {
39821
+ name: "glam_signer",
39822
+ writable: true,
39823
+ signer: true
39824
+ },
39825
+ {
39826
+ name: "integration_authority",
39827
+ pda: {
39828
+ seeds: [
39829
+ {
39830
+ kind: "const",
39831
+ value: [
39832
+ 105,
39833
+ 110,
39834
+ 116,
39835
+ 101,
39836
+ 103,
39837
+ 114,
39838
+ 97,
39839
+ 116,
39840
+ 105,
39841
+ 111,
39842
+ 110,
39843
+ 45,
39844
+ 97,
39845
+ 117,
39846
+ 116,
39847
+ 104,
39848
+ 111,
39849
+ 114,
39850
+ 105,
39851
+ 116,
39852
+ 121
39853
+ ]
39854
+ }
39855
+ ]
39856
+ }
39857
+ },
39858
+ {
39859
+ name: "cpi_program",
39860
+ address: "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
39861
+ },
39862
+ {
39863
+ name: "glam_protocol_program",
39864
+ address: "gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"
39865
+ },
39866
+ {
39867
+ name: "system_program",
39868
+ address: "11111111111111111111111111111111"
39869
+ },
39870
+ {
39871
+ name: "obligation",
39872
+ writable: true
39873
+ },
39874
+ {
39875
+ name: "lending_market"
39876
+ }
39877
+ ],
39878
+ args: [
39879
+ {
39880
+ name: "elevation_group",
39881
+ type: "u8"
39882
+ }
39883
+ ]
39884
+ },
40889
39885
  {
40890
39886
  name: "lending_withdraw_obligation_collateral_and_redeem_reserve_collateral_v2",
40891
39887
  discriminator: [
@@ -41655,12 +40651,6 @@ var types$3 = [
41655
40651
  },
41656
40652
  {
41657
40653
  name: "OracleConfigs"
41658
- },
41659
- {
41660
- name: "ReduceOnly"
41661
- },
41662
- {
41663
- name: "AnyLst"
41664
40654
  }
41665
40655
  ]
41666
40656
  }
@@ -42525,6 +41515,11 @@ var constants$3 = [
42525
41515
  type: "u64",
42526
41516
  value: "1"
42527
41517
  },
41518
+ {
41519
+ name: "PROTO_KAMINO_LENDING_PERM_LIQUIDATE",
41520
+ type: "u64",
41521
+ value: "32"
41522
+ },
42528
41523
  {
42529
41524
  name: "PROTO_KAMINO_LENDING_PERM_REPAY",
42530
41525
  type: "u64",
@@ -43354,12 +42349,6 @@ var types$2 = [
43354
42349
  },
43355
42350
  {
43356
42351
  name: "OracleConfigs"
43357
- },
43358
- {
43359
- name: "ReduceOnly"
43360
- },
43361
- {
43362
- name: "AnyLst"
43363
42352
  }
43364
42353
  ]
43365
42354
  }
@@ -44807,6 +43796,9 @@ var types$1 = [
44807
43796
  },
44808
43797
  {
44809
43798
  name: "Mint"
43799
+ },
43800
+ {
43801
+ name: "SingleAssetVault"
44810
43802
  }
44811
43803
  ]
44812
43804
  }
@@ -44981,12 +43973,6 @@ var types$1 = [
44981
43973
  },
44982
43974
  {
44983
43975
  name: "OracleConfigs"
44984
- },
44985
- {
44986
- name: "ReduceOnly"
44987
- },
44988
- {
44989
- name: "AnyLst"
44990
43976
  }
44991
43977
  ]
44992
43978
  }
@@ -46067,12 +45053,6 @@ var types = [
46067
45053
  },
46068
45054
  {
46069
45055
  name: "OracleConfigs"
46070
- },
46071
- {
46072
- name: "ReduceOnly"
46073
- },
46074
- {
46075
- name: "AnyLst"
46076
45056
  }
46077
45057
  ]
46078
45058
  }
@@ -47131,27 +46111,30 @@ DriftVaultsPolicy._layout = borsh.struct([
47131
46111
  borsh.vec(borsh.publicKey(), "vaultsAllowlist")
47132
46112
  ]);
47133
46113
  class DriftProtocolPolicy {
47134
- static decode(buffer) {
47135
- try {
47136
- const data = DriftProtocolPolicy._layout.decode(buffer);
47137
- return new DriftProtocolPolicy(data.spotMarketsAllowlist, data.perpMarketsAllowlist, data.borrowAllowlist, data.orderPriceToleranceBps ?? 0);
47138
- } catch {
47139
- // Legacy format without orderPriceToleranceBps
47140
- const data = DriftProtocolPolicy._legacyLayout.decode(buffer);
47141
- return new DriftProtocolPolicy(data.spotMarketsAllowlist, data.perpMarketsAllowlist, data.borrowAllowlist, 0);
46114
+ static decode(buffer, staging = false) {
46115
+ if (staging) {
46116
+ try {
46117
+ const data = DriftProtocolPolicy._stagingLayout.decode(buffer);
46118
+ return new DriftProtocolPolicy(data.spotMarketsAllowlist, data.perpMarketsAllowlist, data.borrowAllowlist, data.orderPriceToleranceBps ?? 0);
46119
+ } catch {
46120
+ // Backward compat: old staging data without orderPriceToleranceBps
46121
+ // falls through to the base layout decoding
46122
+ }
47142
46123
  }
46124
+ const data = DriftProtocolPolicy._layout.decode(buffer);
46125
+ return new DriftProtocolPolicy(data.spotMarketsAllowlist, data.perpMarketsAllowlist, data.borrowAllowlist, 0);
47143
46126
  }
47144
- encode() {
47145
- // Calculate buffer size needed
47146
- // 4 bytes for spot markets length + 2 bytes per spot market
47147
- // 4 bytes for perp markets length + 2 bytes per perp market
47148
- // 4 bytes for borrow allowlist length + 32 bytes per pubkey
47149
- // 2 bytes for orderPriceToleranceBps
46127
+ encode(staging = false) {
47150
46128
  const spotMarketsSize = 4 + this.spotMarketsAllowlist.length * 2;
47151
46129
  const perpMarketsSize = 4 + this.perpMarketsAllowlist.length * 2;
47152
46130
  const borrowAllowlistSize = 4 + this.borrowAllowlist.length * 32;
47153
- const totalSize = spotMarketsSize + perpMarketsSize + borrowAllowlistSize + 2;
47154
- const buffer = Buffer.alloc(totalSize);
46131
+ const baseSize = spotMarketsSize + perpMarketsSize + borrowAllowlistSize;
46132
+ if (staging) {
46133
+ const buffer = Buffer.alloc(baseSize + 2); // +2 for orderPriceToleranceBps
46134
+ DriftProtocolPolicy._stagingLayout.encode(this, buffer);
46135
+ return buffer;
46136
+ }
46137
+ const buffer = Buffer.alloc(baseSize);
47155
46138
  DriftProtocolPolicy._layout.encode(this, buffer);
47156
46139
  return buffer;
47157
46140
  }
@@ -47165,13 +46148,13 @@ class DriftProtocolPolicy {
47165
46148
  DriftProtocolPolicy._layout = borsh.struct([
47166
46149
  borsh.vec(borsh.u16(), "spotMarketsAllowlist"),
47167
46150
  borsh.vec(borsh.u16(), "perpMarketsAllowlist"),
47168
- borsh.vec(borsh.publicKey(), "borrowAllowlist"),
47169
- borsh.u16("orderPriceToleranceBps")
46151
+ borsh.vec(borsh.publicKey(), "borrowAllowlist")
47170
46152
  ]);
47171
- DriftProtocolPolicy._legacyLayout = borsh.struct([
46153
+ DriftProtocolPolicy._stagingLayout = borsh.struct([
47172
46154
  borsh.vec(borsh.u16(), "spotMarketsAllowlist"),
47173
46155
  borsh.vec(borsh.u16(), "perpMarketsAllowlist"),
47174
- borsh.vec(borsh.publicKey(), "borrowAllowlist")
46156
+ borsh.vec(borsh.publicKey(), "borrowAllowlist"),
46157
+ borsh.u16("orderPriceToleranceBps")
47175
46158
  ]);
47176
46159
  class KaminoLendingPolicy {
47177
46160
  static decode(buffer) {
@@ -47785,9 +46768,14 @@ function getHeliusApiKey() {
47785
46768
  * Fetches program accounts using Helius getProgramAccountsV2 if available.
47786
46769
  * Otherwise falls back to standard getProgramAccounts with retry logic.
47787
46770
  */ async function getProgramAccounts(connection, programId, config) {
47788
- if (isHeliusRpc(connection.rpcEndpoint)) {
47789
- return await getProgramAccountsV2Helius(connection.rpcEndpoint, programId, config);
47790
- }
46771
+ // 2026-03-02: Helius getProgramAccountsV2 cannot find ALTs, disable it for now
46772
+ // if (isHeliusRpc(connection.rpcEndpoint)) {
46773
+ // return await getProgramAccountsV2Helius(
46774
+ // connection.rpcEndpoint,
46775
+ // programId,
46776
+ // config,
46777
+ // );
46778
+ // }
47791
46779
  return await getProgramAccountsWithRetry(connection, programId, config);
47792
46780
  }
47793
46781
  async function rpcRequest(rpcUrl, method, params) {
@@ -47809,52 +46797,6 @@ async function rpcRequest(rpcUrl, method, params) {
47809
46797
  }
47810
46798
  return data.result;
47811
46799
  }
47812
- function decodeAccountData(accountData, encoding) {
47813
- if (encoding === "base64") {
47814
- return Buffer.from(accountData, "base64");
47815
- } else if (encoding === "base64+zstd") {
47816
- const compressed = Buffer.from(accountData, "base64");
47817
- return Buffer.from(fzstd.decompress(compressed));
47818
- } else if (encoding === "base58") {
47819
- return bytes.bs58.decode(accountData);
47820
- }
47821
- throw new Error(`Unsupported encoding: ${encoding}`);
47822
- }
47823
- async function getProgramAccountsV2Helius(rpcUrl, programId, config) {
47824
- const allAccounts = [];
47825
- let paginationKey = null;
47826
- do {
47827
- const result = await rpcRequest(rpcUrl, "getProgramAccountsV2", [
47828
- programId.toBase58(),
47829
- {
47830
- encoding: config.encoding || "base64",
47831
- filters: config.filters || [],
47832
- ...config.limit && {
47833
- limit: config.limit
47834
- },
47835
- ...config.changedSinceSlot && {
47836
- changedSinceSlot: config.changedSinceSlot
47837
- },
47838
- ...paginationKey && {
47839
- paginationKey
47840
- }
47841
- }
47842
- ]);
47843
- for (const { pubkey, account } of result.accounts){
47844
- const [accountData, encoding] = account.data;
47845
- allAccounts.push({
47846
- pubkey: new web3_js.PublicKey(pubkey),
47847
- account: {
47848
- ...account,
47849
- owner: new web3_js.PublicKey(account.owner),
47850
- data: decodeAccountData(accountData, encoding)
47851
- }
47852
- });
47853
- }
47854
- paginationKey = result.paginationKey;
47855
- }while (paginationKey)
47856
- return allAccounts;
47857
- }
47858
46800
  /**
47859
46801
  * Standard getProgramAccounts with retry logic for transient errors.
47860
46802
  */ async function getProgramAccountsWithRetry(connection, programId, config) {
@@ -48929,6 +47871,14 @@ const MAX_ADDRESSES_PER_EXTEND = 20;
48929
47871
  };
48930
47872
  }
48931
47873
 
47874
+ class GlamError extends Error {
47875
+ constructor(message, rawError, programLogs){
47876
+ super(message);
47877
+ this.message = message;
47878
+ this.rawError = rawError;
47879
+ this.programLogs = programLogs;
47880
+ }
47881
+ }
48932
47882
  const JUPITER_SWAP_ERRORS = {
48933
47883
  6001: "Jupiter swap failed: Slippage tolerance exceeded",
48934
47884
  6008: "Jupiter swap failed: Not enough account keys",
@@ -48937,29 +47887,115 @@ const JUPITER_SWAP_ERRORS = {
48937
47887
  6025: "Jupiter swap failed: Invalid token account"
48938
47888
  };
48939
47889
  /**
48940
- * Parses program logs to extract error message
48941
- */ function parseProgramLogs(logs) {
48942
- // "Error Message:" indicates an anchor program error
48943
- // Other messages are manually sourced & handled
48944
- const errorMsgLog = (logs || []).find((log)=>log.includes("Error Message:") || log.includes("Error: insufficient funds") || log.includes("Transfer: insufficient lamports"));
47890
+ * Extract the program ID that failed from transaction logs.
47891
+ * Looks for "Program <ID> failed:" log lines.
47892
+ */ function extractFailedProgramId(logs) {
47893
+ if (!logs) return undefined;
47894
+ for(let i = logs.length - 1; i >= 0; i--){
47895
+ const match = logs[i].match(/^Program (\w+) failed/);
47896
+ if (match) return match[1];
47897
+ }
47898
+ return undefined;
47899
+ }
47900
+ /**
47901
+ * Resolve a custom program error code to a human-readable message.
47902
+ * When programId is provided, matches against the specific program's IDL
47903
+ * to avoid collisions between programs using the same error code range.
47904
+ * Accepts either a decimal number or a hex string (e.g. "0xBB80").
47905
+ */ function resolveErrorCode(code, staging, programId) {
47906
+ const decimal = typeof code === "string" ? (()=>{
47907
+ const normalized = code.trim().toLowerCase();
47908
+ return normalized.startsWith("0x") ? parseInt(normalized, 16) : parseInt(normalized, 10);
47909
+ })() : code;
47910
+ if (isNaN(decimal)) return undefined;
47911
+ const s = resolveStaging(staging);
47912
+ const glamProtocolId = getGlamProtocolProgramId(s).toBase58();
47913
+ const glamMintId = getGlamMintProgramId(s).toBase58();
47914
+ if (programId) {
47915
+ // Match against the specific program that failed
47916
+ if (programId === glamProtocolId) {
47917
+ const err = getGlamProtocolIdl(s).errors.find((e)=>e.code === decimal);
47918
+ return err?.msg;
47919
+ }
47920
+ if (programId === glamMintId) {
47921
+ const err = getGlamMintIdl(s).errors.find((e)=>e.code === decimal);
47922
+ return err?.msg;
47923
+ }
47924
+ // Not a GLAM program — check third-party errors
47925
+ const jupiterMsg = JUPITER_SWAP_ERRORS[decimal];
47926
+ if (jupiterMsg) return jupiterMsg;
47927
+ return undefined;
47928
+ }
47929
+ // Fallback: no programId provided, check all (legacy behavior)
47930
+ const protocolError = getGlamProtocolIdl(s).errors.find((e)=>e.code === decimal);
47931
+ if (protocolError?.msg) return protocolError.msg;
47932
+ const mintError = getGlamMintIdl(s).errors.find((e)=>e.code === decimal);
47933
+ if (mintError?.msg) return mintError.msg;
47934
+ const jupiterMsg = JUPITER_SWAP_ERRORS[decimal];
47935
+ if (jupiterMsg) return jupiterMsg;
47936
+ return undefined;
47937
+ }
47938
+ /**
47939
+ * Parse the error message from a transaction error.
47940
+ * Environment-agnostic: handles Anchor errors, program error codes,
47941
+ * simulation failures, and common RPC/network errors.
47942
+ *
47943
+ * Callers (GUI, CLI) can handle environment-specific error types
47944
+ * (e.g. WalletSignTransactionError) before delegating to this function.
47945
+ */ function parseTxError(error) {
47946
+ const raw = error?.message || error?.toString?.() || "";
47947
+ const msg = raw === "[object Object]" ? "" : raw;
47948
+ // Transaction expired
47949
+ if (msg.includes("block height exceeded")) {
47950
+ return "Transaction expired";
47951
+ }
47952
+ // Transaction too large
47953
+ if (msg.includes("encoding overruns") || msg.includes("exceeded maximum size")) {
47954
+ return "Transaction too large: the transaction exceeds the maximum size limit.";
47955
+ }
47956
+ // RPC rate limiting
47957
+ if (msg.includes("429") || msg.includes("Too Many Requests") || msg.includes("rate limit")) {
47958
+ return "RPC rate limited: please wait a moment and try again";
47959
+ }
47960
+ // RPC unavailable
47961
+ if (msg.includes("503") || msg.includes("Service Unavailable")) {
47962
+ return "RPC service unavailable: try again shortly";
47963
+ }
47964
+ // Connection errors
47965
+ if (msg.includes("ECONNREFUSED") || msg.includes("ENOTFOUND")) {
47966
+ return "Cannot connect to RPC: check your network or endpoint";
47967
+ }
47968
+ // Timeout
47969
+ if (msg.includes("timeout") || msg.includes("ETIMEDOUT") || msg.includes("TimeoutError")) {
47970
+ return "Request timed out: try again";
47971
+ }
47972
+ return msg || "Unknown error";
47973
+ }
47974
+
47975
+ /**
47976
+ * Parses program logs to extract error message.
47977
+ * Checks in order: Anchor "Error Message:", insufficient funds/lamports,
47978
+ * and custom program error codes (resolved via IDL when possible).
47979
+ * Returns "Unknown error" if no recognizable error pattern is found.
47980
+ */ function parseProgramLogs(logs, staging) {
47981
+ if (logs.length === 0) return "Invalid program logs";
47982
+ // Anchor "Error Message:" from program logs
47983
+ const errorMsgLog = logs.find((log)=>log.includes("Error Message:"));
48945
47984
  if (errorMsgLog) {
48946
- if (errorMsgLog.includes("Error Message:")) {
48947
- return errorMsgLog.split("Error Message:")[1].trim();
48948
- }
48949
- return errorMsgLog;
48950
- }
48951
- // Match the following pattern to find Jupiter error code in logs
48952
- // "Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 failed: custom program error: 0x1788"
48953
- const jupiterErrorLog = (logs || []).find((log)=>log.includes("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4") && log.includes("custom program error:"));
48954
- if (jupiterErrorLog) {
48955
- const match = jupiterErrorLog.match(/custom program error: (0x[0-9a-fA-F]+)/);
47985
+ return errorMsgLog.split("Error Message:")[1].trim().replace(/\.$/, "");
47986
+ }
47987
+ // "insufficient funds" / "insufficient lamports" from logs
47988
+ const fundsLog = logs.find((log)=>log.includes("Error: insufficient funds") || log.includes("Transfer: insufficient lamports"));
47989
+ if (fundsLog) return fundsLog;
47990
+ // Custom program error code in logs (covers GLAM, Jupiter, etc.)
47991
+ const customErrorLog = logs.find((log)=>log.includes("custom program error:"));
47992
+ if (customErrorLog) {
47993
+ const match = customErrorLog.match(/custom program error: (0x[0-9a-fA-F]+)/);
48956
47994
  if (match) {
48957
- const errorCodeHex = match[1];
48958
- const errorCode = parseInt(errorCodeHex, 16);
48959
- const jupiterError = JUPITER_SWAP_ERRORS[errorCode];
48960
- if (jupiterError) {
48961
- return jupiterError;
48962
- }
47995
+ const failedProgramId = extractFailedProgramId(logs);
47996
+ const resolved = resolveErrorCode(match[1], staging, failedProgramId);
47997
+ if (resolved) return resolved;
47998
+ return `Program error: ${match[1]}`;
48963
47999
  }
48964
48000
  }
48965
48001
  return "Unknown error";
@@ -49000,35 +48036,28 @@ const getSimulationResult = async (connection, instructions, payer, lookupTables
49000
48036
  }
49001
48037
  };
49002
48038
  const getErrorFromRpcResponse = (rpcResponse, staging)=>{
49003
- // Note: `confirmTransaction` does not throw an error if the confirmation does not succeed,
49004
- // but rather a `TransactionError` object. so we handle that here
49005
48039
  const error = rpcResponse.value.err;
49006
- if (error) {
49007
- // Can be a string or an object (literally just {}, no further typing is provided by the library)
49008
- // https://github.com/solana-labs/solana-web3.js/blob/4436ba5189548fc3444a9f6efb51098272926945/packages/library-legacy/src/connection.ts#L2930
49009
- if (typeof error === "object") {
49010
- const errorKeys = Object.keys(error);
49011
- if (errorKeys.length === 1) {
49012
- if (errorKeys[0] !== "InstructionError") {
49013
- throw new Error(`Unknown RPC error: ${error}`);
49014
- }
49015
- // @ts-ignore due to missing typing information mentioned above.
49016
- const instructionError = error["InstructionError"];
49017
- // An instruction error is a custom program error and looks like: [1, {"Custom": 1}]
49018
- // See also https://solana.stackexchange.com/a/931/294
49019
- const customErrorCode = instructionError[1]["Custom"];
49020
- const { errors: glamErrors } = getGlamProtocolIdl(staging);
49021
- const glamError = glamErrors.find((e)=>e.code === customErrorCode);
49022
- if (glamError?.msg) {
49023
- throw new Error(glamError.msg);
49024
- }
49025
- // Unrecognized error code, try to parse program logs to get error message
49026
- const errMsg = parseProgramLogs(rpcResponse.value.logs);
49027
- throw new Error(errMsg);
49028
- }
49029
- }
49030
- throw Error("Unknown error");
49031
- }
48040
+ if (!error) return;
48041
+ if (typeof error === "object") {
48042
+ const errorKeys = Object.keys(error);
48043
+ if (errorKeys.length === 1) {
48044
+ if (errorKeys[0] !== "InstructionError") {
48045
+ throw new Error(`Unknown RPC error: ${JSON.stringify(error)}`);
48046
+ }
48047
+ // @ts-ignore due to missing typing information
48048
+ const instructionError = error["InstructionError"];
48049
+ const customErrorCode = instructionError?.[1]?.["Custom"];
48050
+ if (customErrorCode !== undefined) {
48051
+ const failedProgramId = extractFailedProgramId(rpcResponse.value.logs);
48052
+ const msg = resolveErrorCode(customErrorCode, staging, failedProgramId);
48053
+ if (msg) throw new Error(msg);
48054
+ }
48055
+ // Fallback to log-based parsing
48056
+ throw new Error(parseProgramLogs(rpcResponse.value.logs || [], staging));
48057
+ }
48058
+ throw new Error(`Unknown RPC error: ${JSON.stringify(error)}`);
48059
+ }
48060
+ throw new Error(typeof error === "string" ? error : "Unknown error");
49032
48061
  };
49033
48062
 
49034
48063
  function readUnsignedBigInt64LE(buffer, offset) {
@@ -49896,12 +48925,9 @@ class JupiterApiClient {
49896
48925
  this.owner = data.owner ?? null;
49897
48926
  this.portfolioManagerName = data.portfolioManagerName ?? null;
49898
48927
  this.borrowable = data.borrowable ?? null;
49899
- this.reduceOnly = data.reduceOnly ?? null;
49900
- this.anyLst = data.anyLst ?? null;
49901
48928
  this.timelockDuration = data.timelockDuration ?? null;
49902
48929
  this.delegateAcls = data.delegateAcls ?? null;
49903
48930
  this.integrationAcls = data.integrationAcls ?? null;
49904
- this.feeStructure = data.feeStructure ?? null;
49905
48931
  }
49906
48932
  }
49907
48933
  /**
@@ -50059,8 +49085,6 @@ class JupiterApiClient {
50059
49085
  this.externalPositions = data.externalPositions ?? [];
50060
49086
  this.pricedProtocols = data.pricedProtocols ?? [];
50061
49087
  this.borrowable = data.borrowable ?? null;
50062
- this.reduceOnly = data.reduceOnly ?? null;
50063
- this.anyLst = data.anyLst ?? null;
50064
49088
  }
50065
49089
  }
50066
49090
  class CreatedModel {
@@ -50214,15 +49238,6 @@ exports.ClusterNetwork = /*#__PURE__*/ function(ClusterNetwork) {
50214
49238
  */ ClusterNetwork.fromUrl = fromUrl;
50215
49239
  })(exports.ClusterNetwork || (exports.ClusterNetwork = {}));
50216
49240
 
50217
- class GlamError extends Error {
50218
- constructor(message, rawError, programLogs){
50219
- super(message);
50220
- this.message = message;
50221
- this.rawError = rawError;
50222
- this.programLogs = programLogs;
50223
- }
50224
- }
50225
-
50226
49241
  const LOOKUP_TABLES = [
50227
49242
  new web3_js.PublicKey("284iwGtA9X9aLy3KsyV8uT2pXLARhYbiSi5SiM2g47M2"),
50228
49243
  new web3_js.PublicKey("D9cnvzswDikQDf53k4HpQ3KJ9y1Fv3HGGDFYMXnK5T6c"),
@@ -50400,7 +49415,8 @@ class BaseClient {
50400
49415
  const errTx = await this.connection.getTransaction(txSig, {
50401
49416
  maxSupportedTransactionVersion: 0
50402
49417
  });
50403
- throw new GlamError(parseProgramLogs(errTx?.meta?.logMessages), errTx?.meta?.err || undefined, errTx?.meta?.logMessages || []);
49418
+ const logs = errTx?.meta?.logMessages || [];
49419
+ throw new GlamError(parseProgramLogs(logs, this.staging), errTx?.meta?.err, logs);
50404
49420
  }
50405
49421
  return txSig;
50406
49422
  }
@@ -50619,7 +49635,7 @@ class BaseClient {
50619
49635
  const integrationPolicy = stateAccount.integrationAcls?.find((acl)=>acl.integrationProgram.equals(integProgramId));
50620
49636
  const policyData = integrationPolicy?.protocolPolicies?.find((policy)=>policy.protocolBitflag === protocolBitflag)?.data;
50621
49637
  if (policyData) {
50622
- return policyClass.decode(policyData);
49638
+ return policyClass.decode(policyData, this.staging);
50623
49639
  }
50624
49640
  return null;
50625
49641
  }
@@ -50782,6 +49798,17 @@ class DriftVaultDepositor extends Decodable {
50782
49798
  get netShares() {
50783
49799
  return this.vaultShares.sub(this.lastWithdrawRequest.shares);
50784
49800
  }
49801
+ /** Rebase shares to match the vault's current shares base. */ rebaseShares(shares, vaultSharesBase) {
49802
+ if (this.vaultSharesBase === vaultSharesBase) return shares;
49803
+ const expoDiff = vaultSharesBase - this.vaultSharesBase;
49804
+ const divisor = new anchor.BN(10).pow(new anchor.BN(expoDiff));
49805
+ return shares.div(divisor);
49806
+ }
49807
+ /** Net shares rebased to the vault's current shares base. */ netSharesRebased(vaultSharesBase) {
49808
+ const rebased = this.rebaseShares(this.vaultShares, vaultSharesBase);
49809
+ const pendingRebased = this.rebaseShares(this.lastWithdrawRequest.shares, vaultSharesBase);
49810
+ return rebased.sub(pendingRebased);
49811
+ }
50785
49812
  }
50786
49813
  DriftVaultDepositor._layout = borsh.struct([
50787
49814
  borsh.array(borsh.u8(), 8, "discriminator"),
@@ -50842,7 +49869,7 @@ class DriftVault extends Decodable {
50842
49869
  const aumScaledUsd = this.aum(spotPositions, perpPositions, spotMarketsMap, perpMarketsMap);
50843
49870
  const spotMarket = spotMarketsMap.get(this.marketPda(MarketType.SPOT, this.spotMarketIndex));
50844
49871
  const baseAssetAmount = aumScaledUsd.mul(new anchor.BN(10 ** spotMarket.decimals)).div(spotMarket.lastOraclePrice);
50845
- return baseAssetAmount.sub(this.managerBorrowedValue);
49872
+ return baseAssetAmount.add(this.managerBorrowedValue);
50846
49873
  }
50847
49874
  }
50848
49875
  DriftVault._layout = borsh.struct([
@@ -52612,7 +51639,7 @@ let TxBuilder$e = class TxBuilder extends BaseTxBuilder {
52612
51639
  inputMint = new web3_js.PublicKey(quoteParams?.inputMint || resolvedQuoteResponse.inputMint);
52613
51640
  outputMint = new web3_js.PublicKey(quoteParams?.outputMint || resolvedQuoteResponse.outputMint);
52614
51641
  amount = new anchor.BN(quoteParams?.amount || resolvedQuoteResponse.inAmount);
52615
- swapInstructions = await this.client.jupApi.getSwapInstructions(resolvedQuoteResponse, glamVault);
51642
+ swapInstructions = await this.client.jupApi.getSwapInstructions(resolvedQuoteResponse, glamVault, options.trackingAccount);
52616
51643
  } else {
52617
51644
  // If swapInstructions is provided, we need to extract mints and amount from quoteParams or quoteResponse
52618
51645
  if (quoteParams) {
@@ -54186,6 +53213,49 @@ let TxBuilder$a = class TxBuilder extends BaseTxBuilder {
54186
53213
  const tx = this.build(ixs, txOptions);
54187
53214
  return await this.client.base.intoVersionedTransaction(tx, txOptions);
54188
53215
  }
53216
+ async requestElevationGroupIxs(lendingMarket, elevationGroup, glamSigner) {
53217
+ const vault = this.client.base.vaultPda;
53218
+ const obligation = this.client.getObligationPda(vault, lendingMarket);
53219
+ // Find all reserve keys
53220
+ const { activeDeposits, activeBorrows } = await this.client.fetchAndParseObligation(obligation);
53221
+ const reserveKeys = [
53222
+ ...activeDeposits.map(({ depositReserve })=>depositReserve),
53223
+ ...activeBorrows.map(({ borrowReserve })=>borrowReserve)
53224
+ ];
53225
+ // Build refresh ixs
53226
+ const reserves = await this.client.fetchAndParseReserves(reserveKeys);
53227
+ const refreshReservesIx = this.refreshReservesBatchIx(reserves, false);
53228
+ const refreshObligationIx = this.refreshObligationIx({
53229
+ lendingMarket,
53230
+ obligation,
53231
+ reserves: reserveKeys
53232
+ });
53233
+ const ix = await this.client.base.extKaminoProgram.methods// @ts-expect-error staging only
53234
+ .lendingRequestElevationGroup(elevationGroup).accounts({
53235
+ glamState: this.client.base.statePda,
53236
+ glamSigner,
53237
+ obligation,
53238
+ lendingMarket
53239
+ }).remainingAccounts(reserveKeys.map((pubkey)=>({
53240
+ pubkey,
53241
+ isSigner: false,
53242
+ isWritable: false
53243
+ }))).instruction();
53244
+ return [
53245
+ refreshReservesIx,
53246
+ refreshObligationIx,
53247
+ ix
53248
+ ];
53249
+ }
53250
+ async requestElevationGroupTx(lendingMarket, elevationGroup, txOptions = {}) {
53251
+ if (!this.client.base.staging) {
53252
+ throw new Error("requestElevationGroupTx is only available in staging mode");
53253
+ }
53254
+ const glamSigner = txOptions.signer || this.client.base.signer;
53255
+ const ixs = await this.requestElevationGroupIxs(lendingMarket, elevationGroup, glamSigner);
53256
+ const tx = this.build(ixs, txOptions);
53257
+ return await this.client.base.intoVersionedTransaction(tx, txOptions);
53258
+ }
54189
53259
  async repayIxs(market, asset, amount, glamSigner) {
54190
53260
  const vault = this.client.base.vaultPda;
54191
53261
  const obligation = this.client.getObligationPda(vault, market);
@@ -54252,6 +53322,15 @@ class KaminoLendingClient {
54252
53322
  return await this.base.sendAndConfirm(tx);
54253
53323
  }
54254
53324
  /**
53325
+ * Requests an elevation group for an obligation.
53326
+ */ async requestElevationGroup(market, elevationGroup, txOptions = {}) {
53327
+ if (!this.base.staging) {
53328
+ throw new Error("requestElevationGroup is only available in staging mode");
53329
+ }
53330
+ const tx = await this.txBuilder.requestElevationGroupTx(new web3_js.PublicKey(market), elevationGroup, txOptions);
53331
+ return await this.base.sendAndConfirm(tx);
53332
+ }
53333
+ /**
54255
53334
  * Repays asset to the lending market.
54256
53335
  */ async repay(market, asset, amount, txOptions = {}) {
54257
53336
  const tx = await this.txBuilder.repayTx(new web3_js.PublicKey(market), new web3_js.PublicKey(asset), new anchor.BN(amount), txOptions);
@@ -55573,6 +54652,7 @@ class PriceClient {
55573
54652
  const { marketIndex, marketPda } = perpPosition;
55574
54653
  const { lastOraclePrice, cumulativeFundingRateLong, cumulativeFundingRateShort } = perpMarketsMap.get(marketPda);
55575
54654
  const amount = perpPosition.getUsdValueScaled(lastOraclePrice, cumulativeFundingRateLong, cumulativeFundingRateShort);
54655
+ const baseAssetAmountUi = toUiAmount(perpPosition.baseAssetAmount, 9);
55576
54656
  const { usdPrice, slot } = await this.getTokenPrice(USDC, tokenPricesMap);
55577
54657
  const holding = new Holding(USDC, 6, amount, usdPrice, {
55578
54658
  slot,
@@ -55580,7 +54660,11 @@ class PriceClient {
55580
54660
  }, "DriftProtocol", {
55581
54661
  user: userPda,
55582
54662
  marketIndex,
55583
- marketType: "perp"
54663
+ marketType: "perp",
54664
+ // Preserve both USD value and signed base size for downstream UIs.
54665
+ usdValueUi: toUiAmount(amount, 6),
54666
+ baseAssetAmount: perpPosition.baseAssetAmount.toString(),
54667
+ baseAssetAmountUi
55584
54668
  });
55585
54669
  holdings.push(holding);
55586
54670
  }
@@ -55594,7 +54678,32 @@ class PriceClient {
55594
54678
  const dvaultUserData = accountsDataMap.get(dvault.user);
55595
54679
  const { spotPositions, perpPositions } = DriftUser.decode(dvault.user, dvaultUserData);
55596
54680
  const aum = dvault.aumInBaseAsset(spotPositions, perpPositions, spotMarketsMap, perpMarketsMap);
55597
- const amount = depositor.netShares.mul(aum).div(dvault.totalShares).add(depositor.lastWithdrawRequest.value);
54681
+ // Deduct accrued management fee from AUM (matches Rust logic)
54682
+ const clockData = accountsDataMap.get(web3_js.SYSVAR_CLOCK_PUBKEY);
54683
+ const nowTs = new anchor.BN(clockData ? clockData.readUInt32LE(32) : 0);
54684
+ let aumPostMgmt = aum;
54685
+ if (dvault.managementFee.gtn(0) && aum.gtn(0)) {
54686
+ const sinceLast = nowTs.sub(dvault.lastFeeUpdateTs);
54687
+ const depositorsAum = aum.mul(dvault.userShares).div(dvault.totalShares);
54688
+ const mgmtFee = depositorsAum.mul(dvault.managementFee).div(new anchor.BN(1000000)).mul(sinceLast).div(new anchor.BN(31536000));
54689
+ aumPostMgmt = aum.sub(mgmtFee);
54690
+ }
54691
+ // Compute depositor position WITHOUT pending withdrawal (matches Rust logic)
54692
+ const depositorNetShares = depositor.netSharesRebased(dvault.sharesBase);
54693
+ const sharesPosition = depositorNetShares.mul(aumPostMgmt).div(dvault.totalShares);
54694
+ const pendingWithdrawalValue = depositor.lastWithdrawRequest.value;
54695
+ // PnL & fee breakdown (perf fee is computed on shares position only)
54696
+ const costBasis = depositor.netDeposits.add(depositor.cumulativeProfitShareAmount);
54697
+ const pnlBeforeFees = sharesPosition.sub(costBasis);
54698
+ let pendingPerfFee = new anchor.BN(0);
54699
+ if (dvault.profitShare > 0) {
54700
+ const hurdleBaseline = costBasis.mul(new anchor.BN(dvault.hurdleRate)).div(new anchor.BN(1000000));
54701
+ if (pnlBeforeFees.gt(hurdleBaseline)) {
54702
+ pendingPerfFee = pnlBeforeFees.mul(new anchor.BN(dvault.profitShare)).div(new anchor.BN(1000000));
54703
+ }
54704
+ }
54705
+ // final = shares_position - perf_fee + pending_withdrawal
54706
+ const amount = sharesPosition.sub(pendingPerfFee).add(pendingWithdrawalValue);
55598
54707
  const { mint, decimals } = dvault.getBaseAsset(spotMarketsMap);
55599
54708
  const { usdPrice, slot } = await this.getTokenPrice(mint, tokenPricesMap);
55600
54709
  const holding = new Holding(mint, decimals, amount, usdPrice, {
@@ -55602,7 +54711,10 @@ class PriceClient {
55602
54711
  source: priceSource
55603
54712
  }, "DriftVaults", {
55604
54713
  vault: dvault.getAddress(),
55605
- depositor: depositor.getAddress()
54714
+ depositor: depositor.getAddress(),
54715
+ pnlBeforeFees,
54716
+ pendingPerfFee,
54717
+ profitSharePct: dvault.profitShare / 10000
55606
54718
  });
55607
54719
  holdings.push(holding);
55608
54720
  }
@@ -55653,26 +54765,54 @@ class PriceClient {
55653
54765
  }
55654
54766
  async getKaminoVaultsHoldings(kvaultAtasAndStates, reservesMap, accountsDataMap, tokenPricesMap, priceSource) {
55655
54767
  const holdings = [];
54768
+ const FRACTION_SCALE = new Decimal(2).pow(60); // U68F60 fixed-point scale
54769
+ const SECONDS_PER_YEAR_KAMINO = 31556926;
54770
+ const clockData = accountsDataMap.get(web3_js.SYSVAR_CLOCK_PUBKEY);
54771
+ const nowTs = clockData ? clockData.readUInt32LE(32) : 0;
55656
54772
  for (const [ata, kvaultState] of kvaultAtasAndStates.pkEntries()){
55657
54773
  const ataData = accountsDataMap.get(ata);
55658
54774
  const tokenAccount = splToken.AccountLayout.decode(ataData);
55659
- let aum = new Decimal(kvaultState.tokenAvailable.toString());
54775
+ let aumAndFees = new Decimal(kvaultState.tokenAvailable.toString());
55660
54776
  kvaultState.validAllocations.map((allocation)=>{
55661
54777
  const reserve = reservesMap.get(allocation.reserve);
55662
54778
  const { collateralExchangeRate } = reserve;
55663
54779
  // allocation ctoken amount to liq asset amount
55664
54780
  const liqAmount = new Decimal(allocation.ctokenAllocation.toString()).div(collateralExchangeRate).floor();
55665
- aum = aum.add(liqAmount);
54781
+ aumAndFees = aumAndFees.add(liqAmount);
55666
54782
  });
55667
- // calculate liquidity token amount
55668
- const amount = new Decimal(tokenAccount.amount.toString()).div(new Decimal(kvaultState.sharesIssued.toString())).mul(aum).floor();
54783
+ // Deduct pending fees from AUM (matches Rust: aum = available + allocated - pending_fees)
54784
+ const pendingFees = new Decimal(kvaultState.pendingFeesSf.toString()).div(FRACTION_SCALE);
54785
+ let vaultAum = aumAndFees.sub(pendingFees);
54786
+ const sharesIssued = new Decimal(kvaultState.sharesIssued.toString());
54787
+ if (vaultAum.lte(0) || sharesIssued.lte(0)) {
54788
+ continue; // early return like Rust: if vault_aum == 0 || shares_issued == 0
54789
+ }
54790
+ // Management fee: prev_aum * from_bps(mgmt_fee_bps) * since_last / SECONDS_PER_YEAR
54791
+ const prevAum = new Decimal(kvaultState.prevAumSf.toString()).div(FRACTION_SCALE);
54792
+ const sinceLast = Math.max(0, nowTs - kvaultState.lastFeeChargeTimestamp.toNumber());
54793
+ let mgmtCharge = new Decimal(0);
54794
+ if (sinceLast > 0) {
54795
+ const mgmtFeeRate = new Decimal(kvaultState.managementFeeBps.toString()).div(10000);
54796
+ mgmtCharge = prevAum.mul(mgmtFeeRate).mul(sinceLast).div(SECONDS_PER_YEAR_KAMINO);
54797
+ }
54798
+ // Performance fee: from_bps(perf_fee_bps) * max(0, vault_aum - prev_aum)
54799
+ const earnedInterest = Decimal.max(0, vaultAum.sub(prevAum));
54800
+ const perfCharge = new Decimal(kvaultState.performanceFeeBps.toString()).div(10000).mul(earnedInterest);
54801
+ // Deduct fees from AUM (matches Rust: vault_aum = vault_aum - mgmt_charge - perf_charge)
54802
+ vaultAum = vaultAum.sub(mgmtCharge).sub(perfCharge);
54803
+ // calculate liquidity token amount: shares * vault_aum.floor() / shares_issued
54804
+ const amount = new Decimal(tokenAccount.amount.toString()).mul(vaultAum.floor()).div(sharesIssued).floor();
55669
54805
  const { usdPrice, slot } = await this.getTokenPrice(kvaultState.tokenMint, tokenPricesMap);
55670
54806
  const holding = new Holding(kvaultState.tokenMint, kvaultState.tokenMintDecimals.toNumber(), new anchor.BN(amount.toString()), usdPrice, {
55671
54807
  slot,
55672
54808
  source: priceSource
55673
54809
  }, "KaminoVaults", {
55674
54810
  kaminoVault: kvaultState._address,
55675
- kaminoVaultAta: ata
54811
+ kaminoVaultAta: ata,
54812
+ pendingMgmtFee: mgmtCharge.toFixed(0),
54813
+ pendingPerfFee: perfCharge.toFixed(0),
54814
+ managementFeeBps: kvaultState.managementFeeBps.toNumber(),
54815
+ performanceFeeBps: kvaultState.performanceFeeBps.toNumber()
55676
54816
  });
55677
54817
  holdings.push(holding);
55678
54818
  }
@@ -56142,34 +55282,6 @@ let TxBuilder$6 = class TxBuilder extends BaseTxBuilder {
56142
55282
  const ixs = await this.claimFeesIxs(glamSigner);
56143
55283
  return await this.buildVersionedTx(ixs, txOptions);
56144
55284
  }
56145
- async chargeProtocolFeeIxs(glamSigner) {
56146
- const stateModel = await this.client.base.fetchStateModel();
56147
- const { baseAssetMint: baseAsset } = stateModel;
56148
- // TODO: parse from glam config account
56149
- const protocolFeeAuthority = new web3_js.PublicKey("9oWi2MjrAujYNTUXXNBLk1ugioaF1mJHc7EoamX4eQLZ");
56150
- const { tokenProgram } = await fetchMintAndTokenProgram(this.client.base.connection, baseAsset);
56151
- const protocolFeeAuthorityAta = this.client.base.getAta(baseAsset, protocolFeeAuthority, tokenProgram);
56152
- const priceVaultIxs = await this.client.price.priceVaultIxs();
56153
- const preInstructions = [
56154
- splToken.createAssociatedTokenAccountIdempotentInstruction(glamSigner, protocolFeeAuthorityAta, protocolFeeAuthority, baseAsset, tokenProgram),
56155
- ...priceVaultIxs
56156
- ];
56157
- const ix = await this.client.base.protocolProgram.methods.chargeProtocolFee().accounts({
56158
- glamState: this.client.base.statePda,
56159
- protocolFeeAuthority,
56160
- depositAsset: baseAsset,
56161
- depositTokenProgram: tokenProgram
56162
- }).instruction();
56163
- return [
56164
- ...preInstructions,
56165
- ix
56166
- ];
56167
- }
56168
- async chargeProtocolFeeTx(txOptions = {}) {
56169
- const glamSigner = txOptions.signer || this.client.base.signer;
56170
- const ixs = await this.chargeProtocolFeeIxs(glamSigner);
56171
- return await this.buildVersionedTx(ixs, txOptions);
56172
- }
56173
55285
  async setProtocolFeesIx(baseFeeBps, flowFeeBps, signer) {
56174
55286
  const _signer = signer || this.client.base.signer;
56175
55287
  return await this.client.base.mintProgram.methods.setProtocolFees(baseFeeBps, flowFeeBps).accounts({
@@ -56229,10 +55341,6 @@ class FeesClient {
56229
55341
  const vTx = await this.txBuilder.claimFeesTx(txOptions);
56230
55342
  return await this.base.sendAndConfirm(vTx);
56231
55343
  }
56232
- async chargeProtocolFee(txOptions = {}) {
56233
- const vTx = await this.txBuilder.chargeProtocolFeeTx(txOptions);
56234
- return await this.base.sendAndConfirm(vTx);
56235
- }
56236
55344
  async setProtocolFees(baseFeeBps, flowFeeBps, txOptions = {}) {
56237
55345
  const vTx = await this.txBuilder.setProtocolFeesTx(baseFeeBps, flowFeeBps, txOptions);
56238
55346
  return await this.base.sendAndConfirm(vTx);
@@ -58131,6 +57239,7 @@ exports.compareIntegrationAcls = compareIntegrationAcls;
58131
57239
  exports.comparePublicKeyArrays = comparePublicKeyArrays;
58132
57240
  exports.evmAddressToBytes32 = evmAddressToBytes32;
58133
57241
  exports.evmAddressToPublicKey = evmAddressToPublicKey;
57242
+ exports.extractFailedProgramId = extractFailedProgramId;
58134
57243
  exports.fetchAddressLookupTableAccounts = fetchAddressLookupTableAccounts;
58135
57244
  exports.fetchMintAndTokenProgram = fetchMintAndTokenProgram;
58136
57245
  exports.fetchMintsAndTokenPrograms = fetchMintsAndTokenPrograms;
@@ -58200,10 +57309,12 @@ exports.parsePermissionNames = parsePermissionNames;
58200
57309
  exports.parseProgramLogs = parseProgramLogs;
58201
57310
  exports.parseProtocolPermissionsBitmask = parseProtocolPermissionsBitmask;
58202
57311
  exports.parseProtocolsBitmask = parseProtocolsBitmask;
57312
+ exports.parseTxError = parseTxError;
58203
57313
  exports.publicKeyToEvmAddress = publicKeyToEvmAddress;
58204
57314
  exports.readI128LE = readI128LE;
58205
57315
  exports.readSignedBigInt64LE = readSignedBigInt64LE;
58206
57316
  exports.readUnsignedBigInt64LE = readUnsignedBigInt64LE;
57317
+ exports.resolveErrorCode = resolveErrorCode;
58207
57318
  exports.resolveStaging = resolveStaging;
58208
57319
  exports.stringToChars = stringToChars;
58209
57320
  exports.toUiAmount = toUiAmount;