@vultisig/core-chain 2.37.0 → 2.39.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 (86) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/chains/cosmos/gas.d.ts +9 -0
  3. package/dist/chains/cosmos/gas.d.ts.map +1 -1
  4. package/dist/chains/cosmos/gas.js +9 -0
  5. package/dist/chains/cosmos/gas.js.map +1 -1
  6. package/dist/chains/cosmos/terraClassicTax.d.ts +15 -0
  7. package/dist/chains/cosmos/terraClassicTax.d.ts.map +1 -1
  8. package/dist/chains/cosmos/terraClassicTax.js +14 -0
  9. package/dist/chains/cosmos/terraClassicTax.js.map +1 -1
  10. package/dist/chains/solana/kamino/KaminoServiceError.d.ts +63 -0
  11. package/dist/chains/solana/kamino/KaminoServiceError.d.ts.map +1 -0
  12. package/dist/chains/solana/kamino/KaminoServiceError.js +29 -0
  13. package/dist/chains/solana/kamino/KaminoServiceError.js.map +1 -0
  14. package/dist/chains/solana/kamino/amount.d.ts +141 -0
  15. package/dist/chains/solana/kamino/amount.d.ts.map +1 -0
  16. package/dist/chains/solana/kamino/amount.js +156 -0
  17. package/dist/chains/solana/kamino/amount.js.map +1 -0
  18. package/dist/chains/solana/kamino/api.d.ts +20 -0
  19. package/dist/chains/solana/kamino/api.d.ts.map +1 -0
  20. package/dist/chains/solana/kamino/api.js +59 -0
  21. package/dist/chains/solana/kamino/api.js.map +1 -0
  22. package/dist/chains/solana/kamino/baseUnits.d.ts +23 -0
  23. package/dist/chains/solana/kamino/baseUnits.d.ts.map +1 -0
  24. package/dist/chains/solana/kamino/baseUnits.js +30 -0
  25. package/dist/chains/solana/kamino/baseUnits.js.map +1 -0
  26. package/dist/chains/solana/kamino/config.d.ts +27 -0
  27. package/dist/chains/solana/kamino/config.d.ts.map +1 -0
  28. package/dist/chains/solana/kamino/config.js +27 -0
  29. package/dist/chains/solana/kamino/config.js.map +1 -0
  30. package/dist/chains/solana/kamino/decimal.d.ts +24 -0
  31. package/dist/chains/solana/kamino/decimal.d.ts.map +1 -0
  32. package/dist/chains/solana/kamino/decimal.js +52 -0
  33. package/dist/chains/solana/kamino/decimal.js.map +1 -0
  34. package/dist/chains/solana/kamino/models.d.ts +148 -0
  35. package/dist/chains/solana/kamino/models.d.ts.map +1 -0
  36. package/dist/chains/solana/kamino/models.js +2 -0
  37. package/dist/chains/solana/kamino/models.js.map +1 -0
  38. package/dist/chains/solana/kamino/position.d.ts +79 -0
  39. package/dist/chains/solana/kamino/position.d.ts.map +1 -0
  40. package/dist/chains/solana/kamino/position.js +52 -0
  41. package/dist/chains/solana/kamino/position.js.map +1 -0
  42. package/dist/chains/solana/kamino/rate.d.ts +57 -0
  43. package/dist/chains/solana/kamino/rate.d.ts.map +1 -0
  44. package/dist/chains/solana/kamino/rate.js +88 -0
  45. package/dist/chains/solana/kamino/rate.js.map +1 -0
  46. package/dist/chains/solana/kamino/registry.d.ts +70 -0
  47. package/dist/chains/solana/kamino/registry.d.ts.map +1 -0
  48. package/dist/chains/solana/kamino/registry.js +67 -0
  49. package/dist/chains/solana/kamino/registry.js.map +1 -0
  50. package/dist/chains/solana/kamino/tx/actions.d.ts +22 -0
  51. package/dist/chains/solana/kamino/tx/actions.d.ts.map +1 -0
  52. package/dist/chains/solana/kamino/tx/actions.js +85 -0
  53. package/dist/chains/solana/kamino/tx/actions.js.map +1 -0
  54. package/dist/chains/solana/kamino/tx/computeBudget.d.ts +66 -0
  55. package/dist/chains/solana/kamino/tx/computeBudget.d.ts.map +1 -0
  56. package/dist/chains/solana/kamino/tx/computeBudget.js +73 -0
  57. package/dist/chains/solana/kamino/tx/computeBudget.js.map +1 -0
  58. package/dist/chains/solana/kamino/tx/decode.d.ts +121 -0
  59. package/dist/chains/solana/kamino/tx/decode.d.ts.map +1 -0
  60. package/dist/chains/solana/kamino/tx/decode.js +458 -0
  61. package/dist/chains/solana/kamino/tx/decode.js.map +1 -0
  62. package/dist/chains/solana/kamino/tx/instructions.d.ts +260 -0
  63. package/dist/chains/solana/kamino/tx/instructions.d.ts.map +1 -0
  64. package/dist/chains/solana/kamino/tx/instructions.js +256 -0
  65. package/dist/chains/solana/kamino/tx/instructions.js.map +1 -0
  66. package/dist/chains/solana/kamino/tx/sequence.d.ts +123 -0
  67. package/dist/chains/solana/kamino/tx/sequence.d.ts.map +1 -0
  68. package/dist/chains/solana/kamino/tx/sequence.js +235 -0
  69. package/dist/chains/solana/kamino/tx/sequence.js.map +1 -0
  70. package/dist/chains/solana/kamino/tx/validate.d.ts +138 -0
  71. package/dist/chains/solana/kamino/tx/validate.d.ts.map +1 -0
  72. package/dist/chains/solana/kamino/tx/validate.js +542 -0
  73. package/dist/chains/solana/kamino/tx/validate.js.map +1 -0
  74. package/dist/chains/solana/kamino/tx/wire.d.ts +107 -0
  75. package/dist/chains/solana/kamino/tx/wire.d.ts.map +1 -0
  76. package/dist/chains/solana/kamino/tx/wire.js +274 -0
  77. package/dist/chains/solana/kamino/tx/wire.js.map +1 -0
  78. package/dist/chains/solana/kamino/vaultInfo.d.ts +17 -0
  79. package/dist/chains/solana/kamino/vaultInfo.d.ts.map +1 -0
  80. package/dist/chains/solana/kamino/vaultInfo.js +150 -0
  81. package/dist/chains/solana/kamino/vaultInfo.js.map +1 -0
  82. package/dist/swap/utils/getSwapArrivalStatus/index.d.ts +79 -0
  83. package/dist/swap/utils/getSwapArrivalStatus/index.d.ts.map +1 -0
  84. package/dist/swap/utils/getSwapArrivalStatus/index.js +374 -0
  85. package/dist/swap/utils/getSwapArrivalStatus/index.js.map +1 -0
  86. package/package.json +96 -1
