@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.esm.js CHANGED
@@ -6,7 +6,7 @@ import { unpack } from '@solana/spl-token-metadata';
6
6
  import * as borsh from '@coral-xyz/borsh';
7
7
  import { struct, u32, u64, option, vec, publicKey, u16, u8, array, u128, i64, bool } from '@coral-xyz/borsh';
8
8
  import { bs58 } from '@coral-xyz/anchor/dist/cjs/utils/bytes';
9
- import { decompress } from 'fzstd';
9
+ import 'fzstd';
10
10
  import Decimal from 'decimal.js';
11
11
  import { z } from 'zod';
12
12
  import { LstList } from '@glamsystems/sanctum-lst-list';
@@ -46,327 +46,6 @@ var instructions$h = [
46
46
  ],
47
47
  args: []
48
48
  },
49
- {
50
- name: "charge_protocol_fee",
51
- docs: [
52
- "Charges protocol base fee on non-tokenized vaults"
53
- ],
54
- discriminator: [
55
- 48,
56
- 225,
57
- 89,
58
- 103,
59
- 48,
60
- 65,
61
- 183,
62
- 238
63
- ],
64
- accounts: [
65
- {
66
- name: "glam_state",
67
- writable: true
68
- },
69
- {
70
- name: "glam_vault",
71
- writable: true,
72
- pda: {
73
- seeds: [
74
- {
75
- kind: "const",
76
- value: [
77
- 118,
78
- 97,
79
- 117,
80
- 108,
81
- 116
82
- ]
83
- },
84
- {
85
- kind: "account",
86
- path: "glam_state"
87
- }
88
- ]
89
- }
90
- },
91
- {
92
- name: "signer",
93
- writable: true,
94
- signer: true
95
- },
96
- {
97
- name: "deposit_asset"
98
- },
99
- {
100
- name: "vault_deposit_ata",
101
- writable: true,
102
- pda: {
103
- seeds: [
104
- {
105
- kind: "account",
106
- path: "glam_vault"
107
- },
108
- {
109
- kind: "account",
110
- path: "deposit_token_program"
111
- },
112
- {
113
- kind: "account",
114
- path: "deposit_asset"
115
- }
116
- ],
117
- program: {
118
- kind: "const",
119
- value: [
120
- 140,
121
- 151,
122
- 37,
123
- 143,
124
- 78,
125
- 36,
126
- 137,
127
- 241,
128
- 187,
129
- 61,
130
- 16,
131
- 41,
132
- 20,
133
- 142,
134
- 13,
135
- 131,
136
- 11,
137
- 90,
138
- 19,
139
- 153,
140
- 218,
141
- 255,
142
- 16,
143
- 132,
144
- 4,
145
- 142,
146
- 123,
147
- 216,
148
- 219,
149
- 233,
150
- 248,
151
- 89
152
- ]
153
- }
154
- }
155
- },
156
- {
157
- name: "protocol_fee_authority"
158
- },
159
- {
160
- name: "protocol_fee_authority_ata",
161
- writable: true,
162
- pda: {
163
- seeds: [
164
- {
165
- kind: "account",
166
- path: "protocol_fee_authority"
167
- },
168
- {
169
- kind: "account",
170
- path: "deposit_token_program"
171
- },
172
- {
173
- kind: "account",
174
- path: "deposit_asset"
175
- }
176
- ],
177
- program: {
178
- kind: "const",
179
- value: [
180
- 140,
181
- 151,
182
- 37,
183
- 143,
184
- 78,
185
- 36,
186
- 137,
187
- 241,
188
- 187,
189
- 61,
190
- 16,
191
- 41,
192
- 20,
193
- 142,
194
- 13,
195
- 131,
196
- 11,
197
- 90,
198
- 19,
199
- 153,
200
- 218,
201
- 255,
202
- 16,
203
- 132,
204
- 4,
205
- 142,
206
- 123,
207
- 216,
208
- 219,
209
- 233,
210
- 248,
211
- 89
212
- ]
213
- }
214
- }
215
- },
216
- {
217
- name: "glam_config",
218
- pda: {
219
- seeds: [
220
- {
221
- kind: "const",
222
- value: [
223
- 103,
224
- 108,
225
- 111,
226
- 98,
227
- 97,
228
- 108,
229
- 45,
230
- 99,
231
- 111,
232
- 110,
233
- 102,
234
- 105,
235
- 103
236
- ]
237
- }
238
- ],
239
- program: {
240
- kind: "const",
241
- value: [
242
- 10,
243
- 11,
244
- 0,
245
- 83,
246
- 72,
247
- 16,
248
- 46,
249
- 144,
250
- 46,
251
- 42,
252
- 79,
253
- 22,
254
- 157,
255
- 123,
256
- 21,
257
- 242,
258
- 192,
259
- 146,
260
- 1,
261
- 78,
262
- 88,
263
- 59,
264
- 102,
265
- 9,
266
- 190,
267
- 226,
268
- 92,
269
- 189,
270
- 187,
271
- 232,
272
- 83,
273
- 220
274
- ]
275
- }
276
- }
277
- },
278
- {
279
- name: "system_program",
280
- address: "11111111111111111111111111111111"
281
- },
282
- {
283
- name: "associated_token_program",
284
- address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
285
- },
286
- {
287
- name: "deposit_token_program"
288
- }
289
- ],
290
- args: []
291
- },
292
- {
293
- name: "check_and_update_transfer_tracker",
294
- discriminator: [
295
- 180,
296
- 225,
297
- 201,
298
- 123,
299
- 192,
300
- 30,
301
- 178,
302
- 195
303
- ],
304
- accounts: [
305
- {
306
- name: "glam_state"
307
- },
308
- {
309
- name: "glam_signer",
310
- writable: true,
311
- signer: true
312
- },
313
- {
314
- name: "transfer_tracker",
315
- writable: true,
316
- pda: {
317
- seeds: [
318
- {
319
- kind: "const",
320
- value: [
321
- 116,
322
- 114,
323
- 97,
324
- 110,
325
- 115,
326
- 102,
327
- 101,
328
- 114,
329
- 45,
330
- 116,
331
- 114,
332
- 97,
333
- 99,
334
- 107,
335
- 101,
336
- 114
337
- ]
338
- },
339
- {
340
- kind: "account",
341
- path: "glam_state"
342
- },
343
- {
344
- kind: "account",
345
- path: "glam_signer"
346
- },
347
- {
348
- kind: "arg",
349
- path: "mint"
350
- }
351
- ]
352
- }
353
- },
354
- {
355
- name: "system_program",
356
- address: "11111111111111111111111111111111"
357
- }
358
- ],
359
- args: [
360
- {
361
- name: "mint",
362
- type: "pubkey"
363
- },
364
- {
365
- name: "amount",
366
- type: "u64"
367
- }
368
- ]
369
- },
370
49
  {
371
50
  name: "close_state",
372
51
  discriminator: [
@@ -761,755 +440,192 @@ var instructions$h = [
761
440
  },
762
441
  {
763
442
  name: "cpi_program",
764
- address: "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
765
- },
766
- {
767
- name: "input_stake_pool",
768
- optional: true
769
- },
770
- {
771
- name: "output_stake_pool",
772
- optional: true
773
- }
774
- ],
775
- args: [
776
- {
777
- name: "data",
778
- type: "bytes"
779
- }
780
- ]
781
- },
782
- {
783
- name: "link_unlink_mint_by_mint_authority",
784
- docs: [
785
- "For glam mint program's use only"
786
- ],
787
- discriminator: [
788
- 85,
789
- 67,
790
- 58,
791
- 245,
792
- 175,
793
- 14,
794
- 122,
795
- 6
796
- ],
797
- accounts: [
798
- {
799
- name: "glam_state",
800
- writable: true
801
- },
802
- {
803
- name: "glam_mint"
804
- },
805
- {
806
- name: "glam_mint_authority",
807
- signer: true
808
- }
809
- ],
810
- args: [
811
- {
812
- name: "link",
813
- type: "bool"
814
- }
815
- ]
816
- },
817
- {
818
- name: "reset_priced_protocols_by_mint_authority",
819
- docs: [
820
- "For glam mint program's use only"
821
- ],
822
- discriminator: [
823
- 86,
824
- 95,
825
- 153,
826
- 145,
827
- 179,
828
- 181,
829
- 107,
830
- 235
831
- ],
832
- accounts: [
833
- {
834
- name: "glam_state",
835
- writable: true
836
- },
837
- {
838
- name: "glam_mint"
839
- },
840
- {
841
- name: "glam_mint_authority",
842
- signer: true
843
- }
844
- ],
845
- args: []
846
- },
847
- {
848
- name: "set_jupiter_swap_policy",
849
- discriminator: [
850
- 189,
851
- 182,
852
- 227,
853
- 165,
854
- 127,
855
- 148,
856
- 246,
857
- 189
858
- ],
859
- accounts: [
860
- {
861
- name: "glam_state",
862
- writable: true
863
- },
864
- {
865
- name: "glam_signer",
866
- writable: true,
867
- signer: true
868
- }
869
- ],
870
- args: [
871
- {
872
- name: "policy",
873
- type: {
874
- defined: {
875
- name: "JupiterSwapPolicy"
876
- }
877
- }
878
- }
879
- ]
880
- },
881
- {
882
- name: "set_protocol_policy",
883
- discriminator: [
884
- 37,
885
- 99,
886
- 61,
887
- 122,
888
- 227,
889
- 102,
890
- 182,
891
- 180
892
- ],
893
- accounts: [
894
- {
895
- name: "glam_state",
896
- writable: true
897
- },
898
- {
899
- name: "glam_signer",
900
- writable: true,
901
- signer: true
902
- }
903
- ],
904
- args: [
905
- {
906
- name: "integration_program",
907
- type: "pubkey"
908
- },
909
- {
910
- name: "protocol_bitflag",
911
- type: "u16"
912
- },
913
- {
914
- name: "data",
915
- type: "bytes"
916
- }
917
- ]
918
- },
919
- {
920
- name: "set_system_transfer_policy",
921
- discriminator: [
922
- 102,
923
- 21,
924
- 157,
925
- 101,
926
- 19,
927
- 4,
928
- 100,
929
- 213
930
- ],
931
- accounts: [
932
- {
933
- name: "glam_state",
934
- writable: true
935
- },
936
- {
937
- name: "glam_signer",
938
- writable: true,
939
- signer: true
940
- }
941
- ],
942
- args: [
943
- {
944
- name: "policy",
945
- type: {
946
- defined: {
947
- name: "TransferPolicy"
948
- }
949
- }
950
- }
951
- ]
952
- },
953
- {
954
- name: "set_transfer_rate_limit_policy",
955
- discriminator: [
956
- 27,
957
- 40,
958
- 234,
959
- 194,
960
- 151,
961
- 218,
962
- 55,
963
- 203
964
- ],
965
- accounts: [
966
- {
967
- name: "glam_state",
968
- writable: true
969
- },
970
- {
971
- name: "glam_signer",
972
- writable: true,
973
- signer: true
974
- }
975
- ],
976
- args: [
977
- {
978
- name: "policy",
979
- type: {
980
- defined: {
981
- name: "TransferRateLimitPolicy"
982
- }
983
- }
984
- }
985
- ]
986
- },
987
- {
988
- name: "stake_authorize",
989
- discriminator: [
990
- 127,
991
- 247,
992
- 88,
993
- 164,
994
- 201,
995
- 0,
996
- 79,
997
- 7
998
- ],
999
- accounts: [
1000
- {
1001
- name: "glam_state",
1002
- writable: true
1003
- },
1004
- {
1005
- name: "glam_vault",
1006
- writable: true,
1007
- pda: {
1008
- seeds: [
1009
- {
1010
- kind: "const",
1011
- value: [
1012
- 118,
1013
- 97,
1014
- 117,
1015
- 108,
1016
- 116
1017
- ]
1018
- },
1019
- {
1020
- kind: "account",
1021
- path: "glam_state"
1022
- }
1023
- ]
1024
- }
1025
- },
1026
- {
1027
- name: "glam_signer",
1028
- writable: true,
1029
- signer: true
1030
- },
1031
- {
1032
- name: "cpi_program",
1033
- address: "Stake11111111111111111111111111111111111111"
1034
- },
1035
- {
1036
- name: "stake",
1037
- writable: true
1038
- },
1039
- {
1040
- name: "clock",
1041
- address: "SysvarC1ock11111111111111111111111111111111"
1042
- }
1043
- ],
1044
- args: [
1045
- {
1046
- name: "new_authority",
1047
- type: "pubkey"
1048
- },
1049
- {
1050
- name: "staker_or_withdrawer",
1051
- type: "u32"
1052
- }
1053
- ]
1054
- },
1055
- {
1056
- name: "stake_deactivate",
1057
- discriminator: [
1058
- 224,
1059
- 10,
1060
- 93,
1061
- 175,
1062
- 175,
1063
- 145,
1064
- 237,
1065
- 169
1066
- ],
1067
- accounts: [
1068
- {
1069
- name: "glam_state"
1070
- },
1071
- {
1072
- name: "glam_vault",
1073
- writable: true,
1074
- pda: {
1075
- seeds: [
1076
- {
1077
- kind: "const",
1078
- value: [
1079
- 118,
1080
- 97,
1081
- 117,
1082
- 108,
1083
- 116
1084
- ]
1085
- },
1086
- {
1087
- kind: "account",
1088
- path: "glam_state"
1089
- }
1090
- ]
1091
- }
1092
- },
1093
- {
1094
- name: "glam_signer",
1095
- writable: true,
1096
- signer: true
1097
- },
1098
- {
1099
- name: "cpi_program",
1100
- address: "Stake11111111111111111111111111111111111111"
1101
- },
1102
- {
1103
- name: "stake",
1104
- writable: true
1105
- },
1106
- {
1107
- name: "clock",
1108
- address: "SysvarC1ock11111111111111111111111111111111"
1109
- }
1110
- ],
1111
- args: []
1112
- },
1113
- {
1114
- name: "stake_delegate_stake",
1115
- discriminator: [
1116
- 202,
1117
- 40,
1118
- 152,
1119
- 239,
1120
- 175,
1121
- 251,
1122
- 66,
1123
- 228
1124
- ],
1125
- accounts: [
1126
- {
1127
- name: "glam_state",
1128
- writable: true
1129
- },
1130
- {
1131
- name: "glam_vault",
1132
- writable: true,
1133
- pda: {
1134
- seeds: [
1135
- {
1136
- kind: "const",
1137
- value: [
1138
- 118,
1139
- 97,
1140
- 117,
1141
- 108,
1142
- 116
1143
- ]
1144
- },
1145
- {
1146
- kind: "account",
1147
- path: "glam_state"
1148
- }
1149
- ]
1150
- }
1151
- },
1152
- {
1153
- name: "glam_signer",
1154
- writable: true,
1155
- signer: true
1156
- },
1157
- {
1158
- name: "cpi_program",
1159
- address: "Stake11111111111111111111111111111111111111"
1160
- },
1161
- {
1162
- name: "stake",
1163
- writable: true
1164
- },
1165
- {
1166
- name: "vote"
1167
- },
1168
- {
1169
- name: "clock",
1170
- address: "SysvarC1ock11111111111111111111111111111111"
1171
- },
1172
- {
1173
- name: "stake_history",
1174
- address: "SysvarStakeHistory1111111111111111111111111"
1175
- },
1176
- {
1177
- name: "stake_config"
1178
- }
1179
- ],
1180
- args: []
1181
- },
1182
- {
1183
- name: "stake_initialize",
1184
- discriminator: [
1185
- 68,
1186
- 66,
1187
- 118,
1188
- 79,
1189
- 15,
1190
- 144,
1191
- 190,
1192
- 190
1193
- ],
1194
- accounts: [
1195
- {
1196
- name: "glam_state",
1197
- writable: true
1198
- },
1199
- {
1200
- name: "glam_vault",
1201
- writable: true,
1202
- pda: {
1203
- seeds: [
1204
- {
1205
- kind: "const",
1206
- value: [
1207
- 118,
1208
- 97,
1209
- 117,
1210
- 108,
1211
- 116
1212
- ]
1213
- },
1214
- {
1215
- kind: "account",
1216
- path: "glam_state"
1217
- }
1218
- ]
1219
- }
1220
- },
1221
- {
1222
- name: "glam_signer",
1223
- writable: true,
1224
- signer: true
1225
- },
1226
- {
1227
- name: "cpi_program",
1228
- address: "Stake11111111111111111111111111111111111111"
1229
- },
1230
- {
1231
- name: "stake",
1232
- writable: true
1233
- },
1234
- {
1235
- name: "rent",
1236
- address: "SysvarRent111111111111111111111111111111111"
1237
- },
1238
- {
1239
- name: "system_program",
1240
- address: "11111111111111111111111111111111"
1241
- }
1242
- ],
1243
- args: []
1244
- },
1245
- {
1246
- name: "stake_merge",
1247
- discriminator: [
1248
- 46,
1249
- 181,
1250
- 125,
1251
- 12,
1252
- 51,
1253
- 179,
1254
- 134,
1255
- 176
1256
- ],
1257
- accounts: [
1258
- {
1259
- name: "glam_state",
1260
- writable: true
1261
- },
1262
- {
1263
- name: "glam_vault",
1264
- writable: true,
1265
- pda: {
1266
- seeds: [
1267
- {
1268
- kind: "const",
1269
- value: [
1270
- 118,
1271
- 97,
1272
- 117,
1273
- 108,
1274
- 116
1275
- ]
1276
- },
1277
- {
1278
- kind: "account",
1279
- path: "glam_state"
1280
- }
1281
- ]
1282
- }
1283
- },
1284
- {
1285
- name: "glam_signer",
1286
- writable: true,
1287
- signer: true
1288
- },
1289
- {
1290
- name: "cpi_program",
1291
- address: "Stake11111111111111111111111111111111111111"
1292
- },
1293
- {
1294
- name: "destination_stake",
1295
- writable: true
1296
- },
1297
- {
1298
- name: "source_stake",
1299
- writable: true
1300
- },
1301
- {
1302
- name: "clock",
1303
- address: "SysvarC1ock11111111111111111111111111111111"
1304
- },
1305
- {
1306
- name: "stake_history",
1307
- address: "SysvarStakeHistory1111111111111111111111111"
1308
- }
1309
- ],
1310
- args: []
1311
- },
1312
- {
1313
- name: "stake_move",
1314
- discriminator: [
1315
- 165,
1316
- 157,
1317
- 188,
1318
- 245,
1319
- 244,
1320
- 234,
1321
- 42,
1322
- 186
1323
- ],
1324
- accounts: [
1325
- {
1326
- name: "glam_state",
1327
- writable: true
1328
- },
1329
- {
1330
- name: "glam_vault",
1331
- writable: true,
1332
- pda: {
1333
- seeds: [
1334
- {
1335
- kind: "const",
1336
- value: [
1337
- 118,
1338
- 97,
1339
- 117,
1340
- 108,
1341
- 116
1342
- ]
1343
- },
1344
- {
1345
- kind: "account",
1346
- path: "glam_state"
1347
- }
1348
- ]
1349
- }
1350
- },
1351
- {
1352
- name: "glam_signer",
1353
- writable: true,
1354
- signer: true
1355
- },
1356
- {
1357
- name: "cpi_program",
1358
- address: "Stake11111111111111111111111111111111111111"
1359
- },
1360
- {
1361
- name: "source_stake",
1362
- writable: true
1363
- },
1364
- {
1365
- name: "destination_stake",
1366
- writable: true
1367
- }
1368
- ],
1369
- args: [
1370
- {
1371
- name: "move_stake",
1372
- type: "bool"
1373
- },
1374
- {
1375
- name: "lamports",
1376
- type: "u64"
1377
- }
1378
- ]
1379
- },
1380
- {
1381
- name: "stake_split",
1382
- discriminator: [
1383
- 63,
1384
- 128,
1385
- 169,
1386
- 206,
1387
- 158,
1388
- 60,
1389
- 135,
1390
- 48
1391
- ],
1392
- accounts: [
1393
- {
1394
- name: "glam_state",
1395
- writable: true
1396
- },
1397
- {
1398
- name: "glam_vault",
1399
- writable: true,
1400
- pda: {
1401
- seeds: [
1402
- {
1403
- kind: "const",
1404
- value: [
1405
- 118,
1406
- 97,
1407
- 117,
1408
- 108,
1409
- 116
1410
- ]
1411
- },
1412
- {
1413
- kind: "account",
1414
- path: "glam_state"
1415
- }
1416
- ]
1417
- }
1418
- },
1419
- {
1420
- name: "glam_signer",
1421
- writable: true,
1422
- signer: true
1423
- },
1424
- {
1425
- name: "cpi_program",
1426
- address: "Stake11111111111111111111111111111111111111"
1427
- },
1428
- {
1429
- name: "stake",
1430
- writable: true
1431
- },
1432
- {
1433
- name: "split_stake",
1434
- writable: true
1435
- }
1436
- ],
1437
- args: [
1438
- {
1439
- name: "lamports",
1440
- type: "u64"
1441
- }
1442
- ]
1443
- },
1444
- {
1445
- name: "stake_withdraw",
1446
- discriminator: [
1447
- 199,
1448
- 13,
1449
- 168,
1450
- 20,
1451
- 92,
1452
- 151,
1453
- 29,
1454
- 56
1455
- ],
1456
- accounts: [
1457
- {
1458
- name: "glam_state",
1459
- writable: true
1460
- },
1461
- {
1462
- name: "glam_vault",
1463
- writable: true,
1464
- pda: {
1465
- seeds: [
1466
- {
1467
- kind: "const",
1468
- value: [
1469
- 118,
1470
- 97,
1471
- 117,
1472
- 108,
1473
- 116
1474
- ]
1475
- },
1476
- {
1477
- kind: "account",
1478
- path: "glam_state"
1479
- }
1480
- ]
1481
- }
1482
- },
1483
- {
1484
- name: "glam_signer",
1485
- writable: true,
1486
- signer: true
1487
- },
1488
- {
1489
- name: "cpi_program",
1490
- address: "Stake11111111111111111111111111111111111111"
443
+ address: "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
1491
444
  },
1492
445
  {
1493
- name: "stake",
446
+ name: "input_stake_pool",
447
+ optional: true
448
+ },
449
+ {
450
+ name: "output_stake_pool",
451
+ optional: true
452
+ }
453
+ ],
454
+ args: [
455
+ {
456
+ name: "data",
457
+ type: "bytes"
458
+ }
459
+ ]
460
+ },
461
+ {
462
+ name: "link_unlink_mint_by_mint_authority",
463
+ docs: [
464
+ "For glam mint program's use only"
465
+ ],
466
+ discriminator: [
467
+ 85,
468
+ 67,
469
+ 58,
470
+ 245,
471
+ 175,
472
+ 14,
473
+ 122,
474
+ 6
475
+ ],
476
+ accounts: [
477
+ {
478
+ name: "glam_state",
1494
479
  writable: true
1495
480
  },
1496
481
  {
1497
- name: "clock",
1498
- address: "SysvarC1ock11111111111111111111111111111111"
482
+ name: "glam_mint"
1499
483
  },
1500
484
  {
1501
- name: "stake_history",
1502
- address: "SysvarStakeHistory1111111111111111111111111"
485
+ name: "glam_mint_authority",
486
+ signer: true
487
+ }
488
+ ],
489
+ args: [
490
+ {
491
+ name: "link",
492
+ type: "bool"
493
+ }
494
+ ]
495
+ },
496
+ {
497
+ name: "reset_priced_protocols_by_mint_authority",
498
+ docs: [
499
+ "For glam mint program's use only"
500
+ ],
501
+ discriminator: [
502
+ 86,
503
+ 95,
504
+ 153,
505
+ 145,
506
+ 179,
507
+ 181,
508
+ 107,
509
+ 235
510
+ ],
511
+ accounts: [
512
+ {
513
+ name: "glam_state",
514
+ writable: true
1503
515
  },
1504
516
  {
1505
- name: "system_program",
1506
- address: "11111111111111111111111111111111"
517
+ name: "glam_mint"
518
+ },
519
+ {
520
+ name: "glam_mint_authority",
521
+ signer: true
522
+ }
523
+ ],
524
+ args: []
525
+ },
526
+ {
527
+ name: "set_jupiter_swap_policy",
528
+ discriminator: [
529
+ 189,
530
+ 182,
531
+ 227,
532
+ 165,
533
+ 127,
534
+ 148,
535
+ 246,
536
+ 189
537
+ ],
538
+ accounts: [
539
+ {
540
+ name: "glam_state",
541
+ writable: true
542
+ },
543
+ {
544
+ name: "glam_signer",
545
+ writable: true,
546
+ signer: true
1507
547
  }
1508
548
  ],
1509
549
  args: [
1510
550
  {
1511
- name: "lamports",
1512
- type: "u64"
551
+ name: "policy",
552
+ type: {
553
+ defined: {
554
+ name: "JupiterSwapPolicy"
555
+ }
556
+ }
557
+ }
558
+ ]
559
+ },
560
+ {
561
+ name: "set_protocol_policy",
562
+ discriminator: [
563
+ 37,
564
+ 99,
565
+ 61,
566
+ 122,
567
+ 227,
568
+ 102,
569
+ 182,
570
+ 180
571
+ ],
572
+ accounts: [
573
+ {
574
+ name: "glam_state",
575
+ writable: true
576
+ },
577
+ {
578
+ name: "glam_signer",
579
+ writable: true,
580
+ signer: true
581
+ }
582
+ ],
583
+ args: [
584
+ {
585
+ name: "integration_program",
586
+ type: "pubkey"
587
+ },
588
+ {
589
+ name: "protocol_bitflag",
590
+ type: "u16"
591
+ },
592
+ {
593
+ name: "data",
594
+ type: "bytes"
595
+ }
596
+ ]
597
+ },
598
+ {
599
+ name: "set_system_transfer_policy",
600
+ discriminator: [
601
+ 102,
602
+ 21,
603
+ 157,
604
+ 101,
605
+ 19,
606
+ 4,
607
+ 100,
608
+ 213
609
+ ],
610
+ accounts: [
611
+ {
612
+ name: "glam_state",
613
+ writable: true
614
+ },
615
+ {
616
+ name: "glam_signer",
617
+ writable: true,
618
+ signer: true
619
+ }
620
+ ],
621
+ args: [
622
+ {
623
+ name: "policy",
624
+ type: {
625
+ defined: {
626
+ name: "TransferPolicy"
627
+ }
628
+ }
1513
629
  }
1514
630
  ]
1515
631
  },
