@liquid-af/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/README.md +776 -0
  2. package/dist/accounts/index.d.ts +5 -0
  3. package/dist/accounts/index.d.ts.map +1 -0
  4. package/dist/accounts/index.js +5 -0
  5. package/dist/accounts/index.js.map +1 -0
  6. package/dist/accounts/liquid-fees.d.ts +63 -0
  7. package/dist/accounts/liquid-fees.d.ts.map +1 -0
  8. package/dist/accounts/liquid-fees.js +27 -0
  9. package/dist/accounts/liquid-fees.js.map +1 -0
  10. package/dist/accounts/liquid-state.d.ts +112 -0
  11. package/dist/accounts/liquid-state.d.ts.map +1 -0
  12. package/dist/accounts/liquid-state.js +92 -0
  13. package/dist/accounts/liquid-state.js.map +1 -0
  14. package/dist/accounts/liquid-swap.d.ts +97 -0
  15. package/dist/accounts/liquid-swap.d.ts.map +1 -0
  16. package/dist/accounts/liquid-swap.js +54 -0
  17. package/dist/accounts/liquid-swap.js.map +1 -0
  18. package/dist/accounts/liquid.d.ts +175 -0
  19. package/dist/accounts/liquid.d.ts.map +1 -0
  20. package/dist/accounts/liquid.js +66 -0
  21. package/dist/accounts/liquid.js.map +1 -0
  22. package/dist/client.d.ts +621 -0
  23. package/dist/client.d.ts.map +1 -0
  24. package/dist/client.js +511 -0
  25. package/dist/client.js.map +1 -0
  26. package/dist/config.d.ts +56 -0
  27. package/dist/config.d.ts.map +1 -0
  28. package/dist/config.js +44 -0
  29. package/dist/config.js.map +1 -0
  30. package/dist/errors.d.ts +39 -0
  31. package/dist/errors.d.ts.map +1 -0
  32. package/dist/errors.js +63 -0
  33. package/dist/errors.js.map +1 -0
  34. package/dist/events/index.d.ts +4 -0
  35. package/dist/events/index.d.ts.map +1 -0
  36. package/dist/events/index.js +2 -0
  37. package/dist/events/index.js.map +1 -0
  38. package/dist/events/parser.d.ts +40 -0
  39. package/dist/events/parser.d.ts.map +1 -0
  40. package/dist/events/parser.js +67 -0
  41. package/dist/events/parser.js.map +1 -0
  42. package/dist/events/types.d.ts +286 -0
  43. package/dist/events/types.d.ts.map +1 -0
  44. package/dist/events/types.js +2 -0
  45. package/dist/events/types.js.map +1 -0
  46. package/dist/helpers/index.d.ts +4 -0
  47. package/dist/helpers/index.d.ts.map +1 -0
  48. package/dist/helpers/index.js +3 -0
  49. package/dist/helpers/index.js.map +1 -0
  50. package/dist/helpers/preview.d.ts +259 -0
  51. package/dist/helpers/preview.d.ts.map +1 -0
  52. package/dist/helpers/preview.js +458 -0
  53. package/dist/helpers/preview.js.map +1 -0
  54. package/dist/helpers/user.d.ts +11 -0
  55. package/dist/helpers/user.d.ts.map +1 -0
  56. package/dist/helpers/user.js +20 -0
  57. package/dist/helpers/user.js.map +1 -0
  58. package/dist/idl/index.d.ts +53 -0
  59. package/dist/idl/index.d.ts.map +1 -0
  60. package/dist/idl/index.js +64 -0
  61. package/dist/idl/index.js.map +1 -0
  62. package/dist/idl/liquid.d.ts +10523 -0
  63. package/dist/idl/liquid.d.ts.map +1 -0
  64. package/dist/idl/liquid.js +2 -0
  65. package/dist/idl/liquid.js.map +1 -0
  66. package/dist/idl/liquid.json +10516 -0
  67. package/dist/idl/liquid_fees.d.ts +1520 -0
  68. package/dist/idl/liquid_fees.d.ts.map +1 -0
  69. package/dist/idl/liquid_fees.js +2 -0
  70. package/dist/idl/liquid_fees.js.map +1 -0
  71. package/dist/idl/liquid_fees.json +1513 -0
  72. package/dist/idl/liquid_state.d.ts +2936 -0
  73. package/dist/idl/liquid_state.d.ts.map +1 -0
  74. package/dist/idl/liquid_state.js +2 -0
  75. package/dist/idl/liquid_state.js.map +1 -0
  76. package/dist/idl/liquid_state.json +2929 -0
  77. package/dist/idl/liquid_swap.d.ts +5849 -0
  78. package/dist/idl/liquid_swap.d.ts.map +1 -0
  79. package/dist/idl/liquid_swap.js +2 -0
  80. package/dist/idl/liquid_swap.js.map +1 -0
  81. package/dist/idl/liquid_swap.json +5842 -0
  82. package/dist/index.d.ts +19 -0
  83. package/dist/index.d.ts.map +1 -0
  84. package/dist/index.js +15 -0
  85. package/dist/index.js.map +1 -0
  86. package/dist/instructions/index.d.ts +9 -0
  87. package/dist/instructions/index.d.ts.map +1 -0
  88. package/dist/instructions/index.js +9 -0
  89. package/dist/instructions/index.js.map +1 -0
  90. package/dist/instructions/liquid-fees.d.ts +111 -0
  91. package/dist/instructions/liquid-fees.d.ts.map +1 -0
  92. package/dist/instructions/liquid-fees.js +169 -0
  93. package/dist/instructions/liquid-fees.js.map +1 -0
  94. package/dist/instructions/liquid-state.d.ts +173 -0
  95. package/dist/instructions/liquid-state.d.ts.map +1 -0
  96. package/dist/instructions/liquid-state.js +194 -0
  97. package/dist/instructions/liquid-state.js.map +1 -0
  98. package/dist/instructions/liquid-swap.d.ts +122 -0
  99. package/dist/instructions/liquid-swap.d.ts.map +1 -0
  100. package/dist/instructions/liquid-swap.js +167 -0
  101. package/dist/instructions/liquid-swap.js.map +1 -0
  102. package/dist/instructions/liquid.d.ts +297 -0
  103. package/dist/instructions/liquid.d.ts.map +1 -0
  104. package/dist/instructions/liquid.js +483 -0
  105. package/dist/instructions/liquid.js.map +1 -0
  106. package/dist/instructions/program-cache.d.ts +35 -0
  107. package/dist/instructions/program-cache.d.ts.map +1 -0
  108. package/dist/instructions/program-cache.js +68 -0
  109. package/dist/instructions/program-cache.js.map +1 -0
  110. package/dist/math/amm.d.ts +42 -0
  111. package/dist/math/amm.d.ts.map +1 -0
  112. package/dist/math/amm.js +109 -0
  113. package/dist/math/amm.js.map +1 -0
  114. package/dist/math/bonding-curve.d.ts +34 -0
  115. package/dist/math/bonding-curve.d.ts.map +1 -0
  116. package/dist/math/bonding-curve.js +80 -0
  117. package/dist/math/bonding-curve.js.map +1 -0
  118. package/dist/math/constants.d.ts +14 -0
  119. package/dist/math/constants.d.ts.map +1 -0
  120. package/dist/math/constants.js +14 -0
  121. package/dist/math/constants.js.map +1 -0
  122. package/dist/math/fees.d.ts +88 -0
  123. package/dist/math/fees.d.ts.map +1 -0
  124. package/dist/math/fees.js +135 -0
  125. package/dist/math/fees.js.map +1 -0
  126. package/dist/math/index.d.ts +8 -0
  127. package/dist/math/index.d.ts.map +1 -0
  128. package/dist/math/index.js +6 -0
  129. package/dist/math/index.js.map +1 -0
  130. package/dist/math/tiered-fees.d.ts +80 -0
  131. package/dist/math/tiered-fees.d.ts.map +1 -0
  132. package/dist/math/tiered-fees.js +129 -0
  133. package/dist/math/tiered-fees.js.map +1 -0
  134. package/dist/oracle.d.ts +53 -0
  135. package/dist/oracle.d.ts.map +1 -0
  136. package/dist/oracle.js +70 -0
  137. package/dist/oracle.js.map +1 -0
  138. package/dist/pda/index.d.ts +89 -0
  139. package/dist/pda/index.d.ts.map +1 -0
  140. package/dist/pda/index.js +127 -0
  141. package/dist/pda/index.js.map +1 -0
  142. package/dist/pda/liquid-fees.d.ts +27 -0
  143. package/dist/pda/liquid-fees.d.ts.map +1 -0
  144. package/dist/pda/liquid-fees.js +36 -0
  145. package/dist/pda/liquid-fees.js.map +1 -0
  146. package/dist/pda/liquid-state.d.ts +56 -0
  147. package/dist/pda/liquid-state.d.ts.map +1 -0
  148. package/dist/pda/liquid-state.js +79 -0
  149. package/dist/pda/liquid-state.js.map +1 -0
  150. package/dist/pda/liquid-swap.d.ts +76 -0
  151. package/dist/pda/liquid-swap.d.ts.map +1 -0
  152. package/dist/pda/liquid-swap.js +103 -0
  153. package/dist/pda/liquid-swap.js.map +1 -0
  154. package/dist/pda/liquid.d.ts +67 -0
  155. package/dist/pda/liquid.d.ts.map +1 -0
  156. package/dist/pda/liquid.js +91 -0
  157. package/dist/pda/liquid.js.map +1 -0
  158. package/dist/provider.d.ts +26 -0
  159. package/dist/provider.d.ts.map +1 -0
  160. package/dist/provider.js +47 -0
  161. package/dist/provider.js.map +1 -0
  162. package/dist/transaction/builder.d.ts +30 -0
  163. package/dist/transaction/builder.d.ts.map +1 -0
  164. package/dist/transaction/builder.js +48 -0
  165. package/dist/transaction/builder.js.map +1 -0
  166. package/dist/transaction/index.d.ts +3 -0
  167. package/dist/transaction/index.d.ts.map +1 -0
  168. package/dist/transaction/index.js +3 -0
  169. package/dist/transaction/index.js.map +1 -0
  170. package/dist/transaction/send.d.ts +25 -0
  171. package/dist/transaction/send.d.ts.map +1 -0
  172. package/dist/transaction/send.js +52 -0
  173. package/dist/transaction/send.js.map +1 -0
  174. package/dist/types.d.ts +311 -0
  175. package/dist/types.d.ts.map +1 -0
  176. package/dist/types.js +46 -0
  177. package/dist/types.js.map +1 -0
  178. package/package.json +112 -0
  179. package/src/accounts/index.ts +26 -0
  180. package/src/accounts/liquid-fees.ts +38 -0
  181. package/src/accounts/liquid-state.ts +134 -0
  182. package/src/accounts/liquid-swap.ts +79 -0
  183. package/src/accounts/liquid.ts +100 -0
  184. package/src/client.ts +1001 -0
  185. package/src/config.ts +91 -0
  186. package/src/errors.ts +94 -0
  187. package/src/events/index.ts +42 -0
  188. package/src/events/parser.ts +90 -0
  189. package/src/events/types.ts +310 -0
  190. package/src/helpers/index.ts +23 -0
  191. package/src/helpers/preview.ts +798 -0
  192. package/src/helpers/user.ts +24 -0
  193. package/src/idl/index.ts +94 -0
  194. package/src/idl/liquid.json +10516 -0
  195. package/src/idl/liquid.ts +10522 -0
  196. package/src/idl/liquid_fees.json +1513 -0
  197. package/src/idl/liquid_fees.ts +1519 -0
  198. package/src/idl/liquid_state.json +2929 -0
  199. package/src/idl/liquid_state.ts +2935 -0
  200. package/src/idl/liquid_swap.json +5842 -0
  201. package/src/idl/liquid_swap.ts +5848 -0
  202. package/src/index.ts +98 -0
  203. package/src/instructions/index.ts +109 -0
  204. package/src/instructions/liquid-fees.ts +289 -0
  205. package/src/instructions/liquid-state.ts +336 -0
  206. package/src/instructions/liquid-swap.ts +414 -0
  207. package/src/instructions/liquid.ts +884 -0
  208. package/src/instructions/program-cache.ts +106 -0
  209. package/src/math/amm.ts +146 -0
  210. package/src/math/bonding-curve.ts +122 -0
  211. package/src/math/constants.ts +19 -0
  212. package/src/math/fees.ts +191 -0
  213. package/src/math/index.ts +40 -0
  214. package/src/math/tiered-fees.ts +165 -0
  215. package/src/oracle.ts +97 -0
  216. package/src/pda/index.ts +331 -0
  217. package/src/pda/liquid-fees.ts +58 -0
  218. package/src/pda/liquid-state.ts +123 -0
  219. package/src/pda/liquid-swap.ts +162 -0
  220. package/src/pda/liquid.ts +152 -0
  221. package/src/provider.ts +60 -0
  222. package/src/transaction/builder.ts +80 -0
  223. package/src/transaction/index.ts +6 -0
  224. package/src/transaction/send.ts +72 -0
  225. package/src/types.ts +354 -0