@@ -0,0 +1,542 @@
1
+ import { getAssociatedTokenAddressSync, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token';
2
+ import { PublicKey } from '@solana/web3.js';
3
+ import { kaminoShareAmount } from '../amount.js';
4
+ import { kaminoMaxBaseUnits } from '../baseUnits.js';
5
+ import { kaminoConfig } from '../config.js';
6
+ import { getKaminoVaultDescriptor } from '../registry.js';
7
+ import { anchorU64Argument, anchorU128Argument, computeUnitLimitArgument, computeUnitPriceArgument, deriveKaminoFarmsUserState, hasNoAnchorArgument, isAttributionMemoData, isBuilderComposedProgram, kaminoAllowedProgram, kaminoAllowedPrograms, kaminoFarmsStakeScale, kaminoInstructionAccounts, systemTransferLamports, } from './instructions.js';
8
+ import { expectedKaminoSequence, kaminoInstructionKind, kaminoInstructionKindName, matchKaminoSequence, } from './sequence.js';
9
+ import { isKaminoAccountWritable, isUnsignedSingleSigner, resolveKaminoAccountAddresses, resolveKaminoLookupTables, totalKaminoAccountCount, } from './wire.js';
10
+ /**
11
+ * Shares the farm has to release before the withdraw can burn its amount:
12
+ * the shortfall, and nothing more. Measured against captured builds: a
13
+ * request covered by the unstaked balance is built with no farms
14
+ * instructions at all, and anything above it unstakes exactly the
15
+ * difference.
16
+ */
17
+ export const kaminoUnstakeShares = ({ shares, unstakedShares }) => {
18
+ const shortfall = shares.baseUnits - unstakedShares.baseUnits;
19
+ return kaminoShareAmount(shortfall > 0n ? shortfall : 0n, shares.decimals);
20
+ };
21
+ /**
22
+ * A refusal from the fail-closed validator. Everything it finds is a refusal
23
+ * — nothing downgrades to a warning — and `finding` names the category so
24
+ * callers and tests branch on data rather than message text.
25
+ */
26
+ export class KaminoValidationError extends Error {
27
+ finding;
28
+ constructor(finding, detail) {
29
+ super(`Kamino transaction refused (${finding}): ${detail}`);
30
+ this.name = 'KaminoValidationError';
31
+ this.finding = finding;
32
+ }
33
+ }
34
+ const refuse = (finding, detail) => {
35
+ throw new KaminoValidationError(finding, detail);
36
+ };
37
+ /**
38
+ * The user's associated token accounts for one mint, one per token program.
39
+ * Both token programs are tried because a mint belongs to exactly one and
40
+ * which one is not knowable from the address alone.
41
+ */
42
+ export const kaminoUserTokenAccounts = ({ owner, mint }) => {
43
+ try {
44
+ const ownerKey = new PublicKey(owner);
45
+ const mintKey = new PublicKey(mint);
46
+ return new Set([TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID].map(program => getAssociatedTokenAddressSync(mintKey, ownerKey, false, program).toBase58()));
47
+ }
48
+ catch {
49
+ return new Set();
50
+ }
51
+ };
52
+ const instructionAccounts = (context, position) => Array.from(context.transaction.message.compiledInstructions[position].accountKeyIndexes, index => {
53
+ const address = context.accounts[index];
54
+ return address ?? refuse('accountResolution', `instruction ${position} indexes account ${index}`);
55
+ });
56
+ const requireOwner = (context, account, role) => {
57
+ if (account !== context.intent.owner) {
58
+ refuse('accountMismatch', `${role} is ${account}, expected ${context.intent.owner}`);
59
+ }
60
+ };
61
+ const requireAccount = (account, expected, role) => {
62
+ if (account !== expected)
63
+ refuse('accountMismatch', `${role} is ${account}, expected ${expected}`);
64
+ };
65
+ const requireUserTokenAccount = (context, account, role) => {
66
+ if (!context.userTokenAccounts.has(account))
67
+ refuse('accountNotOwnedByUser', `${role} ${account}`);
68
+ };
69
+ const requireUserShareAccount = (context, account, role) => {
70
+ if (!context.userShareAccounts.has(account))
71
+ refuse('accountNotOwnedByUser', `${role} ${account}`);
72
+ };
73
+ const requireFarm = (context, account) => {
74
+ const farm = context.intent.vault.descriptor.farm;
75
+ if (!farm)
76
+ refuse('instructionNotForOperation', 'farm instruction against a farmless vault');
77
+ else
78
+ requireAccount(account, farm, 'farm');
79
+ };
80
+ const requireFarmUserState = (context, account) => {
81
+ const farm = context.intent.vault.descriptor.farm;
82
+ if (!farm)
83
+ return refuse('instructionNotForOperation', 'farm instruction against a farmless vault');
84
+ const expected = deriveKaminoFarmsUserState({ farm, owner: context.intent.owner });
85
+ if (!expected)
86
+ return refuse('derivationFailed', `the farm user state for ${farm}`);
87
+ requireAccount(account, expected, 'farm user state');
88
+ };
89
+ const requireNoAccounts = (accounts, position, detail) => {
90
+ if (accounts.length > 0)
91
+ refuse('malformedInstruction', `instruction ${position}: ${detail} takes no accounts`);
92
+ };
93
+ const requireU64 = (value, role) => {
94
+ if (value < 0n || value > kaminoMaxBaseUnits)
95
+ refuse('amountOutOfRange', `${role} ${value}`);
96
+ return value;
97
+ };
98
+ const requireAnchorAmount = (data, position, expected, role) => {
99
+ const argument = anchorU64Argument(data);
100
+ if (argument === undefined) {
101
+ return refuse('malformedInstruction', `instruction ${position}: ${role} argument`);
102
+ }
103
+ if (argument !== requireU64(expected, role)) {
104
+ refuse('amountMismatch', `${role} is ${argument}, expected ${expected}`);
105
+ }
106
+ };
107
+ const operationKind = (intent) => 'deposit' in intent.operation ? 'deposit' : 'withdraw';
108
+ const layout = kaminoInstructionAccounts;
109
+ /**
110
+ * The compute unit limit, pinned to the value the app injected. A limit is
111
+ * half of the fee — the network charges `limit × price` — so one raised
112
+ * beyond what the transaction needs is SOL spent for nothing.
113
+ */
114
+ const checkComputeUnitLimit = ({ context, position, data, accounts }) => {
115
+ requireNoAccounts(accounts, position, 'compute budget');
116
+ const limit = computeUnitLimitArgument(data);
117
+ const fee = context.intent.priorityFee;
118
+ if (!fee || limit === undefined) {
119
+ return refuse('malformedInstruction', `instruction ${position}: compute unit limit`);
120
+ }
121
+ if (limit !== fee.unitLimit) {
122
+ refuse('amountMismatch', `compute unit limit is ${limit}, expected ${fee.unitLimit}`);
123
+ }
124
+ };
125
+ /**
126
+ * The price per compute unit, pinned to the value the app injected. This is
127
+ * the half an attacker would inflate: a u64 of micro-lamports, and nothing on
128
+ * chain caps the resulting fee below the payer's balance.
129
+ */
130
+ const checkComputeUnitPrice = ({ context, position, data, accounts }) => {
131
+ requireNoAccounts(accounts, position, 'compute budget');
132
+ const price = computeUnitPriceArgument(data);
133
+ const fee = context.intent.priorityFee;
134
+ if (!fee || price === undefined) {
135
+ return refuse('malformedInstruction', `instruction ${position}: compute unit price`);
136
+ }
137
+ if (price !== fee.unitPriceMicroLamports) {
138
+ refuse('amountMismatch', `compute unit price is ${price}, expected ${fee.unitPriceMicroLamports}`);
139
+ }
140
+ };
141
+ /**
142
+ * A CreateIdempotent may only create one of the vault's two mints' accounts,
143
+ * for the user, at the address derivation says it must have. Creating an
144
+ * account is harmless in itself, but it is also where a third-party
145
+ * destination would first appear.
146
+ */
147
+ const checkCreateTokenAccount = ({ context, accounts, requireMinimumAccounts }) => {
148
+ const { intent } = context;
149
+ requireMinimumAccounts(layout.associatedToken.count);
150
+ requireOwner(context, accounts[layout.associatedToken.payer], 'token account funder');
151
+ requireOwner(context, accounts[layout.associatedToken.wallet], 'token account owner');
152
+ const mint = accounts[layout.associatedToken.mint];
153
+ const { tokenMint, sharesMint } = intent.vault.descriptor;
154
+ if (mint !== tokenMint && mint !== sharesMint) {
155
+ return refuse('accountMismatch', `created token account mint is ${mint}`);
156
+ }
157
+ const tokenProgramId = accounts[layout.associatedToken.tokenProgram];
158
+ const tokenProgram = splTokenProgram(tokenProgramId);
159
+ if (!tokenProgram)
160
+ return refuse('programNotAllowed', `token program ${tokenProgramId}`);
161
+ const derived = getAssociatedTokenAddressSync(new PublicKey(mint), new PublicKey(intent.owner), false, tokenProgram).toBase58();
162
+ requireAccount(accounts[layout.associatedToken.account], derived, 'created token account');
163
+ };
164
+ const splTokenProgram = (programId) => {
165
+ if (programId === kaminoAllowedPrograms.token)
166
+ return TOKEN_PROGRAM_ID;
167
+ if (programId === kaminoAllowedPrograms.token2022)
168
+ return TOKEN_2022_PROGRAM_ID;
169
+ return undefined;
170
+ };
171
+ /**
172
+ * The lamports that fund the wSOL account: the only native SOL movement the
173
+ * operation performs, so both endpoints and the amount are pinned.
174
+ */
175
+ const checkWrapSolTransfer = ({ context, position, data, accounts, requireMinimumAccounts }) => {
176
+ const { intent } = context;
177
+ requireMinimumAccounts(layout.systemTransfer.count);
178
+ const lamports = systemTransferLamports(data);
179
+ if (lamports === undefined) {
180
+ return refuse('malformedInstruction', `instruction ${position}: system transfer`);
181
+ }
182
+ requireOwner(context, accounts[layout.systemTransfer.source], 'SOL transfer source');
183
+ requireUserTokenAccount(context, accounts[layout.systemTransfer.destination], 'SOL transfer destination');
184
+ if (!('deposit' in intent.operation)) {
185
+ return refuse('instructionNotForOperation', 'SOL wrap on a withdraw');
186
+ }
187
+ const expected = requireU64(intent.operation.deposit.baseUnits, 'deposit amount');
188
+ if (lamports !== expected) {
189
+ refuse('amountMismatch', `wrapped SOL amount is ${lamports}, expected ${expected}`);
190
+ }
191
+ };
192
+ const checkSyncNative = ({ context, accounts, requireMinimumAccounts }) => {
193
+ requireMinimumAccounts(1);
194
+ requireUserTokenAccount(context, accounts[0], 'wrapped SOL account');
195
+ };
196
+ /**
197
+ * Closing a token account sends its remaining lamports somewhere. Both the
198
+ * account being closed and where its rent lands have to be the user's.
199
+ */
200
+ const checkCloseTokenAccount = ({ context, accounts, requireMinimumAccounts }) => {
201
+ requireMinimumAccounts(layout.closeAccount.count);
202
+ const closed = accounts[layout.closeAccount.account];
203
+ if (!context.userTokenAccounts.has(closed) && !context.userShareAccounts.has(closed)) {
204
+ return refuse('accountNotOwnedByUser', `closed token account ${closed}`);
205
+ }
206
+ requireOwner(context, accounts[layout.closeAccount.destination], 'closed account rent destination');
207
+ requireOwner(context, accounts[layout.closeAccount.authority], 'closed account authority');
208
+ };
209
+ const checkKvaultDeposit = ({ context, position, data, accounts, requireMinimumAccounts }) => {
210
+ const { intent } = context;
211
+ requireMinimumAccounts(layout.kvaultDeposit.minimumCount);
212
+ if (!('deposit' in intent.operation)) {
213
+ return refuse('instructionNotForOperation', 'vault deposit on a withdraw');
214
+ }
215
+ const { address, tokenMint, sharesMint } = intent.vault.descriptor;
216
+ requireOwner(context, accounts[layout.kvaultDeposit.user], 'deposit authority');
217
+ requireAccount(accounts[layout.kvaultDeposit.vault], address, 'vault');
218
+ requireAccount(accounts[layout.kvaultDeposit.tokenMint], tokenMint, 'deposit token mint');
219
+ requireAccount(accounts[layout.kvaultDeposit.sharesMint], sharesMint, 'deposit shares mint');
220
+ requireUserTokenAccount(context, accounts[layout.kvaultDeposit.userTokenAccount], 'deposit source');
221
+ requireUserShareAccount(context, accounts[layout.kvaultDeposit.userShareAccount], 'deposit share destination');
222
+ requireAnchorAmount(data, position, intent.operation.deposit.baseUnits, 'deposit amount');
223
+ };
224
+ const checkKvaultWithdraw = ({ context, position, data, accounts, requireMinimumAccounts }) => {
225
+ const { intent } = context;
226
+ requireMinimumAccounts(layout.kvaultWithdraw.minimumCount);
227
+ if (!('withdraw' in intent.operation)) {
228
+ return refuse('instructionNotForOperation', 'vault withdraw on a deposit');
229
+ }
230
+ const { address, tokenMint, sharesMint } = intent.vault.descriptor;
231
+ requireOwner(context, accounts[layout.kvaultWithdraw.user], 'withdraw authority');
232
+ requireAccount(accounts[layout.kvaultWithdraw.vault], address, 'vault');
233
+ requireAccount(accounts[layout.kvaultWithdraw.tokenMint], tokenMint, 'withdraw token mint');
234
+ requireAccount(accounts[layout.kvaultWithdraw.sharesMint], sharesMint, 'withdraw shares mint');
235
+ requireUserTokenAccount(context, accounts[layout.kvaultWithdraw.userTokenAccount], 'withdraw destination');
236
+ requireUserShareAccount(context, accounts[layout.kvaultWithdraw.userShareAccount], 'withdraw share source');
237
+ // Shares, not tokens. The API takes the same `amount` field for both actions
238
+ // with inverted units, and an amount above the user's balance is silently
239
+ // rewritten to u64::MAX — withdraw everything — so this is the check that
240
+ // stands between a partial exit and a full one.
241
+ requireAnchorAmount(data, position, intent.operation.withdraw.shares.baseUnits, 'withdraw share amount');
242
+ };
243
+ const checkFarmsInitializeUser = ({ context, accounts, requireMinimumAccounts }) => {
244
+ requireMinimumAccounts(layout.farmsInitializeUser.minimumCount);
245
+ requireOwner(context, accounts[layout.farmsInitializeUser.authority], 'farm user authority');
246
+ requireFarm(context, accounts[layout.farmsInitializeUser.farm]);
247
+ };
248
+ /**
249
+ * The stake that makes the deposit's shares invisible in the wallet. It must
250
+ * move the user's own shares into this vault's own farm — a farm belonging to
251
+ * another vault would park the position somewhere the app never reads.
252
+ */
253
+ const checkFarmsStake = ({ context, position, data, accounts, requireMinimumAccounts }) => {
254
+ requireMinimumAccounts(layout.farmsStake.minimumCount);
255
+ requireOwner(context, accounts[layout.farmsStake.owner], 'stake authority');
256
+ requireFarm(context, accounts[layout.farmsStake.farm]);
257
+ requireUserShareAccount(context, accounts[layout.farmsStake.userShareAccount], 'stake source');
258
+ requireAccount(accounts[layout.farmsStake.sharesMint], context.intent.vault.descriptor.sharesMint, 'stake shares mint');
259
+ // Kamino stakes the whole share balance rather than the freshly minted
260
+ // amount, so the argument is the u64 sentinel. A different value is a
261
+ // behaviour change, not a variation, and is worth stopping on.
262
+ const argument = anchorU64Argument(data);
263
+ if (argument === undefined) {
264
+ return refuse('malformedInstruction', `instruction ${position}: farms stake argument`);
265
+ }
266
+ if (argument !== kaminoMaxBaseUnits) {
267
+ refuse('amountMismatch', `staked share amount is ${argument}, expected ${kaminoMaxBaseUnits}`);
268
+ }
269
+ };
270
+ /**
271
+ * The release of staked shares from the farm, and the one amount in this
272
+ * feature that is not a u64: a u128 scaled by 10^18, checked in exact bigint
273
+ * arithmetic with no division and no narrowing.
274
+ *
275
+ * Pinned to the exact shortfall rather than bounded above by it: a LARGER
276
+ * unstake would release shares the transaction then leaves sitting out of the
277
+ * farm and no longer earning — a real loss, silent, and invisible on the
278
+ * verify screen; a smaller one simply cannot settle.
279
+ */
280
+ const checkFarmsUnstake = ({ context, position, data, accounts, requireMinimumAccounts }) => {
281
+ const { intent } = context;
282
+ requireMinimumAccounts(layout.farmsUnstake.minimumCount);
283
+ if (!('withdraw' in intent.operation)) {
284
+ return refuse('instructionNotForOperation', 'farm unstake on a deposit');
285
+ }
286
+ requireOwner(context, accounts[layout.farmsUnstake.owner], 'unstake authority');
287
+ requireFarm(context, accounts[layout.farmsUnstake.farm]);
288
+ requireFarmUserState(context, accounts[layout.farmsUnstake.userState]);
289
+ const scaled = anchorU128Argument(data);
290
+ if (scaled === undefined) {
291
+ return refuse('malformedInstruction', `instruction ${position}: farms unstake argument`);
292
+ }
293
+ const expected = kaminoUnstakeShares(intent.operation.withdraw).baseUnits * kaminoFarmsStakeScale;
294
+ if (scaled !== expected) {
295
+ refuse('amountMismatch', `unstaked share amount is ${scaled}, expected ${expected}`);
296
+ }
297
+ };
298
+ /**
299
+ * Moving what the unstake released into the user's own share account. It
300
+ * takes no argument — it always moves the whole released balance — so
301
+ * everything checkable here is an account, and the one that matters is the
302
+ * destination: the vault withdraw burns from that same account, and a
303
+ * destination belonging to anyone else would hand the position over.
304
+ */
305
+ const checkFarmsWithdrawUnstakedDeposits = ({ context, position, data, accounts, requireMinimumAccounts, }) => {
306
+ requireMinimumAccounts(layout.farmsWithdrawUnstakedDeposits.minimumCount);
307
+ if (!('withdraw' in context.intent.operation)) {
308
+ return refuse('instructionNotForOperation', 'farm unstaked share withdrawal on a deposit');
309
+ }
310
+ if (!hasNoAnchorArgument(data)) {
311
+ return refuse('malformedInstruction', `instruction ${position}: farms withdrawUnstakedDeposits takes no argument`);
312
+ }
313
+ requireOwner(context, accounts[layout.farmsWithdrawUnstakedDeposits.owner], 'unstaked share withdrawal authority');
314
+ requireFarm(context, accounts[layout.farmsWithdrawUnstakedDeposits.farm]);
315
+ requireFarmUserState(context, accounts[layout.farmsWithdrawUnstakedDeposits.userState]);
316
+ requireUserShareAccount(context, accounts[layout.farmsWithdrawUnstakedDeposits.userShareAccount], 'unstaked share destination');
317
+ };
318
+ /**
319
+ * The sequence already refuses any other payload under the Memo program, so
320
+ * reaching here with different bytes is impossible — which is exactly why it
321
+ * is asserted rather than assumed: the tag is the only reason this program is
322
+ * allow-listed at all. No accounts, either: a memo listing accounts is the
323
+ * Memo program attesting that they signed, and attribution is not an
324
+ * attestation.
325
+ */
326
+ const checkAttributionMemo = ({ position, data, accounts }) => {
327
+ requireNoAccounts(accounts, position, 'attribution memo');
328
+ if (!isAttributionMemoData(data)) {
329
+ refuse('malformedInstruction', `instruction ${position}: attribution memo`);
330
+ }
331
+ };
332
+ /**
333
+ * The account and amount checks each matched instruction must pass, one entry
334
+ * per template step. A record rather than a switch so every check stands on
335
+ * its own, and so a template step added without a check is a type error
336
+ * rather than an instruction that silently goes unchecked.
337
+ */
338
+ const instructionChecks = {
339
+ computeUnitLimit: checkComputeUnitLimit,
340
+ computeUnitPrice: checkComputeUnitPrice,
341
+ createTokenAccount: checkCreateTokenAccount,
342
+ wrapSolTransfer: checkWrapSolTransfer,
343
+ syncNative: checkSyncNative,
344
+ closeTokenAccount: checkCloseTokenAccount,
345
+ kvaultDeposit: checkKvaultDeposit,
346
+ kvaultWithdraw: checkKvaultWithdraw,
347
+ farmsInitializeUser: checkFarmsInitializeUser,
348
+ farmsStake: checkFarmsStake,
349
+ farmsUnstake: checkFarmsUnstake,
350
+ farmsWithdrawUnstakedDeposits: checkFarmsWithdrawUnstakedDeposits,
351
+ attributionMemo: checkAttributionMemo,
352
+ };
353
+ const validateInstruction = (context, kind, position) => {
354
+ const accounts = instructionAccounts(context, position);
355
+ instructionChecks[kind]({
356
+ context,
357
+ position,
358
+ data: context.transaction.message.compiledInstructions[position].data,
359
+ accounts,
360
+ requireMinimumAccounts: minimum => {
361
+ if (accounts.length < minimum) {
362
+ refuse('malformedInstruction', `instruction ${position}: ${kaminoInstructionKindName[kind]} needs ${minimum} accounts`);
363
+ }
364
+ },
365
+ });
366
+ };
367
+ /**
368
+ * Two rules, together covering "no unexplained writes". A writable account
369
+ * nothing references is a loaded write privilege with no purpose, which is
370
+ * not a shape any legitimate builder emits. And an account that a
371
+ * builder-composed instruction can write to has to be one this operation can
372
+ * name — the user, the vault, its two mints, or the user's own token accounts
373
+ * for them. A drain has to write somewhere, and outside the `kvault`/`farms`
374
+ * programs there is nowhere left for it to write.
375
+ */
376
+ const validateWritableAccounts = (context) => {
377
+ const { transaction, accounts, programs } = context;
378
+ const instructions = transaction.message.compiledInstructions;
379
+ const referenced = new Set();
380
+ for (const instruction of instructions) {
381
+ for (const index of instruction.accountKeyIndexes)
382
+ referenced.add(index);
383
+ }
384
+ for (let index = 0; index < accounts.length; index++) {
385
+ if (isKaminoAccountWritable({ transaction, index }) && !referenced.has(index)) {
386
+ refuse('unreferencedWritableAccount', accounts[index]);
387
+ }
388
+ }
389
+ for (let position = 0; position < instructions.length; position++) {
390
+ const program = programs[position];
391
+ if (!program || !isBuilderComposedProgram(program))
392
+ continue;
393
+ for (const index of instructions[position].accountKeyIndexes) {
394
+ if (!isKaminoAccountWritable({ transaction, index }))
395
+ continue;
396
+ const account = accounts[index];
397
+ if (!context.explainedAccounts.has(account)) {
398
+ refuse('unattributableWritableAccount', `${program} writes ${account}`);
399
+ }
400
+ }
401
+ }
402
+ };
403
+ /**
404
+ * Fail-closed validation of a Kamino-built Solana transaction.
405
+ *
406
+ * Kamino builds the transaction and the app signs the bytes verbatim, so
407
+ * between an API response and a signature over it there is only this. It runs
408
+ * before simulation and before keysign, and every finding is a refusal.
409
+ *
410
+ * What it establishes, in layers: the shape (one unsigned signature, paid by
411
+ * the user, every lookup table the vault's own); the programs (every
412
+ * `programIdIndex` resolves to an allow-listed program — the outer bound on
413
+ * what the signature can authorise); the sequence (the instruction list
414
+ * matches the shape this operation produces, so a new instruction fails
415
+ * closed); the identity of every account that decides where money goes,
416
+ * compared against values the app already had — registry and local
417
+ * derivations, never the response, because checking a transaction the API
418
+ * built against metadata the same API supplied would be circular; the amounts
419
+ * (the kvault `u64` equals what the user was shown, the priority fee equals
420
+ * what the app injected); and the writable accounts (no unexplained writes).
421
+ *
422
+ * What it does not establish is what the `kvault` and `farms` programs do
423
+ * with the accounts they are handed. That is the protocol, and choosing to
424
+ * trust it is what the registry allow-list expresses.
425
+ *
426
+ * Pure — lookup tables arrive resolved, so tests can drive it against pinned
427
+ * contents. `validateKaminoTransactionOnline` is the fetching entry point.
428
+ */
429
+ export const validateKaminoTransaction = ({ transaction, intent, lookupTables, }) => {
430
+ const vaultAddress = intent.vault.descriptor.address;
431
+ const registered = getKaminoVaultDescriptor(vaultAddress);
432
+ if (!registered)
433
+ return refuse('vaultNotAllowed', vaultAddress);
434
+ // The registry's own object, not a value-equal copy. Every value the checks
435
+ // below rest on — the mints, their decimals, the farm — lives on this
436
+ // descriptor, so accepting one that merely *claims* an allow-listed address
437
+ // would hand an attacker the pinning itself. Identity makes the registry
438
+ // the only possible source of a vault's identity, structurally rather than
439
+ // by convention.
440
+ if (registered !== intent.vault.descriptor) {
441
+ return refuse('vaultDescriptorMismatch', vaultAddress);
442
+ }
443
+ if (!isUnsignedSingleSigner(transaction, intent.owner)) {
444
+ return refuse('transactionShape', 'not an unsigned single-signer transaction paid by the owner');
445
+ }
446
+ // Every table the transaction reads from must be the vault's own. A table
447
+ // decides which pubkey an account index names, so a foreign one is how an
448
+ // account substitution would be hidden. Zero tables is allowed — then every
449
+ // account is a static key and there is nothing to hide behind.
450
+ const lookups = transaction.message.addressTableLookups;
451
+ if (lookups.length > 1)
452
+ return refuse('unexpectedLookupTable', `${lookups.length} lookup tables`);
453
+ for (const lookup of lookups) {
454
+ const address = lookup.accountKey.toBase58();
455
+ if (address !== intent.vault.lookupTable) {
456
+ return refuse('unexpectedLookupTable', `${address}, expected ${intent.vault.lookupTable}`);
457
+ }
458
+ }
459
+ const accounts = resolveKaminoAccountAddresses({ transaction, lookupTables });
460
+ if (!accounts || accounts.length !== totalKaminoAccountCount(transaction)) {
461
+ return refuse('accountResolution', 'lookup tables do not resolve every account index');
462
+ }
463
+ const instructions = transaction.message.compiledInstructions;
464
+ const programs = instructions.map(instruction => kaminoAllowedProgram(accounts[instruction.programIdIndex]));
465
+ for (let position = 0; position < programs.length; position++) {
466
+ if (!programs[position]) {
467
+ return refuse('programNotAllowed', `instruction ${position} invokes ${accounts[instructions[position].programIdIndex]}`);
468
+ }
469
+ }
470
+ // Before injection the app has chosen no fee and written no memo, so either
471
+ // arriving in the response came from the builder — and each is named
472
+ // separately so the refusal says what is actually wrong, rather than
473
+ // reading as a sequencing error.
474
+ if (!intent.priorityFee && programs.includes('computeBudget')) {
475
+ return refuse('unexpectedPriorityFee', 'compute budget instruction before injection');
476
+ }
477
+ if (!intent.carriesAttributionMemo && programs.includes('memo')) {
478
+ return refuse('unexpectedMemo', 'memo instruction before injection');
479
+ }
480
+ const userTokenAccounts = kaminoUserTokenAccounts({ owner: intent.owner, mint: intent.vault.descriptor.tokenMint });
481
+ const userShareAccounts = kaminoUserTokenAccounts({ owner: intent.owner, mint: intent.vault.descriptor.sharesMint });
482
+ if (userTokenAccounts.size === 0 || userShareAccounts.size === 0) {
483
+ return refuse('derivationFailed', "the user's associated token accounts");
484
+ }
485
+ const context = {
486
+ intent,
487
+ transaction,
488
+ accounts,
489
+ programs,
490
+ userTokenAccounts,
491
+ userShareAccounts,
492
+ explainedAccounts: new Set([
493
+ ...userTokenAccounts,
494
+ ...userShareAccounts,
495
+ intent.owner,
496
+ intent.vault.descriptor.address,
497
+ intent.vault.descriptor.tokenMint,
498
+ intent.vault.descriptor.sharesMint,
499
+ ]),
500
+ };
501
+ const kinds = instructions.map((instruction, position) => kaminoInstructionKind(programs[position], instruction.data));
502
+ const steps = expectedKaminoSequence({
503
+ operation: operationKind(intent),
504
+ isWrappedSolVault: intent.vault.descriptor.tokenMint === kaminoConfig.wrappedSolMint,
505
+ hasFarm: intent.vault.descriptor.farm !== undefined,
506
+ hasPriorityFee: intent.priorityFee !== undefined,
507
+ hasAttributionMemo: intent.carriesAttributionMemo,
508
+ // This device read the position, so it knows which of the two withdraw
509
+ // shapes it asked for and says so. Never 'unknown' here: accepting either
510
+ // shape would let a transaction that unstakes shares pass as one that was
511
+ // not supposed to touch the farm.
512
+ farmUnstake: 'withdraw' in intent.operation
513
+ ? kaminoUnstakeShares(intent.operation.withdraw).baseUnits > 0n
514
+ ? 'required'
515
+ : 'forbidden'
516
+ : 'forbidden',
517
+ });
518
+ const outcome = matchKaminoSequence(kinds, steps);
519
+ if ('mismatch' in outcome) {
520
+ const { mismatch } = outcome;
521
+ if ('unexpectedInstruction' in mismatch) {
522
+ return refuse('unexpectedInstruction', `instruction ${mismatch.unexpectedInstruction.index}`);
523
+ }
524
+ return refuse('missingInstruction', 'missingInstruction' in mismatch ? mismatch.missingInstruction : mismatch.incompleteInstructionPair);
525
+ }
526
+ outcome.matched.forEach((kind, position) => validateInstruction(context, kind, position));
527
+ validateWritableAccounts(context);
528
+ };
529
+ /**
530
+ * Resolves the transaction's address lookup tables from the RPC, then runs
531
+ * the pure validator against them.
532
+ *
533
+ * Rejects with `KaminoValidationError` for a refusal of the transaction, and
534
+ * with `KaminoWireError` when the lookup tables could not be resolved at all
535
+ * (missing table, stalled node past the read deadline, transport failure) —
536
+ * callers must not assume every rejection carries a `finding`.
537
+ */
538
+ export const validateKaminoTransactionOnline = async ({ transaction, intent, }) => {
539
+ const lookupTables = await resolveKaminoLookupTables(transaction);
540
+ validateKaminoTransaction({ transaction, intent, lookupTables });
541
+ };
542
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/solana/kamino/tx/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAC1G,OAAO,EAAE,SAAS,EAAwB,MAAM,iBAAiB,CAAA;AAEjE,OAAO,EAAqB,iBAAiB,EAAqB,MAAM,WAAW,CAAA;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EAExB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,sBAAsB,EAEtB,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,6BAA6B,EAC7B,yB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