@@ -1839,19 +955,6 @@ var accounts$h = [
1839
955
  249,
1840
956
  103
1841
957
  ]
1842
- },
1843
- {
1844
- name: "TransferTracker",
1845
- discriminator: [
1846
- 153,
1847
- 136,
1848
- 2,
1849
- 106,
1850
- 24,
1851
- 146,
1852
- 147,
1853
- 60
1854
- ]
1855
958
  }
1856
959
  ];
1857
960
  var errors$4 = [
@@ -2450,12 +1553,6 @@ var types$h = [
2450
1553
  },
2451
1554
  {
2452
1555
  name: "OracleConfigs"
2453
- },
2454
- {
2455
- name: "ReduceOnly"
2456
- },
2457
- {
2458
- name: "AnyLst"
2459
1556
  }
2460
1557
  ]
2461
1558
  }
@@ -3347,18 +2444,6 @@ var types$h = [
3347
2444
  }
3348
2445
  }
3349
2446
  },
3350
- {
3351
- name: "reduce_only",
3352
- type: {
3353
- option: "bool"
3354
- }
3355
- },
3356
- {
3357
- name: "any_lst",
3358
- type: {
3359
- option: "bool"
3360
- }
3361
- },
3362
2447
  {
3363
2448
  name: "timelock_duration",
3364
2449
  type: {
@@ -3388,16 +2473,6 @@ var types$h = [
3388
2473
  }
3389
2474
  }
3390
2475
  }
3391
- },
3392
- {
3393
- name: "fee_structure",
3394
- type: {
3395
- option: {
3396
- defined: {
3397
- name: "FeeStructure"
3398
- }
3399
- }
3400
- }
3401
2476
  }
3402
2477
  ]
3403
2478
  }
@@ -3458,38 +2533,6 @@ var types$h = [
3458
2533
  ]
3459
2534
  }
3460
2535
  },
3461
- {
3462
- name: "TransferTracker",
3463
- type: {
3464
- kind: "struct",
3465
- fields: [
3466
- {
3467
- name: "vault",
3468
- type: "pubkey"
3469
- },
3470
- {
3471
- name: "signer",
3472
- type: "pubkey"
3473
- },
3474
- {
3475
- name: "mint",
3476
- type: "pubkey"
3477
- },
3478
- {
3479
- name: "period_start",
3480
- type: "i64"
3481
- },
3482
- {
3483
- name: "amount_transferred",
3484
- type: "u64"
3485
- },
3486
- {
3487
- name: "bump",
3488
- type: "u8"
3489
- }
3490
- ]
3491
- }
3492
- },
3493
2536
  {
3494
2537
  name: "ValuationModel",
3495
2538
  type: {
@@ -7249,229 +6292,6 @@ var instructions$f = [
7249
6292
  ],
7250
6293
  args: []
7251
6294
  },
7252
- {
7253
- name: "price_stake_accounts",
7254
- discriminator: [
7255
- 119,
7256
- 137,
7257
- 9,
7258
- 15,
7259
- 196,
7260
- 73,
7261
- 30,
7262
- 27
7263
- ],
7264
- accounts: [
7265
- {
7266
- name: "glam_state",
7267
- writable: true
7268
- },
7269
- {
7270
- name: "glam_vault",
7271
- pda: {
7272
- seeds: [
7273
- {
7274
- kind: "const",
7275
- value: [
7276
- 118,
7277
- 97,
7278
- 117,
7279
- 108,
7280
- 116
7281
- ]
7282
- },
7283
- {
7284
- kind: "account",
7285
- path: "glam_state"
7286
- }
7287
- ],
7288
- program: {
7289
- kind: "const",
7290
- value: [
7291
- 227,
7292
- 199,
7293
- 235,
7294
- 230,
7295
- 176,
7296
- 132,
7297
- 243,
7298
- 117,
7299
- 43,
7300
- 131,
7301
- 173,
7302
- 18,
7303
- 78,
7304
- 255,
7305
- 26,
7306
- 50,
7307
- 209,
7308
- 135,
7309
- 86,
7310
- 219,
7311
- 140,
7312
- 126,
7313
- 61,
7314
- 255,
7315
- 0,
7316
- 218,
7317
- 252,
7318
- 224,
7319
- 172,
7320
- 8,
7321
- 223,
7322
- 207
7323
- ]
7324
- }
7325
- }
7326
- },
7327
- {
7328
- name: "signer",
7329
- writable: true,
7330
- signer: true
7331
- },
7332
- {
7333
- name: "sol_usd_oracle"
7334
- },
7335
- {
7336
- name: "base_asset_oracle"
7337
- },
7338
- {
7339
- name: "integration_authority",
7340
- pda: {
7341
- seeds: [
7342
- {
7343
- kind: "const",
7344
- value: [
7345
- 105,
7346
- 110,
7347
- 116,
7348
- 101,
7349
- 103,
7350
- 114,
7351
- 97,
7352
- 116,
7353
- 105,
7354
- 111,
7355
- 110,
7356
- 45,
7357
- 97,
7358
- 117,
7359
- 116,
7360
- 104,
7361
- 111,
7362
- 114,
7363
- 105,
7364
- 116,
7365
- 121
7366
- ]
7367
- }
7368
- ]
7369
- }
7370
- },
7371
- {
7372
- name: "glam_config",
7373
- pda: {
7374
- seeds: [
7375
- {
7376
- kind: "const",
7377
- value: [
7378
- 103,
7379
- 108,
7380
- 111,
7381
- 98,
7382
- 97,
7383
- 108,
7384
- 45,
7385
- 99,
7386
- 111,
7387
- 110,
7388
- 102,
7389
- 105,
7390
- 103
7391
- ]
7392
- }
7393
- ],
7394
- program: {
7395
- kind: "const",
7396
- value: [
7397
- 10,
7398
- 11,
7399
- 0,
7400
- 83,
7401
- 72,
7402
- 16,
7403
- 46,
7404
- 144,
7405
- 46,
7406
- 42,
7407
- 79,
7408
- 22,
7409
- 157,
7410
- 123,
7411
- 21,
7412
- 242,
7413
- 192,
7414
- 146,
7415
- 1,
7416
- 78,
7417
- 88,
7418
- 59,
7419
- 102,
7420
- 9,
7421
- 190,
7422
- 226,
7423
- 92,
7424
- 189,
7425
- 187,
7426
- 232,
7427
- 83,
7428
- 220
7429
- ]
7430
- }
7431
- }
7432
- },
7433
- {
7434
- name: "glam_protocol",
7435
- address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
7436
- },
7437
- {
7438
- name: "event_authority",
7439
- optional: true,
7440
- pda: {
7441
- seeds: [
7442
- {
7443
- kind: "const",
7444
- value: [
7445
- 95,
7446
- 95,
7447
- 101,
7448
- 118,
7449
- 101,
7450
- 110,
7451
- 116,
7452
- 95,
7453
- 97,
7454
- 117,
7455
- 116,
7456
- 104,
7457
- 111,
7458
- 114,
7459
- 105,
7460
- 116,
7461
- 121
7462
- ]
7463
- }
7464
- ]
7465
- }
7466
- },
7467
- {
7468
- name: "event_program",
7469
- optional: true,
7470
- address: "GM1NtvvnSXUptTrMCqbogAdZJydZSNv98DoU5AZVLmGh"
7471
- }
7472
- ],
7473
- args: []
7474
- },
7475
6295
  {
7476
6296
  name: "price_vault_tokens",
7477
6297
  docs: [
@@ -9272,12 +8092,6 @@ var types$f = [
9272
8092
  },
9273
8093
  {
9274
8094
  name: "OracleConfigs"
9275
- },
9276
- {
9277
- name: "ReduceOnly"
9278
- },
9279
- {
9280
- name: "AnyLst"
9281
8095
  }
9282
8096
  ]
9283
8097
  }
@@ -10843,12 +9657,6 @@ var types$e = [
10843
9657
  },
10844
9658
  {
10845
9659
  name: "OracleConfigs"
10846
- },
10847
- {
10848
- name: "ReduceOnly"
10849
- },
10850
- {
10851
- name: "AnyLst"
10852
9660
  }
10853
9661
  ]