@@ -0,0 +1,336 @@
1
+ import type { PublicKey, TransactionInstruction } from "@solana/web3.js";
2
+ import type { LiquidConfig } from "../config.js";
3
+ import { getCachedStateProgram } from "./program-cache.js";
4
+ import { getDealPDA, getUserSnapshotPDA } from "../pda/liquid-state.js";
5
+
6
+ export interface BuildInitializeUserParams {
7
+ user: PublicKey;
8
+ config: LiquidConfig;
9
+ }
10
+
11
+ /**
12
+ * Builds an initializeUser instruction.
13
+ * Creates the user properties account in liquid-state.
14
+ *
15
+ * @param params - {@link BuildInitializeUserParams}
16
+ * @returns Transaction instruction
17
+ */
18
+ export function buildInitializeUser(
19
+ params: BuildInitializeUserParams
20
+ ): Promise<TransactionInstruction> {
21
+ const { user, config } = params;
22
+ const program = getCachedStateProgram(config);
23
+
24
+ return program.methods.initializeUser().accounts({ user }).instruction();
25
+ }
26
+
27
+ export interface BuildSetReferrerParams {
28
+ user: PublicKey;
29
+ referrer: PublicKey;
30
+ config: LiquidConfig;
31
+ }
32
+
33
+ /**
34
+ * Builds a setReferrer instruction.
35
+ * One-time operation — referrer cannot be changed once set.
36
+ *
37
+ * @param params - {@link BuildSetReferrerParams}
38
+ * @returns Transaction instruction
39
+ */
40
+ export function buildSetReferrer(
41
+ params: BuildSetReferrerParams
42
+ ): Promise<TransactionInstruction> {
43
+ const { user, referrer, config } = params;
44
+ const program = getCachedStateProgram(config);
45
+
46
+ return program.methods
47
+ .setReferrer(referrer)
48
+ .accounts({ user })
49
+ .instruction();
50
+ }
51
+
52
+ export interface BuildSetCashbackModeParams {
53
+ user: PublicKey;
54
+ config: LiquidConfig;
55
+ }
56
+
57
+ /**
58
+ * Builds a setCashbackMode instruction.
59
+ * Toggles user between earning mode (earn credits) and spending mode (spend credits).
60
+ *
61
+ * @param params - {@link BuildSetCashbackModeParams}
62
+ * @returns Transaction instruction
63
+ */
64
+ export function buildSetCashbackMode(
65
+ params: BuildSetCashbackModeParams
66
+ ): Promise<TransactionInstruction> {
67
+ const { user, config } = params;
68
+ const program = getCachedStateProgram(config);
69
+
70
+ return program.methods.setCashbackMode().accounts({ user }).instruction();
71
+ }
72
+
73
+ export interface BuildTransferAdminParams {
74
+ admin: PublicKey;
75
+ newAdmin: PublicKey;
76
+ config: LiquidConfig;
77
+ }
78
+
79
+ /**
80
+ * Builds a transferAdmin instruction.
81
+ * Proposes transfer of admin authority to a new pubkey (two-step).
82
+ * The new admin must call {@link buildAcceptAdmin} to complete the transfer.
83
+ *
84
+ * @param params - {@link BuildTransferAdminParams}
85
+ * @returns Transaction instruction
86
+ */
87
+ export function buildTransferAdmin(
88
+ params: BuildTransferAdminParams
89
+ ): Promise<TransactionInstruction> {
90
+ const { admin, newAdmin, config } = params;
91
+ const program = getCachedStateProgram(config);
92
+
93
+ return program.methods
94
+ .transferAdmin(newAdmin)
95
+ .accounts({ admin })
96
+ .instruction();
97
+ }
98
+
99
+ export interface BuildAcceptAdminParams {
100
+ newAdmin: PublicKey;
101
+ config: LiquidConfig;
102
+ }
103
+
104
+ /**
105
+ * Builds an acceptAdmin instruction.
106
+ * Completes a pending admin transfer. Must be called by the pending admin.
107
+ *
108
+ * @param params - {@link BuildAcceptAdminParams}
109
+ * @returns Transaction instruction
110
+ */
111
+ export function buildAcceptAdmin(
112
+ params: BuildAcceptAdminParams
113
+ ): Promise<TransactionInstruction> {
114
+ const { newAdmin, config } = params;
115
+ const program = getCachedStateProgram(config);
116
+
117
+ return program.methods
118
+ .acceptAdmin()
119
+ .accounts({ newAdmin })
120
+ .instruction();
121
+ }
122
+
123
+ export interface BuildCancelAdminTransferParams {
124
+ authority: PublicKey;
125
+ config: LiquidConfig;
126
+ }
127
+
128
+ /**
129
+ * Builds a cancelAdminTransfer instruction.
130
+ * Cancels a pending admin transfer. Callable by either the current admin or the pending admin.
131
+ *
132
+ * @param params - {@link BuildCancelAdminTransferParams}
133
+ * @returns Transaction instruction
134
+ */
135
+ export function buildCancelAdminTransfer(
136
+ params: BuildCancelAdminTransferParams
137
+ ): Promise<TransactionInstruction> {
138
+ const { authority, config } = params;
139
+ const program = getCachedStateProgram(config);
140
+
141
+ return program.methods
142
+ .cancelAdminTransfer()
143
+ .accounts({ authority })
144
+ .instruction();
145
+ }
146
+
147
+ export interface BuildCreateDealParams {
148
+ admin: PublicKey;
149
+ owner: PublicKey;
150
+ cashbackMultiplierBps: number;
151
+ payer: PublicKey;
152
+ config: LiquidConfig;
153
+ }
154
+
155
+ /**
156
+ * Builds a createDeal instruction.
157
+ * Admin creates an exclusive deal for a pubkey (typically a referrer/influencer).
158
+ *
159
+ * @param params - {@link BuildCreateDealParams}
160
+ * @returns Transaction instruction
161
+ */
162
+ export function buildCreateDeal(
163
+ params: BuildCreateDealParams
164
+ ): Promise<TransactionInstruction> {
165
+ const { admin, owner, cashbackMultiplierBps, payer, config } = params;
166
+ const program = getCachedStateProgram(config);
167
+
168
+ return program.methods
169
+ .createDeal(owner, cashbackMultiplierBps)
170
+ .accounts({ admin, payer })
171
+ .instruction();
172
+ }
173
+
174
+ export interface BuildUpdateDealParams {
175
+ admin: PublicKey;
176
+ dealOwner: PublicKey;
177
+ newCashbackMultiplierBps: number;
178
+ config: LiquidConfig;
179
+ }
180
+
181
+ /**
182
+ * Builds an updateDeal instruction.
183
+ * Admin updates a deal's cashback multiplier.
184
+ *
185
+ * @param params - {@link BuildUpdateDealParams}
186
+ * @returns Transaction instruction
187
+ */
188
+ export function buildUpdateDeal(
189
+ params: BuildUpdateDealParams
190
+ ): Promise<TransactionInstruction> {
191
+ const { admin, dealOwner, newCashbackMultiplierBps, config } = params;
192
+ const program = getCachedStateProgram(config);
193
+ const [deal] = getDealPDA(dealOwner, config.liquidStateProgramId);
194
+
195
+ return program.methods
196
+ .updateDeal(newCashbackMultiplierBps)
197
+ .accountsPartial({ admin, deal })
198
+ .instruction();
199
+ }
200
+
201
+ export interface BuildCloseDealParams {
202
+ admin: PublicKey;
203
+ dealOwner: PublicKey;
204
+ config: LiquidConfig;
205
+ }
206
+
207
+ /**
208
+ * Builds a closeDeal instruction.
209
+ * Admin closes/deletes a deal, returning rent to admin.
210
+ *
211
+ * @param params - {@link BuildCloseDealParams}
212
+ * @returns Transaction instruction
213
+ */
214
+ export function buildCloseDeal(
215
+ params: BuildCloseDealParams
216
+ ): Promise<TransactionInstruction> {
217
+ const { admin, dealOwner, config } = params;
218
+ const program = getCachedStateProgram(config);
219
+ const [deal] = getDealPDA(dealOwner, config.liquidStateProgramId);
220
+
221
+ return program.methods
222
+ .closeDeal()
223
+ .accountsPartial({ admin, deal })
224
+ .instruction();
225
+ }
226
+
227
+ export interface BuildRedeemDealParams {
228
+ user: PublicKey;
229
+ dealOwner: PublicKey;
230
+ config: LiquidConfig;
231
+ }
232
+
233
+ /**
234
+ * Builds a redeemDeal instruction.
235
+ * User redeems their referrer's deal, copying the multiplier.
236
+ *
237
+ * @param params - {@link BuildRedeemDealParams}
238
+ * @returns Transaction instruction
239
+ */
240
+ export function buildRedeemDeal(
241
+ params: BuildRedeemDealParams
242
+ ): Promise<TransactionInstruction> {
243
+ const { user, dealOwner, config } = params;
244
+ const program = getCachedStateProgram(config);
245
+ const [deal] = getDealPDA(dealOwner, config.liquidStateProgramId);
246
+
247
+ return program.methods
248
+ .redeemDeal()
249
+ .accountsPartial({ user, deal })
250
+ .instruction();
251
+ }
252
+
253
+ export interface BuildTakeSnapshotParams {
254
+ admin: PublicKey;
255
+ user: PublicKey;
256
+ payer: PublicKey;
257
+ snapshotIndex: number;
258
+ config: LiquidConfig;
259
+ }
260
+
261
+ /**
262
+ * Builds a takeSnapshot instruction.
263
+ * Admin takes a snapshot of a user's volume since last snapshot.
264
+ *
265
+ * The caller must provide the current `snapshotIndex` (from `user_properties.snapshot_count`)
266
+ * because the snapshot PDA seed depends on this value and cannot be resolved without a
267
+ * network fetch.
268
+ *
269
+ * @param params - {@link BuildTakeSnapshotParams}
270
+ * @returns Transaction instruction
271
+ */
272
+ export function buildTakeSnapshot(
273
+ params: BuildTakeSnapshotParams
274
+ ): Promise<TransactionInstruction> {
275
+ const { admin, user, payer, snapshotIndex, config } = params;
276
+ const program = getCachedStateProgram(config);
277
+ const [userSnapshot] = getUserSnapshotPDA(
278
+ user,
279
+ snapshotIndex,
280
+ config.liquidStateProgramId
281
+ );
282
+
283
+ return program.methods
284
+ .takeSnapshot()
285
+ .accountsPartial({ admin, user, payer, userSnapshot })
286
+ .instruction();
287
+ }
288
+
289
+ export interface BuildAdminUpdateUserParams {
290
+ admin: PublicKey;
291
+ user: PublicKey;
292
+ payer: PublicKey;
293
+ newReferrer: PublicKey | null;
294
+ newCashbackMultiplierBps: number | null;
295
+ snapshotIndex: number;
296
+ config: LiquidConfig;
297
+ }
298
+
299
+ /**
300
+ * Builds an adminUpdateUser instruction.
301
+ * Admin updates a user's referrer/multiplier and always takes a snapshot.
302
+ *
303
+ * The caller must provide the current `snapshotIndex` (from `user_properties.snapshot_count`)
304
+ * because the snapshot PDA seed depends on this value and cannot be resolved without a
305
+ * network fetch.
306
+ *
307
+ * @param params - {@link BuildAdminUpdateUserParams}
308
+ * @returns Transaction instruction
309
+ */
310
+ export function buildAdminUpdateUser(
311
+ params: BuildAdminUpdateUserParams
312
+ ): Promise<TransactionInstruction> {
313
+ const {
314
+ admin,
315
+ user,
316
+ payer,
317
+ newReferrer,
318
+ newCashbackMultiplierBps,
319
+ snapshotIndex,
320
+ config,
321
+ } = params;
322
+ const program = getCachedStateProgram(config);
323
+ const [userSnapshot] = getUserSnapshotPDA(
324
+ user,
325
+ snapshotIndex,
326
+ config.liquidStateProgramId
327
+ );
328
+
329
+ return program.methods
330
+ .adminUpdateUser({
331
+ newReferrer: newReferrer ?? null,
332
+ newCashbackMultiplierBps: newCashbackMultiplierBps ?? null,
333
+ })
334
+ .accountsPartial({ admin, user, payer, userSnapshot })
335
+ .instruction();
336
+ }