10854
9662
  }
@@ -14464,12 +13272,6 @@ var types$d = [
14464
13272
  },
14465
13273
  {
14466
13274
  name: "OracleConfigs"
14467
- },
14468
- {
14469
- name: "ReduceOnly"
14470
- },
14471
- {
14472
- name: "AnyLst"
14473
13275
  }
14474
13276
  ]
14475
13277
  }
@@ -15910,23 +14712,263 @@ var instructions$c = [
15910
14712
  writable: true
15911
14713
  },
15912
14714
  {
15913
- name: "rent",
15914
- address: "SysvarRent111111111111111111111111111111111"
14715
+ name: "rent",
14716
+ address: "SysvarRent111111111111111111111111111111111"
14717
+ }
14718
+ ],
14719
+ args: []
14720
+ },
14721
+ {
14722
+ name: "farms_stake",
14723
+ discriminator: [
14724
+ 224,
14725
+ 105,
14726
+ 208,
14727
+ 179,
14728
+ 98,
14729
+ 200,
14730
+ 213,
14731
+ 238
14732
+ ],
14733
+ accounts: [
14734
+ {
14735
+ name: "glam_state",
14736
+ writable: true
14737
+ },
14738
+ {
14739
+ name: "glam_vault",
14740
+ writable: true,
14741
+ pda: {
14742
+ seeds: [
14743
+ {
14744
+ kind: "const",
14745
+ value: [
14746
+ 118,
14747
+ 97,
14748
+ 117,
14749
+ 108,
14750
+ 116
14751
+ ]
14752
+ },
14753
+ {
14754
+ kind: "account",
14755
+ path: "glam_state"
14756
+ }
14757
+ ],
14758
+ program: {
14759
+ kind: "account",
14760
+ path: "glam_protocol_program"
14761
+ }
14762
+ }
14763
+ },
14764
+ {
14765
+ name: "glam_signer",
14766
+ writable: true,
14767
+ signer: true
14768
+ },
14769
+ {
14770
+ name: "integration_authority",
14771
+ pda: {
14772
+ seeds: [
14773
+ {
14774
+ kind: "const",
14775
+ value: [
14776
+ 105,
14777
+ 110,
14778
+ 116,
14779
+ 101,
14780
+ 103,
14781
+ 114,
14782
+ 97,
14783
+ 116,
14784
+ 105,
14785
+ 111,
14786
+ 110,
14787
+ 45,
14788
+ 97,
14789
+ 117,
14790
+ 116,
14791
+ 104,
14792
+ 111,
14793
+ 114,
14794
+ 105,
14795
+ 116,
14796
+ 121
14797
+ ]
14798
+ }
14799
+ ]
14800
+ }
14801
+ },
14802
+ {
14803
+ name: "cpi_program",
14804
+ address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"
14805
+ },
14806
+ {
14807
+ name: "glam_protocol_program",
14808
+ address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
14809
+ },
14810
+ {
14811
+ name: "system_program",
14812
+ address: "11111111111111111111111111111111"
14813
+ },
14814
+ {
14815
+ name: "user_state",
14816
+ writable: true
14817
+ },
14818
+ {
14819
+ name: "farm_state",
14820
+ writable: true
14821
+ },
14822
+ {
14823
+ name: "farm_vault",
14824
+ writable: true
14825
+ },
14826
+ {
14827
+ name: "user_ata",
14828
+ writable: true
14829
+ },
14830
+ {
14831
+ name: "token_mint"
14832
+ },
14833
+ {
14834
+ name: "scope_prices",
14835
+ optional: true
14836
+ },
14837
+ {
14838
+ name: "token_program"
14839
+ }
14840
+ ],
14841
+ args: [
14842
+ {
14843
+ name: "amount",
14844
+ type: "u64"
14845
+ }
14846
+ ]
14847
+ },
14848
+ {
14849
+ name: "farms_unstake",
14850
+ discriminator: [
14851
+ 180,
14852
+ 131,
14853
+ 50,
14854
+ 144,
14855
+ 26,
14856
+ 242,
14857
+ 175,
14858
+ 242
14859
+ ],
14860
+ accounts: [
14861
+ {
14862
+ name: "glam_state",
14863
+ writable: true
14864
+ },
14865
+ {
14866
+ name: "glam_vault",
14867
+ writable: true,
14868
+ pda: {
14869
+ seeds: [
14870
+ {
14871
+ kind: "const",
14872
+ value: [
14873
+ 118,
14874
+ 97,
14875
+ 117,
14876
+ 108,
14877
+ 116
14878
+ ]
14879
+ },
14880
+ {
14881
+ kind: "account",
14882
+ path: "glam_state"
14883
+ }
14884
+ ],
14885
+ program: {
14886
+ kind: "account",
14887
+ path: "glam_protocol_program"
14888
+ }
14889
+ }
14890
+ },
14891
+ {
14892
+ name: "glam_signer",
14893
+ writable: true,
14894
+ signer: true
14895
+ },
14896
+ {
14897
+ name: "integration_authority",
14898
+ pda: {
14899
+ seeds: [
14900
+ {
14901
+ kind: "const",
14902
+ value: [
14903
+ 105,
14904
+ 110,
14905
+ 116,
14906
+ 101,
14907
+ 103,
14908
+ 114,
14909
+ 97,
14910
+ 116,
14911
+ 105,
14912
+ 111,
14913
+ 110,
14914
+ 45,
14915
+ 97,
14916
+ 117,
14917
+ 116,
14918
+ 104,
14919
+ 111,
14920
+ 114,
14921
+ 105,
14922
+ 116,
14923
+ 121
14924
+ ]
14925
+ }
14926
+ ]
14927
+ }
14928
+ },
14929
+ {
14930
+ name: "cpi_program",
14931
+ address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"
14932
+ },
14933
+ {
14934
+ name: "glam_protocol_program",
14935
+ address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
14936
+ },
14937
+ {
14938
+ name: "system_program",
14939
+ address: "11111111111111111111111111111111"
14940
+ },
14941
+ {
14942
+ name: "user_state",
14943
+ writable: true
14944
+ },
14945
+ {
14946
+ name: "farm_state",
14947
+ writable: true
14948
+ },
14949
+ {
14950
+ name: "scope_prices",
14951
+ optional: true
15915
14952
  }
15916
14953
  ],
15917
- args: []
14954
+ args: [
14955
+ {
14956
+ name: "amount",
14957
+ type: "u128"
14958
+ }
14959
+ ]
15918
14960
  },
15919
14961
  {
15920
- name: "farms_stake",
14962
+ name: "farms_withdraw_unstaked_deposits",
15921
14963
  discriminator: [
15922
- 224,
15923
- 105,
15924
- 208,
15925
- 179,
15926
- 98,
15927
- 200,
15928
- 213,
15929
- 238
14964
+ 107,
14965
+ 97,
14966
+ 50,
14967
+ 15,
14968
+ 211,
14969
+ 245,
14970
+ 52,
14971
+ 96
15930
14972
  ],
15931
14973
  accounts: [
15932
14974
  {
@@ -16017,43 +15059,34 @@ var instructions$c = [
16017
15059
  name: "farm_state",
16018
15060
  writable: true
16019
15061
  },
16020
- {
16021
- name: "farm_vault",
16022
- writable: true
16023
- },
16024
15062
  {
16025
15063
  name: "user_ata",
16026
15064
  writable: true
16027
15065
  },
16028
15066
  {
16029
- name: "token_mint"
15067
+ name: "farm_vault",
15068
+ writable: true
16030
15069
  },
16031
15070
  {
16032
- name: "scope_prices",
16033
- optional: true
15071
+ name: "farm_vaults_authority"
16034
15072
  },
16035
15073
  {
16036
15074
  name: "token_program"
16037
15075
  }
16038
15076
  ],
16039
- args: [
16040
- {
16041
- name: "amount",
16042
- type: "u64"
16043
- }
16044
- ]
15077
+ args: []
16045
15078
  },
16046
15079
  {
16047
- name: "farms_unstake",
15080
+ name: "lending_borrow_obligation_liquidity_v2",
16048
15081
  discriminator: [
16049
- 180,
16050
- 131,
16051
- 50,
16052
- 144,
16053
- 26,
16054
- 242,
16055
- 175,
16056
- 242
15082
+ 149,
15083
+ 226,
15084
+ 84,
15085
+ 157,
15086
+ 124,
15087
+ 178,
15088
+ 35,
15089
+ 122
16057
15090
  ],
16058
15091
  accounts: [
16059
15092
  {
@@ -16126,7 +15159,7 @@ var instructions$c = [
16126
15159
  },
16127
15160
  {
16128
15161
  name: "cpi_program",
16129
- address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"
15162
+ address: "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
16130
15163
  },
16131
15164
  {
16132
15165
  name: "glam_protocol_program",
@@ -16137,36 +15170,77 @@ var instructions$c = [
16137
15170
  address: "11111111111111111111111111111111"
16138
15171
  },
16139
15172
  {
16140
- name: "user_state",
15173
+ name: "obligation",
16141
15174
  writable: true
16142
15175
  },
16143
15176
  {
16144
- name: "farm_state",
15177
+ name: "lending_market"
15178
+ },
15179
+ {
15180
+ name: "lending_market_authority"
15181
+ },
15182
+ {
15183
+ name: "borrow_reserve",
16145
15184
  writable: true
16146
15185
  },
16147
15186
  {
16148
- name: "scope_prices",
15187
+ name: "borrow_reserve_liquidity_mint"
15188
+ },
15189
+ {
15190
+ name: "reserve_source_liquidity",
15191
+ writable: true
15192
+ },
15193
+ {
15194
+ name: "borrow_reserve_liquidity_fee_receiver",
15195
+ writable: true
15196
+ },
15197
+ {
15198
+ name: "user_destination_liquidity",
15199
+ writable: true
15200
+ },
15201
+ {
15202
+ name: "referrer_token_state",
15203
+ writable: true,
15204
+ optional: true
15205
+ },
15206
+ {
15207
+ name: "token_program"
15208
+ },
15209
+ {
15210
+ name: "instruction_sysvar_account"
15211
+ },
15212
+ {
15213
+ name: "obligation_farm_user_state",
15214
+ writable: true,
16149
15215
  optional: true
15216
+ },
15217
+ {
15218
+ name: "reserve_farm_state",
15219
+ writable: true,
15220
+ optional: true
15221
+ },
15222
+ {
15223
+ name: "farms_program"
16150
15224
  }
16151
15225
  ],
16152
15226
  args: [
16153
15227
  {
16154
- name: "amount",
16155
- type: "u128"
15228
+ name: "liquidity_amount",
15229
+ type: "u64"
16156
15230
  }
16157
15231
  ]
16158
15232
  },
16159
15233
  {
16160
- name: "farms_withdraw_unstaked_deposits",
15234
+ name: "lending_deposit_reserve_liquidity_and_obligation_collateral_v2",
16161
15235
  discriminator: [
16162
- 107,
16163
- 97,
15236
+ 33,
15237
+ 146,
16164
15238
  50,
16165
- 15,
16166
- 211,
16167
- 245,
16168
- 52,
16169
- 96
15239
+ 121,
15240
+ 127,
15241
+ 94,
15242
+ 92,
15243
+ 192
16170
15244
  ],
16171
15245
  accounts: [
16172
15246
  {
@@ -16239,7 +15313,7 @@ var instructions$c = [
16239
15313
  },
16240
15314
  {
16241
15315
  name: "cpi_program",
16242
- address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"
15316
+ address: "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
16243
15317
  },
16244
15318
  {
16245
15319
  name: "glam_protocol_program",
@@ -16250,41 +15324,83 @@ var instructions$c = [
16250
15324
  address: "11111111111111111111111111111111"
16251
15325
  },
16252
15326
  {
16253
- name: "user_state",
15327
+ name: "obligation",
16254
15328
  writable: true
16255
15329
  },
16256
15330
  {
16257
- name: "farm_state",
15331
+ name: "lending_market"
15332
+ },
15333
+ {
15334
+ name: "lending_market_authority"
15335
+ },
15336
+ {
15337
+ name: "reserve",
16258
15338
  writable: true
16259
15339
  },
16260
15340
  {
16261
- name: "user_ata",
15341
+ name: "reserve_liquidity_mint"
15342
+ },
15343
+ {
15344
+ name: "reserve_liquidity_supply",
16262
15345
  writable: true
16263
15346
  },
16264
15347
  {
16265
- name: "farm_vault",
15348
+ name: "reserve_collateral_mint",
16266
15349
  writable: true
16267
15350
  },
16268
15351
  {
16269
- name: "farm_vaults_authority"
15352
+ name: "reserve_destination_deposit_collateral",
15353
+ writable: true
16270
15354
  },
16271
15355
  {
16272
- name: "token_program"
15356
+ name: "user_source_liquidity",
15357
+ writable: true
15358
+ },
15359
+ {
15360
+ name: "placeholder_user_destination_collateral",
15361
+ optional: true
15362
+ },
15363
+ {
15364
+ name: "collateral_token_program"
15365
+ },
15366
+ {
15367
+ name: "liquidity_token_program"
15368
+ },
15369
+ {
15370
+ name: "instruction_sysvar_account"
15371
+ },
15372
+ {
15373
+ name: "obligation_farm_user_state",
15374
+ writable: true,
15375
+ optional: true
15376
+ },
15377
+ {
15378
+ name: "reserve_farm_state",
15379
+ writable: true,
15380
+ optional: true
15381
+ },
15382
+ {
15383
+ name: "farms_program"
16273
15384
  }
16274
15385
  ],
16275
- args: []
15386
+ args: [
15387
+ {
15388
+ name: "liquidity_amount",
15389
+ type: "u64"
15390
+ }
15391
+ ]
16276
15392
  },
16277
15393
  {
16278
- name: "lending_borrow_obligation_liquidity_v2",
15394
+ name: "lending_init_obligation",
16279
15395
  discriminator: [
16280
- 149,
16281
- 226,
16282
- 84,
16283
- 157,
16284
- 124,
16285
- 178,
16286
- 35,
16287
- 122
15396
+ 188,
15397
+ 161,
15398
+ 62,
15399
+ 142,
15400
+ 106,
15401
+ 232,
15402
+ 77,
15403
+ 135
16288
15404
  ],
16289
15405
  accounts: [
16290
15406
  {
@@ -16364,8 +15480,9 @@ var instructions$c = [
16364
15480
  address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
16365
15481
  },
16366
15482
  {
16367
- name: "system_program",
16368
- address: "11111111111111111111111111111111"
15483
+ name: "fee_payer",
15484
+ writable: true,
15485
+ signer: true
16369
15486
  },
16370
15487
  {
16371
15488
  name: "obligation",
@@ -16375,70 +15492,45 @@ var instructions$c = [
16375
15492
  name: "lending_market"
16376
15493
  },
16377
15494
  {
16378
- name: "lending_market_authority"
16379
- },
16380
- {
16381
- name: "borrow_reserve",
16382
- writable: true
16383
- },
16384
- {
16385
- name: "borrow_reserve_liquidity_mint"
16386
- },
16387
- {
16388
- name: "reserve_source_liquidity",
16389
- writable: true
16390
- },
16391
- {
16392
- name: "borrow_reserve_liquidity_fee_receiver",
16393
- writable: true
16394
- },
16395
- {
16396
- name: "user_destination_liquidity",
16397
- writable: true
16398
- },
16399
- {
16400
- name: "referrer_token_state",
16401
- writable: true,
16402
- optional: true
16403
- },
16404
- {
16405
- name: "token_program"
15495
+ name: "seed1_account"
16406
15496
  },
16407
15497
  {
16408
- name: "instruction_sysvar_account"
15498
+ name: "seed2_account"
16409
15499
  },
16410
15500
  {
16411
- name: "obligation_farm_user_state",
16412
- writable: true,
16413
- optional: true
15501
+ name: "owner_user_metadata"
16414
15502
  },
16415
15503
  {
16416
- name: "reserve_farm_state",
16417
- writable: true,
16418
- optional: true
15504
+ name: "rent",
15505
+ address: "SysvarRent111111111111111111111111111111111"
16419
15506
  },
16420
15507
  {
16421
- name: "farms_program"
15508
+ name: "system_program",
15509
+ address: "11111111111111111111111111111111"
16422
15510
  }
16423
15511
  ],
16424
15512
  args: [
16425
15513
  {
16426
- name: "liquidity_amount",
16427
- type: "u64"
15514
+ name: "args",
15515
+ type: {
15516
+ defined: {
15517
+ name: "InitObligationArgs"
15518
+ }
15519
+ }
16428
15520
  }
16429
15521
  ]
16430
15522
  },
16431
15523
  {
16432
- name: "lending_deposit_reserve_liquidity_and_obligation_collateral_v2",
15524
+ name: "lending_init_obligation_farms_for_reserve",
16433
15525
  discriminator: [
16434
- 33,
16435
- 146,
16436
- 50,
16437
- 121,
16438
- 127,
16439
- 94,
16440
- 92,
16441
- 192
15526
+ 3,
15527
+ 234,
15528
+ 110,
15529
+ 39,
15530
+ 12,
15531
+ 147,
15532
+ 175,
15533
+ 185
16442
15534
  ],
16443
15535
  accounts: [
16444
15536
  {
@@ -16518,16 +15610,14 @@ var instructions$c = [
16518
15610
  address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
16519
15611
  },
16520
15612
  {
16521
- name: "system_program",
16522
- address: "11111111111111111111111111111111"
15613
+ name: "payer",
15614
+ writable: true,
15615
+ signer: true
16523
15616
  },
16524
15617
  {
16525
15618
  name: "obligation",
16526
15619
  writable: true
16527
15620
  },
16528
- {
16529
- name: "lending_market"
16530
- },
16531
15621
  {
16532
15622
  name: "lending_market_authority"
16533
15623
  },
@@ -16536,69 +15626,46 @@ var instructions$c = [
16536
15626
  writable: true
16537
15627
  },
16538
15628
  {
16539
- name: "reserve_liquidity_mint"
16540
- },
16541
- {
16542
- name: "reserve_liquidity_supply",
16543
- writable: true
16544
- },
16545
- {
16546
- name: "reserve_collateral_mint",
16547
- writable: true
16548
- },
16549
- {
16550
- name: "reserve_destination_deposit_collateral",
15629
+ name: "reserve_farm_state",
16551
15630
  writable: true
16552
15631
  },
16553
15632
  {
16554
- name: "user_source_liquidity",
15633
+ name: "obligation_farm",
16555
15634
  writable: true
16556
15635
  },
16557
15636
  {
16558
- name: "placeholder_user_destination_collateral",
16559
- optional: true
16560
- },
16561
- {
16562
- name: "collateral_token_program"
16563
- },
16564
- {
16565
- name: "liquidity_token_program"
16566
- },
16567
- {
16568
- name: "instruction_sysvar_account"
15637
+ name: "lending_market"
16569
15638
  },
16570
15639
  {
16571
- name: "obligation_farm_user_state",
16572
- writable: true,
16573
- optional: true
15640
+ name: "farms_program"
16574
15641
  },
16575
15642
  {
16576
- name: "reserve_farm_state",
16577
- writable: true,
16578
- optional: true
15643
+ name: "rent",
15644
+ address: "SysvarRent111111111111111111111111111111111"
16579
15645
  },
16580
15646
  {
16581
- name: "farms_program"
15647
+ name: "system_program",
15648
+ address: "11111111111111111111111111111111"
16582
15649
  }
16583
15650
  ],
16584
15651
  args: [
16585
15652
  {
16586
- name: "liquidity_amount",
16587
- type: "u64"
15653
+ name: "mode",
15654
+ type: "u8"
16588
15655
  }
16589
15656
  ]
16590
15657
  },
16591
15658
  {
16592
- name: "lending_init_obligation",
15659
+ name: "lending_init_user_metadata",
16593
15660
  discriminator: [
16594
- 188,
16595
- 161,
16596
- 62,
16597
- 142,
16598
- 106,
16599
- 232,
16600
- 77,
16601
- 135
15661
+ 68,
15662
+ 236,
15663
+ 138,
15664
+ 146,
15665
+ 124,
15666
+ 228,
15667
+ 247,
15668
+ 241
16602
15669
  ],
16603
15670
  accounts: [
16604
15671
  {
@@ -16683,20 +15750,12 @@ var instructions$c = [
16683
15750
  signer: true
16684
15751
  },
16685
15752
  {
16686
- name: "obligation",
15753
+ name: "user_metadata",
16687
15754
  writable: true
16688
15755
  },
16689
15756
  {
16690
- name: "lending_market"
16691
- },
16692
- {
16693
- name: "seed1_account"
16694
- },
16695
- {
16696
- name: "seed2_account"
16697
- },
16698
- {
16699
- name: "owner_user_metadata"
15757
+ name: "referrer_user_metadata",
15758
+ optional: true
16700
15759
  },
16701
15760
  {
16702
15761
  name: "rent",
@@ -16709,26 +15768,22 @@ var instructions$c = [
16709
15768
  ],
16710
15769
  args: [
16711
15770
  {
16712
- name: "args",
16713
- type: {
16714
- defined: {
16715
- name: "InitObligationArgs"
16716
- }
16717
- }
15771
+ name: "user_lookup_table",
15772
+ type: "pubkey"
16718
15773
  }
16719
15774
  ]
16720
15775
  },
16721
15776
  {
16722
- name: "lending_init_obligation_farms_for_reserve",
15777
+ name: "lending_liquidate_obligation_and_redeem_reserve_collateral_v2",
16723
15778
  discriminator: [
16724
- 3,
16725
- 234,
16726
- 110,
16727
- 39,
16728
- 12,
16729
- 147,
16730
- 175,
16731
- 185
15779
+ 179,
15780
+ 45,
15781
+ 146,
15782
+ 167,
15783
+ 246,
15784
+ 239,
15785
+ 18,
15786
+ 242
16732
15787
  ],
16733
15788
  accounts: [
16734
15789
  {
@@ -16808,166 +15863,113 @@ var instructions$c = [
16808
15863
  address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
16809
15864
  },
16810
15865
  {
16811
- name: "payer",
16812
- writable: true,
16813
- signer: true
15866
+ name: "system_program",
15867
+ address: "11111111111111111111111111111111"
16814
15868
  },
16815
15869
  {
16816
15870
  name: "obligation",
16817
15871
  writable: true
16818
15872
  },
15873
+ {
15874
+ name: "lending_market"
15875
+ },
16819
15876
  {
16820
15877
  name: "lending_market_authority"
16821
15878
  },
16822
15879
  {
16823
- name: "reserve",
15880
+ name: "repay_reserve",
16824
15881
  writable: true
16825
15882
  },
16826
15883
  {
16827
- name: "reserve_farm_state",
15884
+ name: "repay_reserve_liquidity_mint"
15885
+ },
15886
+ {
15887
+ name: "repay_reserve_liquidity_supply",
16828
15888
  writable: true
16829
15889
  },
16830
15890
  {
16831
- name: "obligation_farm",
15891
+ name: "withdraw_reserve",
16832
15892
  writable: true
16833
15893
  },
16834
15894
  {
16835
- name: "lending_market"
15895
+ name: "withdraw_reserve_liquidity_mint"
16836
15896
  },
16837
15897
  {
16838
- name: "farms_program"
15898
+ name: "withdraw_reserve_collateral_mint",
15899
+ writable: true
16839
15900
  },
16840
15901
  {
16841
- name: "rent",
16842
- address: "SysvarRent111111111111111111111111111111111"
15902
+ name: "withdraw_reserve_collateral_supply",
15903
+ writable: true
16843
15904
  },
16844
15905
  {
16845
- name: "system_program",
16846
- address: "11111111111111111111111111111111"
16847
- }
16848
- ],
16849
- args: [
15906
+ name: "withdraw_reserve_liquidity_supply",
15907
+ writable: true
15908
+ },
16850
15909
  {
16851
- name: "mode",
16852
- type: "u8"
16853
- }
16854
- ]
16855
- },
16856
- {
16857
- name: "lending_init_user_metadata",
16858
- discriminator: [
16859
- 68,
16860
- 236,
16861
- 138,
16862
- 146,
16863
- 124,
16864
- 228,
16865
- 247,
16866
- 241
16867
- ],
16868
- accounts: [
15910
+ name: "withdraw_reserve_liquidity_fee_receiver",
15911
+ writable: true
15912
+ },
16869
15913
  {
16870
- name: "glam_state",
15914
+ name: "user_source_liquidity",
16871
15915
  writable: true
16872
15916
  },
16873
15917
  {
16874
- name: "glam_vault",
16875
- writable: true,
16876
- pda: {
16877
- seeds: [
16878
- {
16879
- kind: "const",
16880
- value: [
16881
- 118,
16882
- 97,
16883
- 117,
16884
- 108,
16885
- 116
16886
- ]
16887
- },
16888
- {
16889
- kind: "account",
16890
- path: "glam_state"
16891
- }
16892
- ],
16893
- program: {
16894
- kind: "account",
16895
- path: "glam_protocol_program"
16896
- }
16897
- }
15918
+ name: "user_destination_collateral",
15919
+ writable: true
16898
15920
  },
16899
15921
  {
16900
- name: "glam_signer",
16901
- writable: true,
16902
- signer: true
15922
+ name: "user_destination_liquidity",
15923
+ writable: true
16903
15924
  },
16904
15925
  {
16905
- name: "integration_authority",
16906
- pda: {
16907
- seeds: [
16908
- {
16909
- kind: "const",
16910
- value: [
16911
- 105,
16912
- 110,
16913
- 116,
16914
- 101,
16915
- 103,
16916
- 114,
16917
- 97,
16918
- 116,
16919
- 105,
16920
- 111,
16921
- 110,
16922
- 45,
16923
- 97,
16924
- 117,
16925
- 116,
16926
- 104,
16927
- 111,
16928
- 114,
16929
- 105,
16930
- 116,
16931
- 121
16932
- ]
16933
- }
16934
- ]
16935
- }
15926
+ name: "collateral_token_program"
16936
15927
  },
16937
15928
  {
16938
- name: "cpi_program",
16939
- address: "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
15929
+ name: "repay_liquidity_token_program"
16940
15930
  },
16941
15931
  {
16942
- name: "glam_protocol_program",
16943
- address: "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
15932
+ name: "withdraw_liquidity_token_program"
16944
15933
  },
16945
15934
  {
16946
- name: "fee_payer",
15935
+ name: "instruction_sysvar_account"
15936
+ },
15937
+ {
15938
+ name: "collateral_obligation_farm_user_state",
16947
15939
  writable: true,
16948
- signer: true
15940
+ optional: true
16949
15941
  },
16950
15942
  {
16951
- name: "user_metadata",
16952
- writable: true
15943
+ name: "collateral_reserve_farm_state",
15944
+ writable: true,
15945
+ optional: true
16953
15946
  },
16954
15947
  {
16955
- name: "referrer_user_metadata",
15948
+ name: "debt_obligation_farm_user_state",
15949
+ writable: true,
16956
15950
  optional: true
16957
15951
  },
16958
15952
  {
16959
- name: "rent",
16960
- address: "SysvarRent111111111111111111111111111111111"
15953
+ name: "debt_reserve_farm_state",
15954
+ writable: true,
15955
+ optional: true
16961
15956
  },
16962
15957
  {
16963
- name: "system_program",
16964
- address: "11111111111111111111111111111111"
15958
+ name: "farms_program"
16965
15959
  }
16966
15960
  ],
16967
15961
  args: [
16968
15962
  {
16969
- name: "user_lookup_table",
16970
- type: "pubkey"
15963
+ name: "liquidity_amount",
15964
+ type: "u64"
15965
+ },
15966
+ {
15967
+ name: "min_acceptable_received_liquidity_amount",
15968
+ type: "u64"
15969
+ },
15970
+ {
15971
+ name: "max_allowed_ltv_override_percent",
15972
+ type: "u64"
16971
15973
  }
16972
15974
  ]
16973
15975
  },
@@ -17885,12 +16887,6 @@ var types$c = [
17885
16887
  },
17886
16888
  {
17887
16889
  name: "OracleConfigs"
17888
- },
17889
- {
17890
- name: "ReduceOnly"
17891
- },
17892
- {
17893
- name: "AnyLst"
17894
16890
  }
17895
16891
  ]
17896
16892
  }
@@ -18755,6 +17751,11 @@ var constants$c = [
18755
17751
  type: "u64",
18756
17752
  value: "1"
18757
17753
  },
17754
+ {
17755
+ name: "PROTO_KAMINO_LENDING_PERM_LIQUIDATE",
17756
+ type: "u64",
17757
+ value: "32"
17758
+ },
18758
17759
  {
18759
17760
  name: "PROTO_KAMINO_LENDING_PERM_REPAY",
18760
17761
  type: "u64",
@@ -19585,12 +18586,6 @@ var types$b = [
19585
18586
  },
19586
18587
  {
19587
18588
  name: "OracleConfigs"
19588
- },
19589
- {
19590
- name: "ReduceOnly"
19591
- },
19592
- {
19593
- name: "AnyLst"
19594
18589
  }
19595
18590
  ]
19596
18591
  }
@@ -21184,12 +20179,6 @@ var types$a = [
21184
20179
  },
21185
20180
  {
21186
20181
  name: "OracleConfigs"
21187
- },
21188
- {
21189
- name: "ReduceOnly"
21190
- },
21191
- {
21192
- name: "AnyLst"
21193
20182
  }
21194
20183
  ]
21195
20184
  }
@@ -22494,12 +21483,6 @@ var types$9 = [
22494
21483
  },
22495
21484
  {
22496
21485
  name: "OracleConfigs"
22497
- },
22498
- {
22499
- name: "ReduceOnly"
22500
- },
22501
- {
22502
- name: "AnyLst"
22503
21486
  }
22504
21487
  ]
22505
21488
  }
@@ -23575,12 +22558,6 @@ var types$8 = [
23575
22558
  },
23576
22559
  {
23577
22560
  name: "OracleConfigs"
23578
- },
23579
- {
23580
- name: "ReduceOnly"
23581
- },
23582
- {
23583
- name: "AnyLst"
23584
22561
  }
23585
22562
  ]
23586
22563
  }
@@ -24408,249 +23385,6 @@ var instructions$7 = [
24408
23385
  ],
24409
23386
  args: []
24410
23387
  },
24411
- {
24412
- name: "charge_protocol_fee",
24413
- docs: [
24414
- "Charges protocol base fee on non-tokenized vaults"
24415
- ],
24416
- discriminator: [
24417
- 48,
24418
- 225,
24419
- 89,
24420
- 103,
24421
- 48,
24422
- 65,
24423
- 183,
24424
- 238
24425
- ],
24426
- accounts: [
24427
- {
24428
- name: "glam_state",
24429
- writable: true
24430
- },
24431
- {
24432
- name: "glam_vault",
24433
- writable: true,
24434
- pda: {
24435
- seeds: [
24436
- {
24437
- kind: "const",
24438
- value: [
24439
- 118,
24440
- 97,
24441
- 117,
24442
- 108,
24443
- 116
24444
- ]
24445
- },
24446
- {
24447
- kind: "account",
24448
- path: "glam_state"
24449
- }
24450
- ]
24451
- }
24452
- },
24453
- {
24454
- name: "signer",
24455
- writable: true,
24456
- signer: true
24457
- },
24458
- {
24459
- name: "deposit_asset"
24460
- },
24461
- {
24462
- name: "vault_deposit_ata",
24463
- writable: true,
24464
- pda: {
24465
- seeds: [
24466
- {
24467
- kind: "account",
24468
- path: "glam_vault"
24469
- },
24470
- {
24471
- kind: "account",
24472
- path: "deposit_token_program"
24473
- },
24474
- {
24475
- kind: "account",
24476
- path: "deposit_asset"
24477
- }
24478
- ],
24479
- program: {
24480
- kind: "const",
24481
- value: [
24482
- 140,
24483
- 151,
24484
- 37,
24485
- 143,
24486
- 78,
24487
- 36,
24488
- 137,
24489
- 241,
24490
- 187,
24491
- 61,
24492
- 16,
24493
- 41,
24494
- 20,
24495
- 142,
24496
- 13,
24497
- 131,
24498
- 11,
24499
- 90,
24500
- 19,
24501
- 153,
24502
- 218,
24503
- 255,
24504
- 16,
24505
- 132,
24506
- 4,
24507
- 142,
24508
- 123,
24509
- 216,
24510
- 219,
24511
- 233,
24512
- 248,
24513
- 89
24514
- ]
24515
- }
24516
- }
24517
- },
24518
- {
24519
- name: "protocol_fee_authority"
24520
- },
24521
- {
24522
- name: "protocol_fee_authority_ata",
24523
- writable: true,
24524
- pda: {
24525
- seeds: [
24526
- {
24527
- kind: "account",
24528
- path: "protocol_fee_authority"
24529
- },
24530
- {
24531
- kind: "account",
24532
- path: "deposit_token_program"
24533
- },
24534
- {
24535
- kind: "account",
24536
- path: "deposit_asset"
24537
- }
24538
- ],
24539
- program: {
24540
- kind: "const",
24541
- value: [
24542
- 140,
24543
- 151,
24544
- 37,
24545
- 143,
24546
- 78,
24547
- 36,
24548
- 137,
24549
- 241,
24550
- 187,
24551
- 61,
24552
- 16,
24553
- 41,
24554
- 20,
24555
- 142,
24556
- 13,
24557
- 131,
24558
- 11,
24559
- 90,
24560
- 19,
24561
- 153,
24562
- 218,
24563
- 255,
24564
- 16,
24565
- 132,
24566
- 4,
24567
- 142,
24568
- 123,
24569
- 216,
24570
- 219,
24571
- 233,
24572
- 248,
24573
- 89
24574
- ]
24575
- }
24576
- }
24577
- },
24578
- {
24579
- name: "glam_config",
24580
- pda: {
24581
- seeds: [
24582
- {
24583
- kind: "const",
24584
- value: [
24585
- 103,
24586
- 108,
24587
- 111,
24588
- 98,
24589
- 97,
24590
- 108,
24591
- 45,
24592
- 99,
24593
- 111,
24594
- 110,
24595
- 102,
24596
- 105,
24597
- 103
24598
- ]
24599
- }
24600
- ],
24601
- program: {
24602
- kind: "const",
24603
- value: [
24604
- 10,
24605
- 11,
24606
- 0,
24607
- 83,
24608
- 72,
24609
- 16,
24610
- 46,
24611
- 144,
24612
- 46,
24613
- 42,
24614
- 79,
24615
- 22,
24616
- 157,
24617
- 123,
24618
- 21,
24619
- 242,
24620
- 192,
24621
- 146,
24622
- 1,
24623
- 78,
24624
- 88,
24625
- 59,
24626
- 102,
24627
- 9,
24628
- 190,
24629
- 226,
24630
- 92,
24631
- 189,
24632
- 187,
24633
- 232,
24634
- 83,
24635
- 220
24636
- ]
24637
- }
24638
- }
24639
- },
24640
- {
24641
- name: "system_program",
24642
- address: "11111111111111111111111111111111"
24643
- },
24644
- {
24645
- name: "associated_token_program",
24646
- address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
24647
- },
24648
- {
24649
- name: "deposit_token_program"
24650
- }
24651
- ],
24652
- args: []
24653
- },
24654
23388
  {
24655
23389
  name: "check_and_update_transfer_tracker",
24656
23390
  discriminator: [
@@ -26887,12 +25621,6 @@ var types$7 = [
26887
25621
  },
26888
25622
  {
26889
25623
  name: "OracleConfigs"
26890
- },
26891
- {
26892
- name: "ReduceOnly"
26893
- },
26894
- {
26895
- name: "AnyLst"
26896
25624
  }
26897
25625
  ]
26898
25626
  }
@@ -27784,18 +26512,6 @@ var types$7 = [
27784
26512
  }
27785
26513
  }
27786
26514
  },
27787
- {
27788
- name: "reduce_only",
27789
- type: {
27790
- option: "bool"
27791
- }
27792
- },
27793
- {
27794
- name: "any_lst",
27795
- type: {
27796
- option: "bool"
27797
- }
27798
- },
27799
26515
  {
27800
26516
  name: "timelock_duration",
27801
26517
  type: {
@@ -27825,16 +26541,6 @@ var types$7 = [
27825
26541
  }
27826
26542
  }
27827
26543
  }
27828
- },
27829
- {
27830
- name: "fee_structure",
27831
- type: {
27832
- option: {
27833
- defined: {
27834
- name: "FeeStructure"
27835
- }
27836
- }
27837
- }
27838
26544
  }
27839
26545
  ]
27840
26546
  }
@@ -33022,12 +31728,6 @@ var types$6 = [
33022
31728
  },
33023
31729
  {
33024
31730
  name: "OracleConfigs"
33025
- },
33026
- {
33027
- name: "ReduceOnly"
33028
- },
33029
- {
33030
- name: "AnyLst"
33031
31731
  }
33032
31732
  ]
33033
31733
  }
@@ -34593,12 +33293,6 @@ var types$5 = [
34593
33293
  },
34594
33294
  {
34595
33295
  name: "OracleConfigs"
34596
- },
34597
- {
34598
- name: "ReduceOnly"
34599
- },
34600
- {
34601
- name: "AnyLst"
34602
33296
  }
34603
33297
  ]
34604
33298
  }
@@ -38214,12 +36908,6 @@ var types$4 = [
38214
36908
  },
38215
36909
  {
38216
36910
  name: "OracleConfigs"
38217
- },
38218
- {
38219
- name: "ReduceOnly"
38220
- },
38221
- {
38222
- name: "AnyLst"
38223
36911
  }
38224
36912
  ]
38225
36913
  }
@@ -40693,31 +39381,231 @@ var instructions$3 = [
40693
39381
  address: "gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"
40694
39382
  },
40695
39383
  {
40696
- name: "fee_payer",
40697
- writable: true,
40698
- signer: true
39384
+ name: "fee_payer",
39385
+ writable: true,
39386
+ signer: true
39387
+ },
39388
+ {
39389
+ name: "user_metadata",
39390
+ writable: true
39391
+ },
39392
+ {
39393
+ name: "referrer_user_metadata",
39394
+ optional: true
39395
+ },
39396
+ {
39397
+ name: "rent",
39398
+ address: "SysvarRent111111111111111111111111111111111"
39399
+ },
39400
+ {
39401
+ name: "system_program",
39402
+ address: "11111111111111111111111111111111"
39403
+ }
39404
+ ],
39405
+ args: [
39406
+ {
39407
+ name: "user_lookup_table",
39408
+ type: "pubkey"
39409
+ }
39410
+ ]
39411
+ },
39412
+ {
39413
+ name: "lending_liquidate_obligation_and_redeem_reserve_collateral_v2",
39414
+ discriminator: [
39415
+ 179,
39416
+ 45,
39417
+ 146,
39418
+ 167,
39419
+ 246,
39420
+ 239,
39421
+ 18,
39422
+ 242
39423
+ ],
39424
+ accounts: [
39425
+ {
39426
+ name: "glam_state",
39427
+ writable: true
39428
+ },
39429
+ {
39430
+ name: "glam_vault",
39431
+ writable: true,
39432
+ pda: {
39433
+ seeds: [
39434
+ {
39435
+ kind: "const",
39436
+ value: [
39437
+ 118,
39438
+ 97,
39439
+ 117,
39440
+ 108,
39441
+ 116
39442
+ ]
39443
+ },
39444
+ {
39445
+ kind: "account",
39446
+ path: "glam_state"
39447
+ }
39448
+ ],
39449
+ program: {
39450
+ kind: "account",
39451
+ path: "glam_protocol_program"
39452
+ }
39453
+ }
39454
+ },
39455
+ {
39456
+ name: "glam_signer",
39457
+ writable: true,
39458
+ signer: true
39459
+ },
39460
+ {
39461
+ name: "integration_authority",
39462
+ pda: {
39463
+ seeds: [
39464
+ {
39465
+ kind: "const",
39466
+ value: [
39467
+ 105,
39468
+ 110,
39469
+ 116,
39470
+ 101,
39471
+ 103,
39472
+ 114,
39473
+ 97,
39474
+ 116,
39475
+ 105,
39476
+ 111,
39477
+ 110,
39478
+ 45,
39479
+ 97,
39480
+ 117,
39481
+ 116,
39482
+ 104,
39483
+ 111,
39484
+ 114,
39485
+ 105,
39486
+ 116,
39487
+ 121
39488
+ ]
39489
+ }
39490
+ ]
39491
+ }
39492
+ },
39493
+ {
39494
+ name: "cpi_program",
39495
+ address: "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
39496
+ },
39497
+ {
39498
+ name: "glam_protocol_program",
39499
+ address: "gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"
39500
+ },
39501
+ {
39502
+ name: "system_program",
39503
+ address: "11111111111111111111111111111111"
40699
39504
  },
40700
39505
  {
40701
- name: "user_metadata",
39506
+ name: "obligation",
40702
39507
  writable: true
40703
39508
  },
40704
39509
  {
40705
- name: "referrer_user_metadata",
39510
+ name: "lending_market"
39511
+ },
39512
+ {
39513
+ name: "lending_market_authority"
39514
+ },
39515
+ {
39516
+ name: "repay_reserve",
39517
+ writable: true
39518
+ },
39519
+ {
39520
+ name: "repay_reserve_liquidity_mint"
39521
+ },
39522
+ {
39523
+ name: "repay_reserve_liquidity_supply",
39524
+ writable: true
39525
+ },
39526
+ {
39527
+ name: "withdraw_reserve",
39528
+ writable: true
39529
+ },
39530
+ {
39531
+ name: "withdraw_reserve_liquidity_mint"
39532
+ },
39533
+ {
39534
+ name: "withdraw_reserve_collateral_mint",
39535
+ writable: true
39536
+ },
39537
+ {
39538
+ name: "withdraw_reserve_collateral_supply",
39539
+ writable: true
39540
+ },
39541
+ {
39542
+ name: "withdraw_reserve_liquidity_supply",
39543
+ writable: true
39544
+ },
39545
+ {
39546
+ name: "withdraw_reserve_liquidity_fee_receiver",
39547
+ writable: true
39548
+ },
39549
+ {
39550
+ name: "user_source_liquidity",
39551
+ writable: true
39552
+ },
39553
+ {
39554
+ name: "user_destination_collateral",
39555
+ writable: true
39556
+ },
39557
+ {
39558
+ name: "user_destination_liquidity",
39559
+ writable: true
39560
+ },
39561
+ {
39562
+ name: "collateral_token_program"
39563
+ },
39564
+ {
39565
+ name: "repay_liquidity_token_program"
39566
+ },
39567
+ {
39568
+ name: "withdraw_liquidity_token_program"
39569
+ },
39570
+ {
39571
+ name: "instruction_sysvar_account"
39572
+ },
39573
+ {
39574
+ name: "collateral_obligation_farm_user_state",
39575
+ writable: true,
40706
39576
  optional: true
40707
39577
  },
40708
39578
  {
40709
- name: "rent",
40710
- address: "SysvarRent111111111111111111111111111111111"
39579
+ name: "collateral_reserve_farm_state",
39580
+ writable: true,
39581
+ optional: true
40711
39582
  },
40712
39583
  {
40713
- name: "system_program",
40714
- address: "11111111111111111111111111111111"
39584
+ name: "debt_obligation_farm_user_state",
39585
+ writable: true,
39586
+ optional: true
39587
+ },
39588
+ {
39589
+ name: "debt_reserve_farm_state",
39590
+ writable: true,
39591
+ optional: true
39592
+ },
39593
+ {
39594
+ name: "farms_program"
40715
39595
  }
40716
39596
  ],
40717
39597
  args: [
40718
39598
  {
40719
- name: "user_lookup_table",
40720
- type: "pubkey"
39599
+ name: "liquidity_amount",
39600
+ type: "u64"
39601
+ },
39602
+ {
39603
+ name: "min_acceptable_received_liquidity_amount",
39604
+ type: "u64"
39605
+ },
39606
+ {
39607
+ name: "max_allowed_ltv_override_percent",
39608
+ type: "u64"
40721
39609
  }
40722
39610
  ]
40723
39611
  },
@@ -40866,6 +39754,114 @@ var instructions$3 = [
40866
39754
  }
40867
39755
  ]
40868
39756
  },
39757
+ {
39758
+ name: "lending_request_elevation_group",
39759
+ discriminator: [
39760
+ 162,
39761
+ 119,
39762
+ 197,
39763
+ 54,
39764
+ 246,
39765
+ 84,
39766
+ 55,
39767
+ 153
39768
+ ],
39769
+ accounts: [
39770
+ {
39771
+ name: "glam_state",
39772
+ writable: true
39773
+ },
39774
+ {
39775
+ name: "glam_vault",
39776
+ writable: true,
39777
+ pda: {
39778
+ seeds: [
39779
+ {
39780
+ kind: "const",
39781
+ value: [
39782
+ 118,
39783
+ 97,
39784
+ 117,
39785
+ 108,
39786
+ 116
39787
+ ]
39788
+ },
39789
+ {
39790
+ kind: "account",
39791
+ path: "glam_state"
39792
+ }
39793
+ ],
39794
+ program: {
39795
+ kind: "account",
39796
+ path: "glam_protocol_program"
39797
+ }
39798
+ }
39799
+ },
39800
+ {
39801
+ name: "glam_signer",
39802
+ writable: true,
39803
+ signer: true
39804
+ },
39805
+ {
39806
+ name: "integration_authority",
39807
+ pda: {
39808
+ seeds: [
39809
+ {
39810
+ kind: "const",
39811
+ value: [
39812
+ 105,
39813
+ 110,
39814
+ 116,
39815
+ 101,
39816
+ 103,
39817
+ 114,
39818
+ 97,
39819
+ 116,
39820
+ 105,
39821
+ 111,
39822
+ 110,
39823
+ 45,
39824
+ 97,
39825
+ 117,
39826
+ 116,
39827
+ 104,
39828
+ 111,
39829
+ 114,
39830
+ 105,
39831
+ 116,
39832
+ 121
39833
+ ]
39834
+ }
39835
+ ]
39836
+ }
39837
+ },
39838
+ {
39839
+ name: "cpi_program",
39840
+ address: "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
39841
+ },
39842
+ {
39843
+ name: "glam_protocol_program",
39844
+ address: "gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"
39845
+ },
39846
+ {
39847
+ name: "system_program",
39848
+ address: "11111111111111111111111111111111"
39849
+ },
39850
+ {
39851
+ name: "obligation",
39852
+ writable: true
39853
+ },
39854
+ {
39855
+ name: "lending_market"
39856
+ }
39857
+ ],
39858
+ args: [
39859
+ {
39860
+ name: "elevation_group",
39861
+ type: "u8"
39862
+ }
39863
+ ]
39864
+ },
40869
39865
  {
40870
39866
  name: "lending_withdraw_obligation_collateral_and_redeem_reserve_collateral_v2",
40871
39867
  discriminator: [
@@ -41635,12 +40631,6 @@ var types$3 = [
41635
40631
  },
41636
40632
  {
41637
40633
  name: "OracleConfigs"
41638
- },
41639
- {
41640
- name: "ReduceOnly"
41641
- },
41642
- {
41643
- name: "AnyLst"
41644
40634
  }
41645
40635
  ]
41646
40636
  }
@@ -42505,6 +41495,11 @@ var constants$3 = [
42505
41495
  type: "u64",
42506
41496
  value: "1"
42507
41497
  },
41498
+ {
41499
+ name: "PROTO_KAMINO_LENDING_PERM_LIQUIDATE",
41500
+ type: "u64",
41501
+ value: "32"
41502
+ },
42508
41503
  {
42509
41504
  name: "PROTO_KAMINO_LENDING_PERM_REPAY",
42510
41505
  type: "u64",
@@ -43334,12 +42329,6 @@ var types$2 = [
43334
42329
  },
43335
42330
  {
43336
42331
  name: "OracleConfigs"
43337
- },
43338
- {
43339
- name: "ReduceOnly"
43340
- },
43341
- {
43342
- name: "AnyLst"
43343
42332
  }
43344
42333
  ]
43345
42334
  }
@@ -44787,6 +43776,9 @@ var types$1 = [
44787
43776
  },
44788
43777
  {
44789
43778
  name: "Mint"
43779
+ },
43780
+ {
43781
+ name: "SingleAssetVault"
44790
43782
  }
44791
43783
  ]
44792
43784
  }
@@ -44961,12 +43953,6 @@ var types$1 = [
44961
43953
  },
44962
43954
  {
44963
43955
  name: "OracleConfigs"
44964
- },
44965
- {
44966
- name: "ReduceOnly"
44967
- },
44968
- {
44969
- name: "AnyLst"
44970
43956
  }
44971
43957
  ]
44972
43958
  }
@@ -46047,12 +45033,6 @@ var types = [
46047
45033
  },
46048
45034
  {
46049
45035
  name: "OracleConfigs"
46050
- },
46051
- {
46052
- name: "ReduceOnly"
46053
- },
46054
- {
46055
- name: "AnyLst"
46056
45036
  }
46057
45037
  ]
46058
45038
  }
@@ -47111,27 +46091,30 @@ DriftVaultsPolicy._layout = struct([
47111
46091
  vec(publicKey(), "vaultsAllowlist")
47112
46092
  ]);
47113
46093
  class DriftProtocolPolicy {
47114
- static decode(buffer) {
47115
- try {
47116
- const data = DriftProtocolPolicy._layout.decode(buffer);
47117
- return new DriftProtocolPolicy(data.spotMarketsAllowlist, data.perpMarketsAllowlist, data.borrowAllowlist, data.orderPriceToleranceBps ?? 0);
47118
- } catch {
47119
- // Legacy format without orderPriceToleranceBps
47120
- const data = DriftProtocolPolicy._legacyLayout.decode(buffer);
47121
- return new DriftProtocolPolicy(data.spotMarketsAllowlist, data.perpMarketsAllowlist, data.borrowAllowlist, 0);
46094
+ static decode(buffer, staging = false) {
46095
+ if (staging) {
46096
+ try {
46097
+ const data = DriftProtocolPolicy._stagingLayout.decode(buffer);
46098
+ return new DriftProtocolPolicy(data.spotMarketsAllowlist, data.perpMarketsAllowlist, data.borrowAllowlist, data.orderPriceToleranceBps ?? 0);
46099
+ } catch {
46100
+ // Backward compat: old staging data without orderPriceToleranceBps
46101
+ // falls through to the base layout decoding
46102
+ }
47122
46103
  }
46104
+ const data = DriftProtocolPolicy._layout.decode(buffer);
46105
+ return new DriftProtocolPolicy(data.spotMarketsAllowlist, data.perpMarketsAllowlist, data.borrowAllowlist, 0);
47123
46106
  }
47124
- encode() {
47125
- // Calculate buffer size needed
47126
- // 4 bytes for spot markets length + 2 bytes per spot market
47127
- // 4 bytes for perp markets length + 2 bytes per perp market
47128
- // 4 bytes for borrow allowlist length + 32 bytes per pubkey
47129
- // 2 bytes for orderPriceToleranceBps
46107
+ encode(staging = false) {
47130
46108
  const spotMarketsSize = 4 + this.spotMarketsAllowlist.length * 2;
47131
46109
  const perpMarketsSize = 4 + this.perpMarketsAllowlist.length * 2;
47132
46110
  const borrowAllowlistSize = 4 + this.borrowAllowlist.length * 32;
47133
- const totalSize = spotMarketsSize + perpMarketsSize + borrowAllowlistSize + 2;
47134
- const buffer = Buffer.alloc(totalSize);
46111
+ const baseSize = spotMarketsSize + perpMarketsSize + borrowAllowlistSize;
46112
+ if (staging) {
46113
+ const buffer = Buffer.alloc(baseSize + 2); // +2 for orderPriceToleranceBps
46114
+ DriftProtocolPolicy._stagingLayout.encode(this, buffer);
46115
+ return buffer;
46116
+ }
46117
+ const buffer = Buffer.alloc(baseSize);
47135
46118
  DriftProtocolPolicy._layout.encode(this, buffer);
47136
46119
  return buffer;
47137
46120
  }
@@ -47145,13 +46128,13 @@ class DriftProtocolPolicy {
47145
46128
  DriftProtocolPolicy._layout = struct([
47146
46129
  vec(u16(), "spotMarketsAllowlist"),
47147
46130
  vec(u16(), "perpMarketsAllowlist"),
47148
- vec(publicKey(), "borrowAllowlist"),
47149
- u16("orderPriceToleranceBps")
46131
+ vec(publicKey(), "borrowAllowlist")
47150
46132
  ]);
47151
- DriftProtocolPolicy._legacyLayout = struct([
46133
+ DriftProtocolPolicy._stagingLayout = struct([
47152
46134
  vec(u16(), "spotMarketsAllowlist"),
47153
46135
  vec(u16(), "perpMarketsAllowlist"),
47154
- vec(publicKey(), "borrowAllowlist")
46136
+ vec(publicKey(), "borrowAllowlist"),
46137
+ u16("orderPriceToleranceBps")
47155
46138
  ]);
47156
46139
  class KaminoLendingPolicy {
47157
46140
  static decode(buffer) {
@@ -47765,9 +46748,14 @@ function getHeliusApiKey() {
47765
46748
  * Fetches program accounts using Helius getProgramAccountsV2 if available.
47766
46749
  * Otherwise falls back to standard getProgramAccounts with retry logic.
47767
46750
  */ async function getProgramAccounts(connection, programId, config) {
47768
- if (isHeliusRpc(connection.rpcEndpoint)) {
47769
- return await getProgramAccountsV2Helius(connection.rpcEndpoint, programId, config);
47770
- }
46751
+ // 2026-03-02: Helius getProgramAccountsV2 cannot find ALTs, disable it for now
46752
+ // if (isHeliusRpc(connection.rpcEndpoint)) {
46753
+ // return await getProgramAccountsV2Helius(
46754
+ // connection.rpcEndpoint,
46755
+ // programId,
46756
+ // config,
46757
+ // );
46758
+ // }
47771
46759
  return await getProgramAccountsWithRetry(connection, programId, config);
47772
46760
  }
47773
46761
  async function rpcRequest(rpcUrl, method, params) {
@@ -47789,52 +46777,6 @@ async function rpcRequest(rpcUrl, method, params) {
47789
46777
  }
47790
46778
  return data.result;
47791
46779
  }
47792
- function decodeAccountData(accountData, encoding) {
47793
- if (encoding === "base64") {
47794
- return Buffer.from(accountData, "base64");
47795
- } else if (encoding === "base64+zstd") {
47796
- const compressed = Buffer.from(accountData, "base64");
47797
- return Buffer.from(decompress(compressed));
47798
- } else if (encoding === "base58") {
47799
- return bs58.decode(accountData);
47800
- }
47801
- throw new Error(`Unsupported encoding: ${encoding}`);
47802
- }
47803
- async function getProgramAccountsV2Helius(rpcUrl, programId, config) {
47804
- const allAccounts = [];
47805
- let paginationKey = null;
47806
- do {
47807
- const result = await rpcRequest(rpcUrl, "getProgramAccountsV2", [
47808
- programId.toBase58(),
47809
- {
47810
- encoding: config.encoding || "base64",
47811
- filters: config.filters || [],
47812
- ...config.limit && {
47813
- limit: config.limit
47814
- },
47815
- ...config.changedSinceSlot && {
47816
- changedSinceSlot: config.changedSinceSlot
47817
- },
47818
- ...paginationKey && {
47819
- paginationKey
47820
- }
47821
- }
47822
- ]);
47823
- for (const { pubkey, account } of result.accounts){
47824
- const [accountData, encoding] = account.data;
47825
- allAccounts.push({
47826
- pubkey: new PublicKey(pubkey),
47827
- account: {
47828
- ...account,
47829
- owner: new PublicKey(account.owner),
47830
- data: decodeAccountData(accountData, encoding)
47831
- }
47832
- });
47833
- }
47834
- paginationKey = result.paginationKey;
47835
- }while (paginationKey)
47836
- return allAccounts;
47837
- }
47838
46780
  /**
47839
46781
  * Standard getProgramAccounts with retry logic for transient errors.
47840
46782
  */ async function getProgramAccountsWithRetry(connection, programId, config) {
@@ -48909,6 +47851,14 @@ const MAX_ADDRESSES_PER_EXTEND = 20;
48909
47851
  };
48910
47852
  }
48911
47853
 
47854
+ class GlamError extends Error {
47855
+ constructor(message, rawError, programLogs){
47856
+ super(message);
47857
+ this.message = message;
47858
+ this.rawError = rawError;
47859
+ this.programLogs = programLogs;
47860
+ }
47861
+ }
48912
47862
  const JUPITER_SWAP_ERRORS = {
48913
47863
  6001: "Jupiter swap failed: Slippage tolerance exceeded",
48914
47864
  6008: "Jupiter swap failed: Not enough account keys",
@@ -48917,29 +47867,115 @@ const JUPITER_SWAP_ERRORS = {
48917
47867
  6025: "Jupiter swap failed: Invalid token account"
48918
47868
  };
48919
47869
  /**
48920
- * Parses program logs to extract error message
48921
- */ function parseProgramLogs(logs) {
48922
- // "Error Message:" indicates an anchor program error
48923
- // Other messages are manually sourced & handled
48924
- const errorMsgLog = (logs || []).find((log)=>log.includes("Error Message:") || log.includes("Error: insufficient funds") || log.includes("Transfer: insufficient lamports"));
47870
+ * Extract the program ID that failed from transaction logs.
47871
+ * Looks for "Program <ID> failed:" log lines.
47872
+ */ function extractFailedProgramId(logs) {
47873
+ if (!logs) return undefined;
47874
+ for(let i = logs.length - 1; i >= 0; i--){
47875
+ const match = logs[i].match(/^Program (\w+) failed/);
47876
+ if (match) return match[1];
47877
+ }
47878
+ return undefined;
47879
+ }
47880
+ /**
47881
+ * Resolve a custom program error code to a human-readable message.
47882
+ * When programId is provided, matches against the specific program's IDL
47883
+ * to avoid collisions between programs using the same error code range.
47884
+ * Accepts either a decimal number or a hex string (e.g. "0xBB80").
47885
+ */ function resolveErrorCode(code, staging, programId) {
47886
+ const decimal = typeof code === "string" ? (()=>{
47887
+ const normalized = code.trim().toLowerCase();
47888
+ return normalized.startsWith("0x") ? parseInt(normalized, 16) : parseInt(normalized, 10);
47889
+ })() : code;
47890
+ if (isNaN(decimal)) return undefined;
47891
+ const s = resolveStaging(staging);
47892
+ const glamProtocolId = getGlamProtocolProgramId(s).toBase58();
47893
+ const glamMintId = getGlamMintProgramId(s).toBase58();
47894
+ if (programId) {
47895
+ // Match against the specific program that failed
47896
+ if (programId === glamProtocolId) {
47897
+ const err = getGlamProtocolIdl(s).errors.find((e)=>e.code === decimal);
47898
+ return err?.msg;
47899
+ }
47900
+ if (programId === glamMintId) {
47901
+ const err = getGlamMintIdl(s).errors.find((e)=>e.code === decimal);
47902
+ return err?.msg;
47903
+ }
47904
+ // Not a GLAM program — check third-party errors
47905
+ const jupiterMsg = JUPITER_SWAP_ERRORS[decimal];
47906
+ if (jupiterMsg) return jupiterMsg;
47907
+ return undefined;
47908
+ }
47909
+ // Fallback: no programId provided, check all (legacy behavior)
47910
+ const protocolError = getGlamProtocolIdl(s).errors.find((e)=>e.code === decimal);
47911
+ if (protocolError?.msg) return protocolError.msg;
47912
+ const mintError = getGlamMintIdl(s).errors.find((e)=>e.code === decimal);
47913
+ if (mintError?.msg) return mintError.msg;
47914
+ const jupiterMsg = JUPITER_SWAP_ERRORS[decimal];
47915
+ if (jupiterMsg) return jupiterMsg;
47916
+ return undefined;
47917
+ }
47918
+ /**
47919
+ * Parse the error message from a transaction error.
47920
+ * Environment-agnostic: handles Anchor errors, program error codes,
47921
+ * simulation failures, and common RPC/network errors.
47922
+ *
47923
+ * Callers (GUI, CLI) can handle environment-specific error types
47924
+ * (e.g. WalletSignTransactionError) before delegating to this function.
47925
+ */ function parseTxError(error) {
47926
+ const raw = error?.message || error?.toString?.() || "";
47927
+ const msg = raw === "[object Object]" ? "" : raw;
47928
+ // Transaction expired
47929
+ if (msg.includes("block height exceeded")) {
47930
+ return "Transaction expired";
47931
+ }
47932
+ // Transaction too large
47933
+ if (msg.includes("encoding overruns") || msg.includes("exceeded maximum size")) {
47934
+ return "Transaction too large: the transaction exceeds the maximum size limit.";
47935
+ }
47936
+ // RPC rate limiting
47937
+ if (msg.includes("429") || msg.includes("Too Many Requests") || msg.includes("rate limit")) {
47938
+ return "RPC rate limited: please wait a moment and try again";
47939
+ }
47940
+ // RPC unavailable
47941
+ if (msg.includes("503") || msg.includes("Service Unavailable")) {
47942
+ return "RPC service unavailable: try again shortly";
47943
+ }
47944
+ // Connection errors
47945
+ if (msg.includes("ECONNREFUSED") || msg.includes("ENOTFOUND")) {
47946
+ return "Cannot connect to RPC: check your network or endpoint";
47947
+ }
47948
+ // Timeout
47949
+ if (msg.includes("timeout") || msg.includes("ETIMEDOUT") || msg.includes("TimeoutError")) {
47950
+ return "Request timed out: try again";
47951
+ }
47952
+ return msg || "Unknown error";
47953
+ }
47954
+
47955
+ /**
47956
+ * Parses program logs to extract error message.
47957
+ * Checks in order: Anchor "Error Message:", insufficient funds/lamports,
47958
+ * and custom program error codes (resolved via IDL when possible).
47959
+ * Returns "Unknown error" if no recognizable error pattern is found.
47960
+ */ function parseProgramLogs(logs, staging) {
47961
+ if (logs.length === 0) return "Invalid program logs";
47962
+ // Anchor "Error Message:" from program logs
47963
+ const errorMsgLog = logs.find((log)=>log.includes("Error Message:"));
48925
47964
  if (errorMsgLog) {
48926
- if (errorMsgLog.includes("Error Message:")) {
48927
- return errorMsgLog.split("Error Message:")[1].trim();
48928
- }
48929
- return errorMsgLog;
48930
- }
48931
- // Match the following pattern to find Jupiter error code in logs
48932
- // "Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 failed: custom program error: 0x1788"
48933
- const jupiterErrorLog = (logs || []).find((log)=>log.includes("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4") && log.includes("custom program error:"));
48934
- if (jupiterErrorLog) {
48935
- const match = jupiterErrorLog.match(/custom program error: (0x[0-9a-fA-F]+)/);
47965
+ return errorMsgLog.split("Error Message:")[1].trim().replace(/\.$/, "");
47966
+ }
47967
+ // "insufficient funds" / "insufficient lamports" from logs
47968
+ const fundsLog = logs.find((log)=>log.includes("Error: insufficient funds") || log.includes("Transfer: insufficient lamports"));
47969
+ if (fundsLog) return fundsLog;
47970
+ // Custom program error code in logs (covers GLAM, Jupiter, etc.)
47971
+ const customErrorLog = logs.find((log)=>log.includes("custom program error:"));
47972
+ if (customErrorLog) {
47973
+ const match = customErrorLog.match(/custom program error: (0x[0-9a-fA-F]+)/);
48936
47974
  if (match) {
48937
- const errorCodeHex = match[1];
48938
- const errorCode = parseInt(errorCodeHex, 16);
48939
- const jupiterError = JUPITER_SWAP_ERRORS[errorCode];
48940
- if (jupiterError) {
48941
- return jupiterError;
48942
- }
47975
+ const failedProgramId = extractFailedProgramId(logs);
47976
+ const resolved = resolveErrorCode(match[1], staging, failedProgramId);
47977
+ if (resolved) return resolved;
47978
+ return `Program error: ${match[1]}`;
48943
47979
  }
48944
47980
  }
48945
47981
  return "Unknown error";
@@ -48980,35 +48016,28 @@ const getSimulationResult = async (connection, instructions, payer, lookupTables
48980
48016
  }
48981
48017
  };
48982
48018
  const getErrorFromRpcResponse = (rpcResponse, staging)=>{
48983
- // Note: `confirmTransaction` does not throw an error if the confirmation does not succeed,
48984
- // but rather a `TransactionError` object. so we handle that here
48985
48019
  const error = rpcResponse.value.err;
48986
- if (error) {
48987
- // Can be a string or an object (literally just {}, no further typing is provided by the library)
48988
- // https://github.com/solana-labs/solana-web3.js/blob/4436ba5189548fc3444a9f6efb51098272926945/packages/library-legacy/src/connection.ts#L2930
48989
- if (typeof error === "object") {
48990
- const errorKeys = Object.keys(error);
48991
- if (errorKeys.length === 1) {
48992
- if (errorKeys[0] !== "InstructionError") {
48993
- throw new Error(`Unknown RPC error: ${error}`);
48994
- }
48995
- // @ts-ignore due to missing typing information mentioned above.
48996
- const instructionError = error["InstructionError"];
48997
- // An instruction error is a custom program error and looks like: [1, {"Custom": 1}]
48998
- // See also https://solana.stackexchange.com/a/931/294
48999
- const customErrorCode = instructionError[1]["Custom"];
49000
- const { errors: glamErrors } = getGlamProtocolIdl(staging);
49001
- const glamError = glamErrors.find((e)=>e.code === customErrorCode);
49002
- if (glamError?.msg) {
49003
- throw new Error(glamError.msg);
49004
- }
49005
- // Unrecognized error code, try to parse program logs to get error message
49006
- const errMsg = parseProgramLogs(rpcResponse.value.logs);
49007
- throw new Error(errMsg);
49008
- }
49009
- }
49010
- throw Error("Unknown error");
49011
- }
48020
+ if (!error) return;
48021
+ if (typeof error === "object") {
48022
+ const errorKeys = Object.keys(error);
48023
+ if (errorKeys.length === 1) {
48024
+ if (errorKeys[0] !== "InstructionError") {
48025
+ throw new Error(`Unknown RPC error: ${JSON.stringify(error)}`);
48026
+ }
48027
+ // @ts-ignore due to missing typing information
48028
+ const instructionError = error["InstructionError"];
48029
+ const customErrorCode = instructionError?.[1]?.["Custom"];
48030
+ if (customErrorCode !== undefined) {
48031
+ const failedProgramId = extractFailedProgramId(rpcResponse.value.logs);
48032
+ const msg = resolveErrorCode(customErrorCode, staging, failedProgramId);
48033
+ if (msg) throw new Error(msg);
48034
+ }
48035
+ // Fallback to log-based parsing
48036
+ throw new Error(parseProgramLogs(rpcResponse.value.logs || [], staging));
48037
+ }
48038
+ throw new Error(`Unknown RPC error: ${JSON.stringify(error)}`);
48039
+ }
48040
+ throw new Error(typeof error === "string" ? error : "Unknown error");
49012
48041
  };
49013
48042
 
49014
48043
  function readUnsignedBigInt64LE(buffer, offset) {
@@ -49876,12 +48905,9 @@ class JupiterApiClient {
49876
48905
  this.owner = data.owner ?? null;
49877
48906
  this.portfolioManagerName = data.portfolioManagerName ?? null;
49878
48907
  this.borrowable = data.borrowable ?? null;
49879
- this.reduceOnly = data.reduceOnly ?? null;
49880
- this.anyLst = data.anyLst ?? null;
49881
48908
  this.timelockDuration = data.timelockDuration ?? null;
49882
48909
  this.delegateAcls = data.delegateAcls ?? null;
49883
48910
  this.integrationAcls = data.integrationAcls ?? null;
49884
- this.feeStructure = data.feeStructure ?? null;
49885
48911
  }
49886
48912
  }
49887
48913
  /**
@@ -50039,8 +49065,6 @@ class JupiterApiClient {
50039
49065
  this.externalPositions = data.externalPositions ?? [];
50040
49066
  this.pricedProtocols = data.pricedProtocols ?? [];
50041
49067
  this.borrowable = data.borrowable ?? null;
50042
- this.reduceOnly = data.reduceOnly ?? null;
50043
- this.anyLst = data.anyLst ?? null;
50044
49068
  }
50045
49069
  }
50046
49070
  class CreatedModel {
@@ -50194,15 +49218,6 @@ var ClusterNetwork = /*#__PURE__*/ function(ClusterNetwork) {
50194
49218
  */ ClusterNetwork.fromUrl = fromUrl;
50195
49219
  })(ClusterNetwork || (ClusterNetwork = {}));
50196
49220
 
50197
- class GlamError extends Error {
50198
- constructor(message, rawError, programLogs){
50199
- super(message);
50200
- this.message = message;
50201
- this.rawError = rawError;
50202
- this.programLogs = programLogs;
50203
- }
50204
- }
50205
-
50206
49221
  const LOOKUP_TABLES = [
50207
49222
  new PublicKey("284iwGtA9X9aLy3KsyV8uT2pXLARhYbiSi5SiM2g47M2"),
50208
49223
  new PublicKey("D9cnvzswDikQDf53k4HpQ3KJ9y1Fv3HGGDFYMXnK5T6c"),
@@ -50380,7 +49395,8 @@ class BaseClient {
50380
49395
  const errTx = await this.connection.getTransaction(txSig, {
50381
49396
  maxSupportedTransactionVersion: 0
50382
49397
  });
50383
- throw new GlamError(parseProgramLogs(errTx?.meta?.logMessages), errTx?.meta?.err || undefined, errTx?.meta?.logMessages || []);
49398
+ const logs = errTx?.meta?.logMessages || [];
49399
+ throw new GlamError(parseProgramLogs(logs, this.staging), errTx?.meta?.err, logs);
50384
49400
  }
50385
49401
  return txSig;
50386
49402
  }
@@ -50599,7 +49615,7 @@ class BaseClient {
50599
49615
  const integrationPolicy = stateAccount.integrationAcls?.find((acl)=>acl.integrationProgram.equals(integProgramId));
50600
49616
  const policyData = integrationPolicy?.protocolPolicies?.find((policy)=>policy.protocolBitflag === protocolBitflag)?.data;
50601
49617
  if (policyData) {
50602
- return policyClass.decode(policyData);
49618
+ return policyClass.decode(policyData, this.staging);
50603
49619
  }
50604
49620
  return null;
50605
49621
  }
@@ -50762,6 +49778,17 @@ class DriftVaultDepositor extends Decodable {
50762
49778
  get netShares() {
50763
49779
  return this.vaultShares.sub(this.lastWithdrawRequest.shares);
50764
49780
  }
49781
+ /** Rebase shares to match the vault's current shares base. */ rebaseShares(shares, vaultSharesBase) {
49782
+ if (this.vaultSharesBase === vaultSharesBase) return shares;
49783
+ const expoDiff = vaultSharesBase - this.vaultSharesBase;
49784
+ const divisor = new BN(10).pow(new BN(expoDiff));
49785
+ return shares.div(divisor);
49786
+ }
49787
+ /** Net shares rebased to the vault's current shares base. */ netSharesRebased(vaultSharesBase) {
49788
+ const rebased = this.rebaseShares(this.vaultShares, vaultSharesBase);
49789
+ const pendingRebased = this.rebaseShares(this.lastWithdrawRequest.shares, vaultSharesBase);
49790
+ return rebased.sub(pendingRebased);
49791
+ }
50765
49792
  }
50766
49793
  DriftVaultDepositor._layout = struct([
50767
49794
  array(u8(), 8, "discriminator"),
@@ -50822,7 +49849,7 @@ class DriftVault extends Decodable {
50822
49849
  const aumScaledUsd = this.aum(spotPositions, perpPositions, spotMarketsMap, perpMarketsMap);
50823
49850
  const spotMarket = spotMarketsMap.get(this.marketPda(MarketType.SPOT, this.spotMarketIndex));
50824
49851
  const baseAssetAmount = aumScaledUsd.mul(new BN(10 ** spotMarket.decimals)).div(spotMarket.lastOraclePrice);
50825
- return baseAssetAmount.sub(this.managerBorrowedValue);
49852
+ return baseAssetAmount.add(this.managerBorrowedValue);
50826
49853
  }
50827
49854
  }
50828
49855
  DriftVault._layout = struct([
@@ -52592,7 +51619,7 @@ let TxBuilder$e = class TxBuilder extends BaseTxBuilder {
52592
51619
  inputMint = new PublicKey(quoteParams?.inputMint || resolvedQuoteResponse.inputMint);
52593
51620
  outputMint = new PublicKey(quoteParams?.outputMint || resolvedQuoteResponse.outputMint);
52594
51621
  amount = new BN(quoteParams?.amount || resolvedQuoteResponse.inAmount);
52595
- swapInstructions = await this.client.jupApi.getSwapInstructions(resolvedQuoteResponse, glamVault);
51622
+ swapInstructions = await this.client.jupApi.getSwapInstructions(resolvedQuoteResponse, glamVault, options.trackingAccount);
52596
51623
  } else {
52597
51624
  // If swapInstructions is provided, we need to extract mints and amount from quoteParams or quoteResponse
52598
51625
  if (quoteParams) {
@@ -54166,6 +53193,49 @@ let TxBuilder$a = class TxBuilder extends BaseTxBuilder {
54166
53193
  const tx = this.build(ixs, txOptions);
54167
53194
  return await this.client.base.intoVersionedTransaction(tx, txOptions);
54168
53195
  }
53196
+ async requestElevationGroupIxs(lendingMarket, elevationGroup, glamSigner) {
53197
+ const vault = this.client.base.vaultPda;
53198
+ const obligation = this.client.getObligationPda(vault, lendingMarket);
53199
+ // Find all reserve keys
53200
+ const { activeDeposits, activeBorrows } = await this.client.fetchAndParseObligation(obligation);
53201
+ const reserveKeys = [
53202
+ ...activeDeposits.map(({ depositReserve })=>depositReserve),
53203
+ ...activeBorrows.map(({ borrowReserve })=>borrowReserve)
53204
+ ];
53205
+ // Build refresh ixs
53206
+ const reserves = await this.client.fetchAndParseReserves(reserveKeys);
53207
+ const refreshReservesIx = this.refreshReservesBatchIx(reserves, false);
53208
+ const refreshObligationIx = this.refreshObligationIx({
53209
+ lendingMarket,
53210
+ obligation,
53211
+ reserves: reserveKeys
53212
+ });
53213
+ const ix = await this.client.base.extKaminoProgram.methods// @ts-expect-error staging only
53214
+ .lendingRequestElevationGroup(elevationGroup).accounts({
53215
+ glamState: this.client.base.statePda,
53216
+ glamSigner,
53217
+ obligation,
53218
+ lendingMarket
53219
+ }).remainingAccounts(reserveKeys.map((pubkey)=>({
53220
+ pubkey,
53221
+ isSigner: false,
53222
+ isWritable: false
53223
+ }))).instruction();
53224
+ return [
53225
+ refreshReservesIx,
53226
+ refreshObligationIx,
53227
+ ix
53228
+ ];
53229
+ }
53230
+ async requestElevationGroupTx(lendingMarket, elevationGroup, txOptions = {}) {
53231
+ if (!this.client.base.staging) {
53232
+ throw new Error("requestElevationGroupTx is only available in staging mode");
53233
+ }
53234
+ const glamSigner = txOptions.signer || this.client.base.signer;
53235
+ const ixs = await this.requestElevationGroupIxs(lendingMarket, elevationGroup, glamSigner);
53236
+ const tx = this.build(ixs, txOptions);
53237
+ return await this.client.base.intoVersionedTransaction(tx, txOptions);
53238
+ }
54169
53239
  async repayIxs(market, asset, amount, glamSigner) {
54170
53240
  const vault = this.client.base.vaultPda;
54171
53241
  const obligation = this.client.getObligationPda(vault, market);
@@ -54232,6 +53302,15 @@ class KaminoLendingClient {
54232
53302
  return await this.base.sendAndConfirm(tx);
54233
53303
  }
54234
53304
  /**
53305
+ * Requests an elevation group for an obligation.
53306
+ */ async requestElevationGroup(market, elevationGroup, txOptions = {}) {
53307
+ if (!this.base.staging) {
53308
+ throw new Error("requestElevationGroup is only available in staging mode");
53309
+ }
53310
+ const tx = await this.txBuilder.requestElevationGroupTx(new PublicKey(market), elevationGroup, txOptions);
53311
+ return await this.base.sendAndConfirm(tx);
53312
+ }
53313
+ /**
54235
53314
  * Repays asset to the lending market.
54236
53315
  */ async repay(market, asset, amount, txOptions = {}) {
54237
53316
  const tx = await this.txBuilder.repayTx(new PublicKey(market), new PublicKey(asset), new BN(amount), txOptions);
@@ -55553,6 +54632,7 @@ class PriceClient {
55553
54632
  const { marketIndex, marketPda } = perpPosition;
55554
54633
  const { lastOraclePrice, cumulativeFundingRateLong, cumulativeFundingRateShort } = perpMarketsMap.get(marketPda);
55555
54634
  const amount = perpPosition.getUsdValueScaled(lastOraclePrice, cumulativeFundingRateLong, cumulativeFundingRateShort);
54635
+ const baseAssetAmountUi = toUiAmount(perpPosition.baseAssetAmount, 9);
55556
54636
  const { usdPrice, slot } = await this.getTokenPrice(USDC, tokenPricesMap);
55557
54637
  const holding = new Holding(USDC, 6, amount, usdPrice, {
55558
54638
  slot,
@@ -55560,7 +54640,11 @@ class PriceClient {
55560
54640
  }, "DriftProtocol", {
55561
54641
  user: userPda,
55562
54642
  marketIndex,
55563
- marketType: "perp"
54643
+ marketType: "perp",
54644
+ // Preserve both USD value and signed base size for downstream UIs.
54645
+ usdValueUi: toUiAmount(amount, 6),
54646
+ baseAssetAmount: perpPosition.baseAssetAmount.toString(),
54647
+ baseAssetAmountUi
55564
54648
  });
55565
54649
  holdings.push(holding);
55566
54650
  }
@@ -55574,7 +54658,32 @@ class PriceClient {
55574
54658
  const dvaultUserData = accountsDataMap.get(dvault.user);
55575
54659
  const { spotPositions, perpPositions } = DriftUser.decode(dvault.user, dvaultUserData);
55576
54660
  const aum = dvault.aumInBaseAsset(spotPositions, perpPositions, spotMarketsMap, perpMarketsMap);
55577
- const amount = depositor.netShares.mul(aum).div(dvault.totalShares).add(depositor.lastWithdrawRequest.value);
54661
+ // Deduct accrued management fee from AUM (matches Rust logic)
54662
+ const clockData = accountsDataMap.get(SYSVAR_CLOCK_PUBKEY);
54663
+ const nowTs = new BN(clockData ? clockData.readUInt32LE(32) : 0);
54664
+ let aumPostMgmt = aum;
54665
+ if (dvault.managementFee.gtn(0) && aum.gtn(0)) {
54666
+ const sinceLast = nowTs.sub(dvault.lastFeeUpdateTs);
54667
+ const depositorsAum = aum.mul(dvault.userShares).div(dvault.totalShares);
54668
+ const mgmtFee = depositorsAum.mul(dvault.managementFee).div(new BN(1000000)).mul(sinceLast).div(new BN(31536000));
54669
+ aumPostMgmt = aum.sub(mgmtFee);
54670
+ }
54671
+ // Compute depositor position WITHOUT pending withdrawal (matches Rust logic)
54672
+ const depositorNetShares = depositor.netSharesRebased(dvault.sharesBase);
54673
+ const sharesPosition = depositorNetShares.mul(aumPostMgmt).div(dvault.totalShares);
54674
+ const pendingWithdrawalValue = depositor.lastWithdrawRequest.value;
54675
+ // PnL & fee breakdown (perf fee is computed on shares position only)
54676
+ const costBasis = depositor.netDeposits.add(depositor.cumulativeProfitShareAmount);
54677
+ const pnlBeforeFees = sharesPosition.sub(costBasis);
54678
+ let pendingPerfFee = new BN(0);
54679
+ if (dvault.profitShare > 0) {
54680
+ const hurdleBaseline = costBasis.mul(new BN(dvault.hurdleRate)).div(new BN(1000000));
54681
+ if (pnlBeforeFees.gt(hurdleBaseline)) {
54682
+ pendingPerfFee = pnlBeforeFees.mul(new BN(dvault.profitShare)).div(new BN(1000000));
54683
+ }
54684
+ }
54685
+ // final = shares_position - perf_fee + pending_withdrawal
54686
+ const amount = sharesPosition.sub(pendingPerfFee).add(pendingWithdrawalValue);
55578
54687
  const { mint, decimals } = dvault.getBaseAsset(spotMarketsMap);
55579
54688
  const { usdPrice, slot } = await this.getTokenPrice(mint, tokenPricesMap);
55580
54689
  const holding = new Holding(mint, decimals, amount, usdPrice, {
@@ -55582,7 +54691,10 @@ class PriceClient {
55582
54691
  source: priceSource
55583
54692
  }, "DriftVaults", {
55584
54693
  vault: dvault.getAddress(),
55585
- depositor: depositor.getAddress()
54694
+ depositor: depositor.getAddress(),
54695
+ pnlBeforeFees,
54696
+ pendingPerfFee,
54697
+ profitSharePct: dvault.profitShare / 10000
55586
54698
  });
55587
54699
  holdings.push(holding);
55588
54700
  }
@@ -55633,26 +54745,54 @@ class PriceClient {
55633
54745
  }
55634
54746
  async getKaminoVaultsHoldings(kvaultAtasAndStates, reservesMap, accountsDataMap, tokenPricesMap, priceSource) {
55635
54747
  const holdings = [];
54748
+ const FRACTION_SCALE = new Decimal(2).pow(60); // U68F60 fixed-point scale
54749
+ const SECONDS_PER_YEAR_KAMINO = 31556926;
54750
+ const clockData = accountsDataMap.get(SYSVAR_CLOCK_PUBKEY);
54751
+ const nowTs = clockData ? clockData.readUInt32LE(32) : 0;
55636
54752
  for (const [ata, kvaultState] of kvaultAtasAndStates.pkEntries()){
55637
54753
  const ataData = accountsDataMap.get(ata);
55638
54754
  const tokenAccount = AccountLayout.decode(ataData);
55639
- let aum = new Decimal(kvaultState.tokenAvailable.toString());
54755
+ let aumAndFees = new Decimal(kvaultState.tokenAvailable.toString());
55640
54756
  kvaultState.validAllocations.map((allocation)=>{
55641
54757
  const reserve = reservesMap.get(allocation.reserve);
55642
54758
  const { collateralExchangeRate } = reserve;
55643
54759
  // allocation ctoken amount to liq asset amount
55644
54760
  const liqAmount = new Decimal(allocation.ctokenAllocation.toString()).div(collateralExchangeRate).floor();
55645
- aum = aum.add(liqAmount);
54761
+ aumAndFees = aumAndFees.add(liqAmount);
55646
54762
  });
55647
- // calculate liquidity token amount
55648
- const amount = new Decimal(tokenAccount.amount.toString()).div(new Decimal(kvaultState.sharesIssued.toString())).mul(aum).floor();
54763
+ // Deduct pending fees from AUM (matches Rust: aum = available + allocated - pending_fees)
54764
+ const pendingFees = new Decimal(kvaultState.pendingFeesSf.toString()).div(FRACTION_SCALE);
54765
+ let vaultAum = aumAndFees.sub(pendingFees);
54766
+ const sharesIssued = new Decimal(kvaultState.sharesIssued.toString());
54767
+ if (vaultAum.lte(0) || sharesIssued.lte(0)) {
54768
+ continue; // early return like Rust: if vault_aum == 0 || shares_issued == 0
54769
+ }
54770
+ // Management fee: prev_aum * from_bps(mgmt_fee_bps) * since_last / SECONDS_PER_YEAR
54771
+ const prevAum = new Decimal(kvaultState.prevAumSf.toString()).div(FRACTION_SCALE);
54772
+ const sinceLast = Math.max(0, nowTs - kvaultState.lastFeeChargeTimestamp.toNumber());
54773
+ let mgmtCharge = new Decimal(0);
54774
+ if (sinceLast > 0) {
54775
+ const mgmtFeeRate = new Decimal(kvaultState.managementFeeBps.toString()).div(10000);
54776
+ mgmtCharge = prevAum.mul(mgmtFeeRate).mul(sinceLast).div(SECONDS_PER_YEAR_KAMINO);
54777
+ }
54778
+ // Performance fee: from_bps(perf_fee_bps) * max(0, vault_aum - prev_aum)
54779
+ const earnedInterest = Decimal.max(0, vaultAum.sub(prevAum));
54780
+ const perfCharge = new Decimal(kvaultState.performanceFeeBps.toString()).div(10000).mul(earnedInterest);
54781
+ // Deduct fees from AUM (matches Rust: vault_aum = vault_aum - mgmt_charge - perf_charge)
54782
+ vaultAum = vaultAum.sub(mgmtCharge).sub(perfCharge);
54783
+ // calculate liquidity token amount: shares * vault_aum.floor() / shares_issued
54784
+ const amount = new Decimal(tokenAccount.amount.toString()).mul(vaultAum.floor()).div(sharesIssued).floor();
55649
54785
  const { usdPrice, slot } = await this.getTokenPrice(kvaultState.tokenMint, tokenPricesMap);
55650
54786
  const holding = new Holding(kvaultState.tokenMint, kvaultState.tokenMintDecimals.toNumber(), new BN(amount.toString()), usdPrice, {
55651
54787
  slot,
55652
54788
  source: priceSource
55653
54789
  }, "KaminoVaults", {
55654
54790
  kaminoVault: kvaultState._address,
55655
- kaminoVaultAta: ata
54791
+ kaminoVaultAta: ata,
54792
+ pendingMgmtFee: mgmtCharge.toFixed(0),
54793
+ pendingPerfFee: perfCharge.toFixed(0),
54794
+ managementFeeBps: kvaultState.managementFeeBps.toNumber(),
54795
+ performanceFeeBps: kvaultState.performanceFeeBps.toNumber()
55656
54796
  });
55657
54797
  holdings.push(holding);
55658
54798
  }
@@ -56122,34 +55262,6 @@ let TxBuilder$6 = class TxBuilder extends BaseTxBuilder {
56122
55262
  const ixs = await this.claimFeesIxs(glamSigner);
56123
55263
  return await this.buildVersionedTx(ixs, txOptions);
56124
55264
  }
56125
- async chargeProtocolFeeIxs(glamSigner) {
56126
- const stateModel = await this.client.base.fetchStateModel();
56127
- const { baseAssetMint: baseAsset } = stateModel;
56128
- // TODO: parse from glam config account
56129
- const protocolFeeAuthority = new PublicKey("9oWi2MjrAujYNTUXXNBLk1ugioaF1mJHc7EoamX4eQLZ");
56130
- const { tokenProgram } = await fetchMintAndTokenProgram(this.client.base.connection, baseAsset);
56131
- const protocolFeeAuthorityAta = this.client.base.getAta(baseAsset, protocolFeeAuthority, tokenProgram);
56132
- const priceVaultIxs = await this.client.price.priceVaultIxs();
56133
- const preInstructions = [
56134
- createAssociatedTokenAccountIdempotentInstruction(glamSigner, protocolFeeAuthorityAta, protocolFeeAuthority, baseAsset, tokenProgram),
56135
- ...priceVaultIxs
56136
- ];
56137
- const ix = await this.client.base.protocolProgram.methods.chargeProtocolFee().accounts({
56138
- glamState: this.client.base.statePda,
56139
- protocolFeeAuthority,
56140
- depositAsset: baseAsset,
56141
- depositTokenProgram: tokenProgram
56142
- }).instruction();
56143
- return [
56144
- ...preInstructions,
56145
- ix
56146
- ];
56147
- }
56148
- async chargeProtocolFeeTx(txOptions = {}) {
56149
- const glamSigner = txOptions.signer || this.client.base.signer;
56150
- const ixs = await this.chargeProtocolFeeIxs(glamSigner);
56151
- return await this.buildVersionedTx(ixs, txOptions);
56152
- }
56153
55265
  async setProtocolFeesIx(baseFeeBps, flowFeeBps, signer) {
56154
55266
  const _signer = signer || this.client.base.signer;
56155
55267
  return await this.client.base.mintProgram.methods.setProtocolFees(baseFeeBps, flowFeeBps).accounts({
@@ -56209,10 +55321,6 @@ class FeesClient {
56209
55321
  const vTx = await this.txBuilder.claimFeesTx(txOptions);
56210
55322
  return await this.base.sendAndConfirm(vTx);
56211
55323
  }
56212
- async chargeProtocolFee(txOptions = {}) {
56213
- const vTx = await this.txBuilder.chargeProtocolFeeTx(txOptions);
56214
- return await this.base.sendAndConfirm(vTx);
56215
- }
56216
55324
  async setProtocolFees(baseFeeBps, flowFeeBps, txOptions = {}) {
56217
55325
  const vTx = await this.txBuilder.setProtocolFeesTx(baseFeeBps, flowFeeBps, txOptions);
56218
55326
  return await this.base.sendAndConfirm(vTx);
@@ -57970,4 +57078,4 @@ class CctpClient {
57970
57078
  }
57971
57079
  }
57972
57080
 
57973
- export { ALT_PROGRAM_ID, ASSETS_MAINNET, ASSETS_TESTS, AssetTier, BaseClient, BaseTxBuilder, BlockhashWithCache, CCTP_DOMAIN_MAPPING, CctpBridgeEvent, CctpClient, CctpPolicy, ClusterNetwork, ContractTier, ContractType, CreatedModel, DRIFT_MARGIN_PRECISION, DRIFT_POOL_MAPPING, DRIFT_PROGRAM_ID, DRIFT_SIGNER, DRIFT_VAULTS_PROGRAM_ID, DRIFT_VAULT_DEPOSITOR_SIZE, DefaultOrderParams, DelegateAcl, DepositDirection, DepositExplanation, DriftMarketConfigs, DriftProtocolClient, DriftProtocolPolicy, DriftVaultsClient, DriftVaultsPolicy, EmergencyAccessUpdateArgs, EmergencyUpdateMintArgs, ExchangeStatus, Fraction, GLAM_CONFIG_PROGRAM, GLAM_REFERRER, GlamClient, GlamError, Holding, InsuranceFundOperation, IntegrationAcl, IntegrationPermissions, JITO_TIP_DEFAULT, JUP, JUPITER_API_DEFAULT, JUPITER_PROGRAM_ID, JupTokenList, JupiterApiClient, JupiterSwapClient, JupiterSwapPolicy, KAMINO_FARM_PROGRAM, KAMINO_LENDING_PROGRAM, KAMINO_OBTRIGATION_SIZE, KAMINO_RESERVE_SIZE, KAMINO_VAULTS_PROGRAM, KAMINO_VAULT_STATE_SIZE, KaminoLendingPolicy, KaminoVaultsPolicy, MARINADE_NATIVE_STAKE_AUTHORITY, MARINADE_PROGRAM_ID, MEMO_PROGRAM, MESSAGE_TRANSMITTER_V2, METEORA_POSITION_SIZE, MSOL, MarginMode, MarketStatus, MarketType, MintIdlModel, MintModel, MintPolicy, ModifyOrderPolicy, OracleSource, OracleSourceNum, OrderAction, OrderActionExplanation, OrderStatus, OrderTriggerCondition, OrderType, PeriodType, PerpOperation, PkMap, PkSet, PositionCategorizer, PositionDirection, PostOnlyParams, PriceClient, PriceDenom, ProtocolPermissions, ProtocolPolicy, RequestType, SANCTUM_STAKE_POOL_PROGRAM_ID, SEED_ACCOUNT_POLICY, SEED_ESCROW, SEED_EXTRA_ACCOUNT_METAS, SEED_GLOBAL_CONFIG, SEED_INTEGRATION_AUTHORITY, SEED_METADATA, SEED_MINT, SEED_REQUEST_QUEUE, SEED_STATE, SEED_VAULT, SOL_ORACLE, STAKE_ACCOUNT_SIZE, STAKE_POOLS, STAKE_POOLS_MAP, SettlePnlExplanation, SpotBalanceType, SpotFulfillmentConfigStatus, SpotFulfillmentStatus, SpotFulfillmentType, SpotOperation, StakeAction, StateAccountType, StateIdlModel, StateModel, SwapDirection, TOKEN_MESSENGER_MINTER_V2, TRANSFER_HOOK_PROGRAM, TimeUnit, TimelockClient, TransferPolicy, TransferRateLimitPolicy, USDC, USDC_DEVNET, USDC_ORACLE, UserStatus, VaultHoldings, VoteAuthorize, WSOL, ZERO, bfToDecimal, buildComputeBudgetInstructions, buildCreateAltInstructions, buildExtendAltInstructions, bytesToHex, charsToString, collectVaultLookupTableAddresses, compareDelegateAcls, compareIntegrationAcls, comparePublicKeyArrays, evmAddressToBytes32, evmAddressToPublicKey, fetchAddressLookupTableAccounts, fetchMintAndTokenProgram, fetchMintsAndTokenPrograms, findGlamLookupTables, findStakeAccounts, formatBits, fromUiAmount, getAccountPolicyPda, getAssetMeta, getEscrowPda, getExtCctpIdl, getExtCctpProgram, getExtCctpProgramId, getExtDriftIdl, getExtDriftProgram, getExtDriftProgramId, getExtKaminoIdl, getExtKaminoProgram, getExtKaminoProgramId, getExtMarinadeIdl, getExtMarinadeProgram, getExtMarinadeProgramId, getExtOffchainIdl, getExtOffchainProgram, getExtOffchainProgramId, getExtSplIdl, getExtSplProgram, getExtSplProgramId, getExtStakePoolIdl, getExtStakePoolProgram, getExtStakePoolProgramId, getExtraMetasPda, getGlamConfigProgram, getGlamMintIdl, getGlamMintProgram, getGlamMintProgramId, getGlamProtocolIdl, getGlamProtocolProgram, getGlamProtocolProgramId, getGlobalConfigPda, getLimitOrderParams, getMarketOrderParams, getMintPda, getOrderParams, getPermissionNamesFromBitmask, getPriorityFeeEstimate, getProgramAccounts, getProgramAccountsWithRetry, getProgramAndBitflagByProtocolName, getProtocolNameByProgramAndBitflag, getProtocolNamesFromBitmask, getProtocolsAndPermissions, getRequestQueuePda, getSimulationResult, getSolAndTokenBalances, getStakeAccountsWithStates, getStatePda, getTokenAccountsByOwner, getTransactionsForAddress, getTriggerLimitOrderParams, getTriggerMarketOrderParams, getVaultPda, hexToBytes, isValidEvmAddress, parseMintAccountInfo, parsePermissionNames, parseProgramLogs, parseProtocolPermissionsBitmask, parseProtocolsBitmask, publicKeyToEvmAddress, readI128LE, readSignedBigInt64LE, readUnsignedBigInt64LE, resolveStaging, stringToChars, toUiAmount };
57081
+ export { ALT_PROGRAM_ID, ASSETS_MAINNET, ASSETS_TESTS, AssetTier, BaseClient, BaseTxBuilder, BlockhashWithCache, CCTP_DOMAIN_MAPPING, CctpBridgeEvent, CctpClient, CctpPolicy, ClusterNetwork, ContractTier, ContractType, CreatedModel, DRIFT_MARGIN_PRECISION, DRIFT_POOL_MAPPING, DRIFT_PROGRAM_ID, DRIFT_SIGNER, DRIFT_VAULTS_PROGRAM_ID, DRIFT_VAULT_DEPOSITOR_SIZE, DefaultOrderParams, DelegateAcl, DepositDirection, DepositExplanation, DriftMarketConfigs, DriftProtocolClient, DriftProtocolPolicy, DriftVaultsClient, DriftVaultsPolicy, EmergencyAccessUpdateArgs, EmergencyUpdateMintArgs, ExchangeStatus, Fraction, GLAM_CONFIG_PROGRAM, GLAM_REFERRER, GlamClient, GlamError, Holding, InsuranceFundOperation, IntegrationAcl, IntegrationPermissions, JITO_TIP_DEFAULT, JUP, JUPITER_API_DEFAULT, JUPITER_PROGRAM_ID, JupTokenList, JupiterApiClient, JupiterSwapClient, JupiterSwapPolicy, KAMINO_FARM_PROGRAM, KAMINO_LENDING_PROGRAM, KAMINO_OBTRIGATION_SIZE, KAMINO_RESERVE_SIZE, KAMINO_VAULTS_PROGRAM, KAMINO_VAULT_STATE_SIZE, KaminoLendingPolicy, KaminoVaultsPolicy, MARINADE_NATIVE_STAKE_AUTHORITY, MARINADE_PROGRAM_ID, MEMO_PROGRAM, MESSAGE_TRANSMITTER_V2, METEORA_POSITION_SIZE, MSOL, MarginMode, MarketStatus, MarketType, MintIdlModel, MintModel, MintPolicy, ModifyOrderPolicy, OracleSource, OracleSourceNum, OrderAction, OrderActionExplanation, OrderStatus, OrderTriggerCondition, OrderType, PeriodType, PerpOperation, PkMap, PkSet, PositionCategorizer, PositionDirection, PostOnlyParams, PriceClient, PriceDenom, ProtocolPermissions, ProtocolPolicy, RequestType, SANCTUM_STAKE_POOL_PROGRAM_ID, SEED_ACCOUNT_POLICY, SEED_ESCROW, SEED_EXTRA_ACCOUNT_METAS, SEED_GLOBAL_CONFIG, SEED_INTEGRATION_AUTHORITY, SEED_METADATA, SEED_MINT, SEED_REQUEST_QUEUE, SEED_STATE, SEED_VAULT, SOL_ORACLE, STAKE_ACCOUNT_SIZE, STAKE_POOLS, STAKE_POOLS_MAP, SettlePnlExplanation, SpotBalanceType, SpotFulfillmentConfigStatus, SpotFulfillmentStatus, SpotFulfillmentType, SpotOperation, StakeAction, StateAccountType, StateIdlModel, StateModel, SwapDirection, TOKEN_MESSENGER_MINTER_V2, TRANSFER_HOOK_PROGRAM, TimeUnit, TimelockClient, TransferPolicy, TransferRateLimitPolicy, USDC, USDC_DEVNET, USDC_ORACLE, UserStatus, VaultHoldings, VoteAuthorize, WSOL, ZERO, bfToDecimal, buildComputeBudgetInstructions, buildCreateAltInstructions, buildExtendAltInstructions, bytesToHex, charsToString, collectVaultLookupTableAddresses, compareDelegateAcls, compareIntegrationAcls, comparePublicKeyArrays, evmAddressToBytes32, evmAddressToPublicKey, extractFailedProgramId, fetchAddressLookupTableAccounts, fetchMintAndTokenProgram, fetchMintsAndTokenPrograms, findGlamLookupTables, findStakeAccounts, formatBits, fromUiAmount, getAccountPolicyPda, getAssetMeta, getEscrowPda, getExtCctpIdl, getExtCctpProgram, getExtCctpProgramId, getExtDriftIdl, getExtDriftProgram, getExtDriftProgramId, getExtKaminoIdl, getExtKaminoProgram, getExtKaminoProgramId, getExtMarinadeIdl, getExtMarinadeProgram, getExtMarinadeProgramId, getExtOffchainIdl, getExtOffchainProgram, getExtOffchainProgramId, getExtSplIdl, getExtSplProgram, getExtSplProgramId, getExtStakePoolIdl, getExtStakePoolProgram, getExtStakePoolProgramId, getExtraMetasPda, getGlamConfigProgram, getGlamMintIdl, getGlamMintProgram, getGlamMintProgramId, getGlamProtocolIdl, getGlamProtocolProgram, getGlamProtocolProgramId, getGlobalConfigPda, getLimitOrderParams, getMarketOrderParams, getMintPda, getOrderParams, getPermissionNamesFromBitmask, getPriorityFeeEstimate, getProgramAccounts, getProgramAccountsWithRetry, getProgramAndBitflagByProtocolName, getProtocolNameByProgramAndBitflag, getProtocolNamesFromBitmask, getProtocolsAndPermissions, getRequestQueuePda, getSimulationResult, getSolAndTokenBalances, getStakeAccountsWithStates, getStatePda, getTokenAccountsByOwner, getTransactionsForAddress, getTriggerLimitOrderParams, getTriggerMarketOrderParams, getVaultPda, hexToBytes, isValidEvmAddress, parseMintAccountInfo, parsePermissionNames, parseProgramLogs, parseProtocolPermissionsBitmask, parseProtocolsBitmask, parseTxError, publicKeyToEvmAddress, readI128LE, readSignedBigInt64LE, readUnsignedBigInt64LE, resolveErrorCode, resolveStaging, stringToChars, toUiAmount };