@epicentral/sos-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.
- package/LICENSE +21 -0
- package/README.md +239 -0
- package/accounts/fetchers.ts +140 -0
- package/accounts/list.ts +152 -0
- package/accounts/pdas.ts +308 -0
- package/client/lookup-table.ts +32 -0
- package/client/program.ts +13 -0
- package/client/types.ts +8 -0
- package/generated/accounts/collateralPool.ts +217 -0
- package/generated/accounts/config.ts +156 -0
- package/generated/accounts/dualSourceContract.ts +235 -0
- package/generated/accounts/escrowState.ts +183 -0
- package/generated/accounts/index.ts +24 -0
- package/generated/accounts/lenderPosition.ts +211 -0
- package/generated/accounts/liquidityRouter.ts +223 -0
- package/generated/accounts/makerCollateralShare.ts +229 -0
- package/generated/accounts/makerPoolShare.ts +203 -0
- package/generated/accounts/marketDataAccount.ts +176 -0
- package/generated/accounts/optionAccount.ts +247 -0
- package/generated/accounts/optionPool.ts +253 -0
- package/generated/accounts/poolLoan.ts +220 -0
- package/generated/accounts/positionAccount.ts +187 -0
- package/generated/accounts/priceUpdateV2.ts +163 -0
- package/generated/accounts/vault.ts +304 -0
- package/generated/accounts/writerPosition.ts +297 -0
- package/generated/errors/index.ts +9 -0
- package/generated/errors/optionProgram.ts +392 -0
- package/generated/index.ts +13 -0
- package/generated/instructions/acceptAdmin.ts +230 -0
- package/generated/instructions/autoExerciseAllExpired.ts +523 -0
- package/generated/instructions/autoExerciseExpired.ts +623 -0
- package/generated/instructions/borrowFromPool.ts +554 -0
- package/generated/instructions/buyFromPool.ts +684 -0
- package/generated/instructions/claimPremium.ts +377 -0
- package/generated/instructions/closeLongToPool.ts +716 -0
- package/generated/instructions/closeOption.ts +235 -0
- package/generated/instructions/createEscrowV2.ts +518 -0
- package/generated/instructions/createLiquidityRouter.ts +361 -0
- package/generated/instructions/depositCollateral.ts +624 -0
- package/generated/instructions/depositToPool.ts +497 -0
- package/generated/instructions/depositToPosition.ts +429 -0
- package/generated/instructions/index.ts +45 -0
- package/generated/instructions/initCollateralPool.ts +513 -0
- package/generated/instructions/initConfig.ts +279 -0
- package/generated/instructions/initOptionPool.ts +587 -0
- package/generated/instructions/initializeMarketData.ts +359 -0
- package/generated/instructions/liquidateWriterPosition.ts +592 -0
- package/generated/instructions/omlpCreateVault.ts +547 -0
- package/generated/instructions/omlpTakeOfferWithFailover.ts +606 -0
- package/generated/instructions/omlpUpdateMaxLeverage.ts +304 -0
- package/generated/instructions/omlpUpdateProtocolFee.ts +304 -0
- package/generated/instructions/omlpUpdateSupplyLimit.ts +304 -0
- package/generated/instructions/optionExercise.ts +540 -0
- package/generated/instructions/optionMint.ts +1349 -0
- package/generated/instructions/optionValidate.ts +255 -0
- package/generated/instructions/repayPoolLoan.ts +499 -0
- package/generated/instructions/repayPoolLoanFromCollateral.ts +514 -0
- package/generated/instructions/settleMakerCollateral.ts +472 -0
- package/generated/instructions/syncWriterPosition.ts +206 -0
- package/generated/instructions/transferAdmin.ts +245 -0
- package/generated/instructions/unwindWriterUnsold.ts +668 -0
- package/generated/instructions/updateImpliedVolatility.ts +226 -0
- package/generated/instructions/updateMarketData.ts +315 -0
- package/generated/instructions/withdrawFromPool.ts +429 -0
- package/generated/instructions/withdrawFromPosition.ts +405 -0
- package/generated/instructions/writeToPool.ts +594 -0
- package/generated/programs/index.ts +9 -0
- package/generated/programs/optionProgram.ts +832 -0
- package/generated/shared/index.ts +164 -0
- package/generated/types/borrowedFromSAP1.ts +75 -0
- package/generated/types/borrowedFromSAP2.ts +83 -0
- package/generated/types/failoverTriggered.ts +85 -0
- package/generated/types/impliedVolatilityUpdated.ts +73 -0
- package/generated/types/index.ts +32 -0
- package/generated/types/liquidationExecuted.ts +73 -0
- package/generated/types/liquidityMetrics.ts +69 -0
- package/generated/types/liquidityRouterCreated.ts +79 -0
- package/generated/types/marketDataInitialized.ts +61 -0
- package/generated/types/marketDataUpdated.ts +69 -0
- package/generated/types/optionClosed.ts +56 -0
- package/generated/types/optionExercised.ts +62 -0
- package/generated/types/optionExpired.ts +49 -0
- package/generated/types/optionMinted.ts +78 -0
- package/generated/types/optionType.ts +38 -0
- package/generated/types/optionValidated.ts +82 -0
- package/generated/types/poolLoanCreated.ts +74 -0
- package/generated/types/poolLoanRepaid.ts +74 -0
- package/generated/types/positionDeposited.ts +73 -0
- package/generated/types/positionWithdrawn.ts +81 -0
- package/generated/types/priceFeedMessage.ts +117 -0
- package/generated/types/protocolFeeUpdated.ts +69 -0
- package/generated/types/sap2Provider.ts +38 -0
- package/generated/types/vaultCreated.ts +60 -0
- package/generated/types/verificationLevel.ts +95 -0
- package/index.ts +25 -0
- package/long/builders.ts +126 -0
- package/long/exercise.ts +49 -0
- package/long/quotes.ts +48 -0
- package/omlp/builders.ts +74 -0
- package/omlp/service.ts +94 -0
- package/package.json +22 -0
- package/shared/amounts.ts +32 -0
- package/shared/errors.ts +12 -0
- package/shared/remaining-accounts.ts +41 -0
- package/shared/transactions.ts +49 -0
- package/short/builders.ts +268 -0
- package/short/claim-premium.ts +37 -0
- package/short/close-option.ts +34 -0
- package/short/pool.ts +224 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,716 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
combineCodec,
|
|
11
|
+
fixDecoderSize,
|
|
12
|
+
fixEncoderSize,
|
|
13
|
+
getAddressEncoder,
|
|
14
|
+
getBytesDecoder,
|
|
15
|
+
getBytesEncoder,
|
|
16
|
+
getProgramDerivedAddress,
|
|
17
|
+
getStructDecoder,
|
|
18
|
+
getStructEncoder,
|
|
19
|
+
getU64Decoder,
|
|
20
|
+
getU64Encoder,
|
|
21
|
+
transformEncoder,
|
|
22
|
+
type AccountMeta,
|
|
23
|
+
type AccountSignerMeta,
|
|
24
|
+
type Address,
|
|
25
|
+
type FixedSizeCodec,
|
|
26
|
+
type FixedSizeDecoder,
|
|
27
|
+
type FixedSizeEncoder,
|
|
28
|
+
type Instruction,
|
|
29
|
+
type InstructionWithAccounts,
|
|
30
|
+
type InstructionWithData,
|
|
31
|
+
type ReadonlyAccount,
|
|
32
|
+
type ReadonlyUint8Array,
|
|
33
|
+
type TransactionSigner,
|
|
34
|
+
type WritableAccount,
|
|
35
|
+
type WritableSignerAccount,
|
|
36
|
+
} from "@solana/kit";
|
|
37
|
+
import { OPTION_PROGRAM_PROGRAM_ADDRESS } from "../programs";
|
|
38
|
+
import {
|
|
39
|
+
expectAddress,
|
|
40
|
+
getAccountMetaFactory,
|
|
41
|
+
type ResolvedAccount,
|
|
42
|
+
} from "../shared";
|
|
43
|
+
|
|
44
|
+
export const CLOSE_LONG_TO_POOL_DISCRIMINATOR = new Uint8Array([
|
|
45
|
+
72, 117, 94, 238, 111, 113, 243, 91,
|
|
46
|
+
]);
|
|
47
|
+
|
|
48
|
+
export function getCloseLongToPoolDiscriminatorBytes() {
|
|
49
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
50
|
+
CLOSE_LONG_TO_POOL_DISCRIMINATOR,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type CloseLongToPoolInstruction<
|
|
55
|
+
TProgram extends string = typeof OPTION_PROGRAM_PROGRAM_ADDRESS,
|
|
56
|
+
TAccountOptionPool extends string | AccountMeta<string> = string,
|
|
57
|
+
TAccountOptionAccount extends string | AccountMeta<string> = string,
|
|
58
|
+
TAccountCollateralPool extends string | AccountMeta<string> = string,
|
|
59
|
+
TAccountUnderlyingMint extends string | AccountMeta<string> = string,
|
|
60
|
+
TAccountLongMint extends string | AccountMeta<string> = string,
|
|
61
|
+
TAccountEscrowLongAccount extends string | AccountMeta<string> = string,
|
|
62
|
+
TAccountPremiumVault extends string | AccountMeta<string> = string,
|
|
63
|
+
TAccountMarketData extends string | AccountMeta<string> = string,
|
|
64
|
+
TAccountPriceUpdate extends string | AccountMeta<string> = string,
|
|
65
|
+
TAccountBuyerPosition extends string | AccountMeta<string> = string,
|
|
66
|
+
TAccountBuyerLongAccount extends string | AccountMeta<string> = string,
|
|
67
|
+
TAccountBuyerPayoutAccount extends string | AccountMeta<string> = string,
|
|
68
|
+
TAccountCollateralVault extends string | AccountMeta<string> = string,
|
|
69
|
+
TAccountOmlpVault extends string | AccountMeta<string> = string,
|
|
70
|
+
TAccountBuyer extends string | AccountMeta<string> = string,
|
|
71
|
+
TAccountTokenProgram extends string | AccountMeta<string> =
|
|
72
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
|
73
|
+
TAccountSystemProgram extends string | AccountMeta<string> =
|
|
74
|
+
"11111111111111111111111111111111",
|
|
75
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
76
|
+
> = Instruction<TProgram> &
|
|
77
|
+
InstructionWithData<ReadonlyUint8Array> &
|
|
78
|
+
InstructionWithAccounts<
|
|
79
|
+
[
|
|
80
|
+
TAccountOptionPool extends string
|
|
81
|
+
? WritableAccount<TAccountOptionPool>
|
|
82
|
+
: TAccountOptionPool,
|
|
83
|
+
TAccountOptionAccount extends string
|
|
84
|
+
? WritableAccount<TAccountOptionAccount>
|
|
85
|
+
: TAccountOptionAccount,
|
|
86
|
+
TAccountCollateralPool extends string
|
|
87
|
+
? WritableAccount<TAccountCollateralPool>
|
|
88
|
+
: TAccountCollateralPool,
|
|
89
|
+
TAccountUnderlyingMint extends string
|
|
90
|
+
? ReadonlyAccount<TAccountUnderlyingMint>
|
|
91
|
+
: TAccountUnderlyingMint,
|
|
92
|
+
TAccountLongMint extends string
|
|
93
|
+
? WritableAccount<TAccountLongMint>
|
|
94
|
+
: TAccountLongMint,
|
|
95
|
+
TAccountEscrowLongAccount extends string
|
|
96
|
+
? WritableAccount<TAccountEscrowLongAccount>
|
|
97
|
+
: TAccountEscrowLongAccount,
|
|
98
|
+
TAccountPremiumVault extends string
|
|
99
|
+
? WritableAccount<TAccountPremiumVault>
|
|
100
|
+
: TAccountPremiumVault,
|
|
101
|
+
TAccountMarketData extends string
|
|
102
|
+
? ReadonlyAccount<TAccountMarketData>
|
|
103
|
+
: TAccountMarketData,
|
|
104
|
+
TAccountPriceUpdate extends string
|
|
105
|
+
? ReadonlyAccount<TAccountPriceUpdate>
|
|
106
|
+
: TAccountPriceUpdate,
|
|
107
|
+
TAccountBuyerPosition extends string
|
|
108
|
+
? WritableAccount<TAccountBuyerPosition>
|
|
109
|
+
: TAccountBuyerPosition,
|
|
110
|
+
TAccountBuyerLongAccount extends string
|
|
111
|
+
? WritableAccount<TAccountBuyerLongAccount>
|
|
112
|
+
: TAccountBuyerLongAccount,
|
|
113
|
+
TAccountBuyerPayoutAccount extends string
|
|
114
|
+
? WritableAccount<TAccountBuyerPayoutAccount>
|
|
115
|
+
: TAccountBuyerPayoutAccount,
|
|
116
|
+
TAccountCollateralVault extends string
|
|
117
|
+
? WritableAccount<TAccountCollateralVault>
|
|
118
|
+
: TAccountCollateralVault,
|
|
119
|
+
TAccountOmlpVault extends string
|
|
120
|
+
? WritableAccount<TAccountOmlpVault>
|
|
121
|
+
: TAccountOmlpVault,
|
|
122
|
+
TAccountBuyer extends string
|
|
123
|
+
? WritableSignerAccount<TAccountBuyer> &
|
|
124
|
+
AccountSignerMeta<TAccountBuyer>
|
|
125
|
+
: TAccountBuyer,
|
|
126
|
+
TAccountTokenProgram extends string
|
|
127
|
+
? ReadonlyAccount<TAccountTokenProgram>
|
|
128
|
+
: TAccountTokenProgram,
|
|
129
|
+
TAccountSystemProgram extends string
|
|
130
|
+
? ReadonlyAccount<TAccountSystemProgram>
|
|
131
|
+
: TAccountSystemProgram,
|
|
132
|
+
...TRemainingAccounts,
|
|
133
|
+
]
|
|
134
|
+
>;
|
|
135
|
+
|
|
136
|
+
export type CloseLongToPoolInstructionData = {
|
|
137
|
+
discriminator: ReadonlyUint8Array;
|
|
138
|
+
quantity: bigint;
|
|
139
|
+
minPayoutAmount: bigint;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export type CloseLongToPoolInstructionDataArgs = {
|
|
143
|
+
quantity: number | bigint;
|
|
144
|
+
minPayoutAmount: number | bigint;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export function getCloseLongToPoolInstructionDataEncoder(): FixedSizeEncoder<CloseLongToPoolInstructionDataArgs> {
|
|
148
|
+
return transformEncoder(
|
|
149
|
+
getStructEncoder([
|
|
150
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
151
|
+
["quantity", getU64Encoder()],
|
|
152
|
+
["minPayoutAmount", getU64Encoder()],
|
|
153
|
+
]),
|
|
154
|
+
(value) => ({ ...value, discriminator: CLOSE_LONG_TO_POOL_DISCRIMINATOR }),
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function getCloseLongToPoolInstructionDataDecoder(): FixedSizeDecoder<CloseLongToPoolInstructionData> {
|
|
159
|
+
return getStructDecoder([
|
|
160
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
161
|
+
["quantity", getU64Decoder()],
|
|
162
|
+
["minPayoutAmount", getU64Decoder()],
|
|
163
|
+
]);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function getCloseLongToPoolInstructionDataCodec(): FixedSizeCodec<
|
|
167
|
+
CloseLongToPoolInstructionDataArgs,
|
|
168
|
+
CloseLongToPoolInstructionData
|
|
169
|
+
> {
|
|
170
|
+
return combineCodec(
|
|
171
|
+
getCloseLongToPoolInstructionDataEncoder(),
|
|
172
|
+
getCloseLongToPoolInstructionDataDecoder(),
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export type CloseLongToPoolAsyncInput<
|
|
177
|
+
TAccountOptionPool extends string = string,
|
|
178
|
+
TAccountOptionAccount extends string = string,
|
|
179
|
+
TAccountCollateralPool extends string = string,
|
|
180
|
+
TAccountUnderlyingMint extends string = string,
|
|
181
|
+
TAccountLongMint extends string = string,
|
|
182
|
+
TAccountEscrowLongAccount extends string = string,
|
|
183
|
+
TAccountPremiumVault extends string = string,
|
|
184
|
+
TAccountMarketData extends string = string,
|
|
185
|
+
TAccountPriceUpdate extends string = string,
|
|
186
|
+
TAccountBuyerPosition extends string = string,
|
|
187
|
+
TAccountBuyerLongAccount extends string = string,
|
|
188
|
+
TAccountBuyerPayoutAccount extends string = string,
|
|
189
|
+
TAccountCollateralVault extends string = string,
|
|
190
|
+
TAccountOmlpVault extends string = string,
|
|
191
|
+
TAccountBuyer extends string = string,
|
|
192
|
+
TAccountTokenProgram extends string = string,
|
|
193
|
+
TAccountSystemProgram extends string = string,
|
|
194
|
+
> = {
|
|
195
|
+
/** The option pool */
|
|
196
|
+
optionPool: Address<TAccountOptionPool>;
|
|
197
|
+
/** The option account */
|
|
198
|
+
optionAccount: Address<TAccountOptionAccount>;
|
|
199
|
+
/** Collateral pool (source of payout) */
|
|
200
|
+
collateralPool?: Address<TAccountCollateralPool>;
|
|
201
|
+
/** Underlying token mint (for decimal handling) */
|
|
202
|
+
underlyingMint: Address<TAccountUnderlyingMint>;
|
|
203
|
+
/** LONG token mint (for transfer validation) */
|
|
204
|
+
longMint: Address<TAccountLongMint>;
|
|
205
|
+
/** Pool LONG escrow (destination when buyer closes back to pool) */
|
|
206
|
+
escrowLongAccount: Address<TAccountEscrowLongAccount>;
|
|
207
|
+
/** Premium vault (first source of buyer payout) */
|
|
208
|
+
premiumVault: Address<TAccountPremiumVault>;
|
|
209
|
+
/** Market data account (provides risk-free rate and pyth_feed_id) */
|
|
210
|
+
marketData: Address<TAccountMarketData>;
|
|
211
|
+
/** Pyth price update account for current underlying price */
|
|
212
|
+
priceUpdate: Address<TAccountPriceUpdate>;
|
|
213
|
+
/** Buyer's position account */
|
|
214
|
+
buyerPosition?: Address<TAccountBuyerPosition>;
|
|
215
|
+
/** Buyer's LONG token account (source of tokens to return) */
|
|
216
|
+
buyerLongAccount: Address<TAccountBuyerLongAccount>;
|
|
217
|
+
/** Buyer's underlying token account (receives payout) */
|
|
218
|
+
buyerPayoutAccount: Address<TAccountBuyerPayoutAccount>;
|
|
219
|
+
/** Collateral vault (source of payout) */
|
|
220
|
+
collateralVault: Address<TAccountCollateralVault>;
|
|
221
|
+
/** OMLP vault token account (receives lender repayments if any debt exists) */
|
|
222
|
+
omlpVault?: Address<TAccountOmlpVault>;
|
|
223
|
+
buyer: TransactionSigner<TAccountBuyer>;
|
|
224
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
225
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
226
|
+
quantity: CloseLongToPoolInstructionDataArgs["quantity"];
|
|
227
|
+
minPayoutAmount: CloseLongToPoolInstructionDataArgs["minPayoutAmount"];
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export async function getCloseLongToPoolInstructionAsync<
|
|
231
|
+
TAccountOptionPool extends string,
|
|
232
|
+
TAccountOptionAccount extends string,
|
|
233
|
+
TAccountCollateralPool extends string,
|
|
234
|
+
TAccountUnderlyingMint extends string,
|
|
235
|
+
TAccountLongMint extends string,
|
|
236
|
+
TAccountEscrowLongAccount extends string,
|
|
237
|
+
TAccountPremiumVault extends string,
|
|
238
|
+
TAccountMarketData extends string,
|
|
239
|
+
TAccountPriceUpdate extends string,
|
|
240
|
+
TAccountBuyerPosition extends string,
|
|
241
|
+
TAccountBuyerLongAccount extends string,
|
|
242
|
+
TAccountBuyerPayoutAccount extends string,
|
|
243
|
+
TAccountCollateralVault extends string,
|
|
244
|
+
TAccountOmlpVault extends string,
|
|
245
|
+
TAccountBuyer extends string,
|
|
246
|
+
TAccountTokenProgram extends string,
|
|
247
|
+
TAccountSystemProgram extends string,
|
|
248
|
+
TProgramAddress extends Address = typeof OPTION_PROGRAM_PROGRAM_ADDRESS,
|
|
249
|
+
>(
|
|
250
|
+
input: CloseLongToPoolAsyncInput<
|
|
251
|
+
TAccountOptionPool,
|
|
252
|
+
TAccountOptionAccount,
|
|
253
|
+
TAccountCollateralPool,
|
|
254
|
+
TAccountUnderlyingMint,
|
|
255
|
+
TAccountLongMint,
|
|
256
|
+
TAccountEscrowLongAccount,
|
|
257
|
+
TAccountPremiumVault,
|
|
258
|
+
TAccountMarketData,
|
|
259
|
+
TAccountPriceUpdate,
|
|
260
|
+
TAccountBuyerPosition,
|
|
261
|
+
TAccountBuyerLongAccount,
|
|
262
|
+
TAccountBuyerPayoutAccount,
|
|
263
|
+
TAccountCollateralVault,
|
|
264
|
+
TAccountOmlpVault,
|
|
265
|
+
TAccountBuyer,
|
|
266
|
+
TAccountTokenProgram,
|
|
267
|
+
TAccountSystemProgram
|
|
268
|
+
>,
|
|
269
|
+
config?: { programAddress?: TProgramAddress },
|
|
270
|
+
): Promise<
|
|
271
|
+
CloseLongToPoolInstruction<
|
|
272
|
+
TProgramAddress,
|
|
273
|
+
TAccountOptionPool,
|
|
274
|
+
TAccountOptionAccount,
|
|
275
|
+
TAccountCollateralPool,
|
|
276
|
+
TAccountUnderlyingMint,
|
|
277
|
+
TAccountLongMint,
|
|
278
|
+
TAccountEscrowLongAccount,
|
|
279
|
+
TAccountPremiumVault,
|
|
280
|
+
TAccountMarketData,
|
|
281
|
+
TAccountPriceUpdate,
|
|
282
|
+
TAccountBuyerPosition,
|
|
283
|
+
TAccountBuyerLongAccount,
|
|
284
|
+
TAccountBuyerPayoutAccount,
|
|
285
|
+
TAccountCollateralVault,
|
|
286
|
+
TAccountOmlpVault,
|
|
287
|
+
TAccountBuyer,
|
|
288
|
+
TAccountTokenProgram,
|
|
289
|
+
TAccountSystemProgram
|
|
290
|
+
>
|
|
291
|
+
> {
|
|
292
|
+
// Program address.
|
|
293
|
+
const programAddress =
|
|
294
|
+
config?.programAddress ?? OPTION_PROGRAM_PROGRAM_ADDRESS;
|
|
295
|
+
|
|
296
|
+
// Original accounts.
|
|
297
|
+
const originalAccounts = {
|
|
298
|
+
optionPool: { value: input.optionPool ?? null, isWritable: true },
|
|
299
|
+
optionAccount: { value: input.optionAccount ?? null, isWritable: true },
|
|
300
|
+
collateralPool: { value: input.collateralPool ?? null, isWritable: true },
|
|
301
|
+
underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
|
|
302
|
+
longMint: { value: input.longMint ?? null, isWritable: true },
|
|
303
|
+
escrowLongAccount: {
|
|
304
|
+
value: input.escrowLongAccount ?? null,
|
|
305
|
+
isWritable: true,
|
|
306
|
+
},
|
|
307
|
+
premiumVault: { value: input.premiumVault ?? null, isWritable: true },
|
|
308
|
+
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
309
|
+
priceUpdate: { value: input.priceUpdate ?? null, isWritable: false },
|
|
310
|
+
buyerPosition: { value: input.buyerPosition ?? null, isWritable: true },
|
|
311
|
+
buyerLongAccount: {
|
|
312
|
+
value: input.buyerLongAccount ?? null,
|
|
313
|
+
isWritable: true,
|
|
314
|
+
},
|
|
315
|
+
buyerPayoutAccount: {
|
|
316
|
+
value: input.buyerPayoutAccount ?? null,
|
|
317
|
+
isWritable: true,
|
|
318
|
+
},
|
|
319
|
+
collateralVault: { value: input.collateralVault ?? null, isWritable: true },
|
|
320
|
+
omlpVault: { value: input.omlpVault ?? null, isWritable: true },
|
|
321
|
+
buyer: { value: input.buyer ?? null, isWritable: true },
|
|
322
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
323
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
324
|
+
};
|
|
325
|
+
const accounts = originalAccounts as Record<
|
|
326
|
+
keyof typeof originalAccounts,
|
|
327
|
+
ResolvedAccount
|
|
328
|
+
>;
|
|
329
|
+
|
|
330
|
+
// Original args.
|
|
331
|
+
const args = { ...input };
|
|
332
|
+
|
|
333
|
+
// Resolve default values.
|
|
334
|
+
if (!accounts.collateralPool.value) {
|
|
335
|
+
accounts.collateralPool.value = await getProgramDerivedAddress({
|
|
336
|
+
programAddress,
|
|
337
|
+
seeds: [
|
|
338
|
+
getBytesEncoder().encode(
|
|
339
|
+
new Uint8Array([
|
|
340
|
+
99, 111, 108, 108, 97, 116, 101, 114, 97, 108, 95, 112, 111, 111,
|
|
341
|
+
108,
|
|
342
|
+
]),
|
|
343
|
+
),
|
|
344
|
+
getAddressEncoder().encode(expectAddress(accounts.optionAccount.value)),
|
|
345
|
+
],
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
if (!accounts.buyerPosition.value) {
|
|
349
|
+
accounts.buyerPosition.value = await getProgramDerivedAddress({
|
|
350
|
+
programAddress,
|
|
351
|
+
seeds: [
|
|
352
|
+
getBytesEncoder().encode(
|
|
353
|
+
new Uint8Array([112, 111, 115, 105, 116, 105, 111, 110]),
|
|
354
|
+
),
|
|
355
|
+
getAddressEncoder().encode(expectAddress(accounts.buyer.value)),
|
|
356
|
+
getAddressEncoder().encode(expectAddress(accounts.optionAccount.value)),
|
|
357
|
+
],
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
if (!accounts.tokenProgram.value) {
|
|
361
|
+
accounts.tokenProgram.value =
|
|
362
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
|
|
363
|
+
}
|
|
364
|
+
if (!accounts.systemProgram.value) {
|
|
365
|
+
accounts.systemProgram.value =
|
|
366
|
+
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
370
|
+
return Object.freeze({
|
|
371
|
+
accounts: [
|
|
372
|
+
getAccountMeta(accounts.optionPool),
|
|
373
|
+
getAccountMeta(accounts.optionAccount),
|
|
374
|
+
getAccountMeta(accounts.collateralPool),
|
|
375
|
+
getAccountMeta(accounts.underlyingMint),
|
|
376
|
+
getAccountMeta(accounts.longMint),
|
|
377
|
+
getAccountMeta(accounts.escrowLongAccount),
|
|
378
|
+
getAccountMeta(accounts.premiumVault),
|
|
379
|
+
getAccountMeta(accounts.marketData),
|
|
380
|
+
getAccountMeta(accounts.priceUpdate),
|
|
381
|
+
getAccountMeta(accounts.buyerPosition),
|
|
382
|
+
getAccountMeta(accounts.buyerLongAccount),
|
|
383
|
+
getAccountMeta(accounts.buyerPayoutAccount),
|
|
384
|
+
getAccountMeta(accounts.collateralVault),
|
|
385
|
+
getAccountMeta(accounts.omlpVault),
|
|
386
|
+
getAccountMeta(accounts.buyer),
|
|
387
|
+
getAccountMeta(accounts.tokenProgram),
|
|
388
|
+
getAccountMeta(accounts.systemProgram),
|
|
389
|
+
],
|
|
390
|
+
data: getCloseLongToPoolInstructionDataEncoder().encode(
|
|
391
|
+
args as CloseLongToPoolInstructionDataArgs,
|
|
392
|
+
),
|
|
393
|
+
programAddress,
|
|
394
|
+
} as CloseLongToPoolInstruction<
|
|
395
|
+
TProgramAddress,
|
|
396
|
+
TAccountOptionPool,
|
|
397
|
+
TAccountOptionAccount,
|
|
398
|
+
TAccountCollateralPool,
|
|
399
|
+
TAccountUnderlyingMint,
|
|
400
|
+
TAccountLongMint,
|
|
401
|
+
TAccountEscrowLongAccount,
|
|
402
|
+
TAccountPremiumVault,
|
|
403
|
+
TAccountMarketData,
|
|
404
|
+
TAccountPriceUpdate,
|
|
405
|
+
TAccountBuyerPosition,
|
|
406
|
+
TAccountBuyerLongAccount,
|
|
407
|
+
TAccountBuyerPayoutAccount,
|
|
408
|
+
TAccountCollateralVault,
|
|
409
|
+
TAccountOmlpVault,
|
|
410
|
+
TAccountBuyer,
|
|
411
|
+
TAccountTokenProgram,
|
|
412
|
+
TAccountSystemProgram
|
|
413
|
+
>);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export type CloseLongToPoolInput<
|
|
417
|
+
TAccountOptionPool extends string = string,
|
|
418
|
+
TAccountOptionAccount extends string = string,
|
|
419
|
+
TAccountCollateralPool extends string = string,
|
|
420
|
+
TAccountUnderlyingMint extends string = string,
|
|
421
|
+
TAccountLongMint extends string = string,
|
|
422
|
+
TAccountEscrowLongAccount extends string = string,
|
|
423
|
+
TAccountPremiumVault extends string = string,
|
|
424
|
+
TAccountMarketData extends string = string,
|
|
425
|
+
TAccountPriceUpdate extends string = string,
|
|
426
|
+
TAccountBuyerPosition extends string = string,
|
|
427
|
+
TAccountBuyerLongAccount extends string = string,
|
|
428
|
+
TAccountBuyerPayoutAccount extends string = string,
|
|
429
|
+
TAccountCollateralVault extends string = string,
|
|
430
|
+
TAccountOmlpVault extends string = string,
|
|
431
|
+
TAccountBuyer extends string = string,
|
|
432
|
+
TAccountTokenProgram extends string = string,
|
|
433
|
+
TAccountSystemProgram extends string = string,
|
|
434
|
+
> = {
|
|
435
|
+
/** The option pool */
|
|
436
|
+
optionPool: Address<TAccountOptionPool>;
|
|
437
|
+
/** The option account */
|
|
438
|
+
optionAccount: Address<TAccountOptionAccount>;
|
|
439
|
+
/** Collateral pool (source of payout) */
|
|
440
|
+
collateralPool: Address<TAccountCollateralPool>;
|
|
441
|
+
/** Underlying token mint (for decimal handling) */
|
|
442
|
+
underlyingMint: Address<TAccountUnderlyingMint>;
|
|
443
|
+
/** LONG token mint (for transfer validation) */
|
|
444
|
+
longMint: Address<TAccountLongMint>;
|
|
445
|
+
/** Pool LONG escrow (destination when buyer closes back to pool) */
|
|
446
|
+
escrowLongAccount: Address<TAccountEscrowLongAccount>;
|
|
447
|
+
/** Premium vault (first source of buyer payout) */
|
|
448
|
+
premiumVault: Address<TAccountPremiumVault>;
|
|
449
|
+
/** Market data account (provides risk-free rate and pyth_feed_id) */
|
|
450
|
+
marketData: Address<TAccountMarketData>;
|
|
451
|
+
/** Pyth price update account for current underlying price */
|
|
452
|
+
priceUpdate: Address<TAccountPriceUpdate>;
|
|
453
|
+
/** Buyer's position account */
|
|
454
|
+
buyerPosition: Address<TAccountBuyerPosition>;
|
|
455
|
+
/** Buyer's LONG token account (source of tokens to return) */
|
|
456
|
+
buyerLongAccount: Address<TAccountBuyerLongAccount>;
|
|
457
|
+
/** Buyer's underlying token account (receives payout) */
|
|
458
|
+
buyerPayoutAccount: Address<TAccountBuyerPayoutAccount>;
|
|
459
|
+
/** Collateral vault (source of payout) */
|
|
460
|
+
collateralVault: Address<TAccountCollateralVault>;
|
|
461
|
+
/** OMLP vault token account (receives lender repayments if any debt exists) */
|
|
462
|
+
omlpVault?: Address<TAccountOmlpVault>;
|
|
463
|
+
buyer: TransactionSigner<TAccountBuyer>;
|
|
464
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
465
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
466
|
+
quantity: CloseLongToPoolInstructionDataArgs["quantity"];
|
|
467
|
+
minPayoutAmount: CloseLongToPoolInstructionDataArgs["minPayoutAmount"];
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
export function getCloseLongToPoolInstruction<
|
|
471
|
+
TAccountOptionPool extends string,
|
|
472
|
+
TAccountOptionAccount extends string,
|
|
473
|
+
TAccountCollateralPool extends string,
|
|
474
|
+
TAccountUnderlyingMint extends string,
|
|
475
|
+
TAccountLongMint extends string,
|
|
476
|
+
TAccountEscrowLongAccount extends string,
|
|
477
|
+
TAccountPremiumVault extends string,
|
|
478
|
+
TAccountMarketData extends string,
|
|
479
|
+
TAccountPriceUpdate extends string,
|
|
480
|
+
TAccountBuyerPosition extends string,
|
|
481
|
+
TAccountBuyerLongAccount extends string,
|
|
482
|
+
TAccountBuyerPayoutAccount extends string,
|
|
483
|
+
TAccountCollateralVault extends string,
|
|
484
|
+
TAccountOmlpVault extends string,
|
|
485
|
+
TAccountBuyer extends string,
|
|
486
|
+
TAccountTokenProgram extends string,
|
|
487
|
+
TAccountSystemProgram extends string,
|
|
488
|
+
TProgramAddress extends Address = typeof OPTION_PROGRAM_PROGRAM_ADDRESS,
|
|
489
|
+
>(
|
|
490
|
+
input: CloseLongToPoolInput<
|
|
491
|
+
TAccountOptionPool,
|
|
492
|
+
TAccountOptionAccount,
|
|
493
|
+
TAccountCollateralPool,
|
|
494
|
+
TAccountUnderlyingMint,
|
|
495
|
+
TAccountLongMint,
|
|
496
|
+
TAccountEscrowLongAccount,
|
|
497
|
+
TAccountPremiumVault,
|
|
498
|
+
TAccountMarketData,
|
|
499
|
+
TAccountPriceUpdate,
|
|
500
|
+
TAccountBuyerPosition,
|
|
501
|
+
TAccountBuyerLongAccount,
|
|
502
|
+
TAccountBuyerPayoutAccount,
|
|
503
|
+
TAccountCollateralVault,
|
|
504
|
+
TAccountOmlpVault,
|
|
505
|
+
TAccountBuyer,
|
|
506
|
+
TAccountTokenProgram,
|
|
507
|
+
TAccountSystemProgram
|
|
508
|
+
>,
|
|
509
|
+
config?: { programAddress?: TProgramAddress },
|
|
510
|
+
): CloseLongToPoolInstruction<
|
|
511
|
+
TProgramAddress,
|
|
512
|
+
TAccountOptionPool,
|
|
513
|
+
TAccountOptionAccount,
|
|
514
|
+
TAccountCollateralPool,
|
|
515
|
+
TAccountUnderlyingMint,
|
|
516
|
+
TAccountLongMint,
|
|
517
|
+
TAccountEscrowLongAccount,
|
|
518
|
+
TAccountPremiumVault,
|
|
519
|
+
TAccountMarketData,
|
|
520
|
+
TAccountPriceUpdate,
|
|
521
|
+
TAccountBuyerPosition,
|
|
522
|
+
TAccountBuyerLongAccount,
|
|
523
|
+
TAccountBuyerPayoutAccount,
|
|
524
|
+
TAccountCollateralVault,
|
|
525
|
+
TAccountOmlpVault,
|
|
526
|
+
TAccountBuyer,
|
|
527
|
+
TAccountTokenProgram,
|
|
528
|
+
TAccountSystemProgram
|
|
529
|
+
> {
|
|
530
|
+
// Program address.
|
|
531
|
+
const programAddress =
|
|
532
|
+
config?.programAddress ?? OPTION_PROGRAM_PROGRAM_ADDRESS;
|
|
533
|
+
|
|
534
|
+
// Original accounts.
|
|
535
|
+
const originalAccounts = {
|
|
536
|
+
optionPool: { value: input.optionPool ?? null, isWritable: true },
|
|
537
|
+
optionAccount: { value: input.optionAccount ?? null, isWritable: true },
|
|
538
|
+
collateralPool: { value: input.collateralPool ?? null, isWritable: true },
|
|
539
|
+
underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
|
|
540
|
+
longMint: { value: input.longMint ?? null, isWritable: true },
|
|
541
|
+
escrowLongAccount: {
|
|
542
|
+
value: input.escrowLongAccount ?? null,
|
|
543
|
+
isWritable: true,
|
|
544
|
+
},
|
|
545
|
+
premiumVault: { value: input.premiumVault ?? null, isWritable: true },
|
|
546
|
+
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
547
|
+
priceUpdate: { value: input.priceUpdate ?? null, isWritable: false },
|
|
548
|
+
buyerPosition: { value: input.buyerPosition ?? null, isWritable: true },
|
|
549
|
+
buyerLongAccount: {
|
|
550
|
+
value: input.buyerLongAccount ?? null,
|
|
551
|
+
isWritable: true,
|
|
552
|
+
},
|
|
553
|
+
buyerPayoutAccount: {
|
|
554
|
+
value: input.buyerPayoutAccount ?? null,
|
|
555
|
+
isWritable: true,
|
|
556
|
+
},
|
|
557
|
+
collateralVault: { value: input.collateralVault ?? null, isWritable: true },
|
|
558
|
+
omlpVault: { value: input.omlpVault ?? null, isWritable: true },
|
|
559
|
+
buyer: { value: input.buyer ?? null, isWritable: true },
|
|
560
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
561
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
562
|
+
};
|
|
563
|
+
const accounts = originalAccounts as Record<
|
|
564
|
+
keyof typeof originalAccounts,
|
|
565
|
+
ResolvedAccount
|
|
566
|
+
>;
|
|
567
|
+
|
|
568
|
+
// Original args.
|
|
569
|
+
const args = { ...input };
|
|
570
|
+
|
|
571
|
+
// Resolve default values.
|
|
572
|
+
if (!accounts.tokenProgram.value) {
|
|
573
|
+
accounts.tokenProgram.value =
|
|
574
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
|
|
575
|
+
}
|
|
576
|
+
if (!accounts.systemProgram.value) {
|
|
577
|
+
accounts.systemProgram.value =
|
|
578
|
+
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
582
|
+
return Object.freeze({
|
|
583
|
+
accounts: [
|
|
584
|
+
getAccountMeta(accounts.optionPool),
|
|
585
|
+
getAccountMeta(accounts.optionAccount),
|
|
586
|
+
getAccountMeta(accounts.collateralPool),
|
|
587
|
+
getAccountMeta(accounts.underlyingMint),
|
|
588
|
+
getAccountMeta(accounts.longMint),
|
|
589
|
+
getAccountMeta(accounts.escrowLongAccount),
|
|
590
|
+
getAccountMeta(accounts.premiumVault),
|
|
591
|
+
getAccountMeta(accounts.marketData),
|
|
592
|
+
getAccountMeta(accounts.priceUpdate),
|
|
593
|
+
getAccountMeta(accounts.buyerPosition),
|
|
594
|
+
getAccountMeta(accounts.buyerLongAccount),
|
|
595
|
+
getAccountMeta(accounts.buyerPayoutAccount),
|
|
596
|
+
getAccountMeta(accounts.collateralVault),
|
|
597
|
+
getAccountMeta(accounts.omlpVault),
|
|
598
|
+
getAccountMeta(accounts.buyer),
|
|
599
|
+
getAccountMeta(accounts.tokenProgram),
|
|
600
|
+
getAccountMeta(accounts.systemProgram),
|
|
601
|
+
],
|
|
602
|
+
data: getCloseLongToPoolInstructionDataEncoder().encode(
|
|
603
|
+
args as CloseLongToPoolInstructionDataArgs,
|
|
604
|
+
),
|
|
605
|
+
programAddress,
|
|
606
|
+
} as CloseLongToPoolInstruction<
|
|
607
|
+
TProgramAddress,
|
|
608
|
+
TAccountOptionPool,
|
|
609
|
+
TAccountOptionAccount,
|
|
610
|
+
TAccountCollateralPool,
|
|
611
|
+
TAccountUnderlyingMint,
|
|
612
|
+
TAccountLongMint,
|
|
613
|
+
TAccountEscrowLongAccount,
|
|
614
|
+
TAccountPremiumVault,
|
|
615
|
+
TAccountMarketData,
|
|
616
|
+
TAccountPriceUpdate,
|
|
617
|
+
TAccountBuyerPosition,
|
|
618
|
+
TAccountBuyerLongAccount,
|
|
619
|
+
TAccountBuyerPayoutAccount,
|
|
620
|
+
TAccountCollateralVault,
|
|
621
|
+
TAccountOmlpVault,
|
|
622
|
+
TAccountBuyer,
|
|
623
|
+
TAccountTokenProgram,
|
|
624
|
+
TAccountSystemProgram
|
|
625
|
+
>);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
export type ParsedCloseLongToPoolInstruction<
|
|
629
|
+
TProgram extends string = typeof OPTION_PROGRAM_PROGRAM_ADDRESS,
|
|
630
|
+
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
|
|
631
|
+
> = {
|
|
632
|
+
programAddress: Address<TProgram>;
|
|
633
|
+
accounts: {
|
|
634
|
+
/** The option pool */
|
|
635
|
+
optionPool: TAccountMetas[0];
|
|
636
|
+
/** The option account */
|
|
637
|
+
optionAccount: TAccountMetas[1];
|
|
638
|
+
/** Collateral pool (source of payout) */
|
|
639
|
+
collateralPool: TAccountMetas[2];
|
|
640
|
+
/** Underlying token mint (for decimal handling) */
|
|
641
|
+
underlyingMint: TAccountMetas[3];
|
|
642
|
+
/** LONG token mint (for transfer validation) */
|
|
643
|
+
longMint: TAccountMetas[4];
|
|
644
|
+
/** Pool LONG escrow (destination when buyer closes back to pool) */
|
|
645
|
+
escrowLongAccount: TAccountMetas[5];
|
|
646
|
+
/** Premium vault (first source of buyer payout) */
|
|
647
|
+
premiumVault: TAccountMetas[6];
|
|
648
|
+
/** Market data account (provides risk-free rate and pyth_feed_id) */
|
|
649
|
+
marketData: TAccountMetas[7];
|
|
650
|
+
/** Pyth price update account for current underlying price */
|
|
651
|
+
priceUpdate: TAccountMetas[8];
|
|
652
|
+
/** Buyer's position account */
|
|
653
|
+
buyerPosition: TAccountMetas[9];
|
|
654
|
+
/** Buyer's LONG token account (source of tokens to return) */
|
|
655
|
+
buyerLongAccount: TAccountMetas[10];
|
|
656
|
+
/** Buyer's underlying token account (receives payout) */
|
|
657
|
+
buyerPayoutAccount: TAccountMetas[11];
|
|
658
|
+
/** Collateral vault (source of payout) */
|
|
659
|
+
collateralVault: TAccountMetas[12];
|
|
660
|
+
/** OMLP vault token account (receives lender repayments if any debt exists) */
|
|
661
|
+
omlpVault?: TAccountMetas[13] | undefined;
|
|
662
|
+
buyer: TAccountMetas[14];
|
|
663
|
+
tokenProgram: TAccountMetas[15];
|
|
664
|
+
systemProgram: TAccountMetas[16];
|
|
665
|
+
};
|
|
666
|
+
data: CloseLongToPoolInstructionData;
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
export function parseCloseLongToPoolInstruction<
|
|
670
|
+
TProgram extends string,
|
|
671
|
+
TAccountMetas extends readonly AccountMeta[],
|
|
672
|
+
>(
|
|
673
|
+
instruction: Instruction<TProgram> &
|
|
674
|
+
InstructionWithAccounts<TAccountMetas> &
|
|
675
|
+
InstructionWithData<ReadonlyUint8Array>,
|
|
676
|
+
): ParsedCloseLongToPoolInstruction<TProgram, TAccountMetas> {
|
|
677
|
+
if (instruction.accounts.length < 17) {
|
|
678
|
+
// TODO: Coded error.
|
|
679
|
+
throw new Error("Not enough accounts");
|
|
680
|
+
}
|
|
681
|
+
let accountIndex = 0;
|
|
682
|
+
const getNextAccount = () => {
|
|
683
|
+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
|
|
684
|
+
accountIndex += 1;
|
|
685
|
+
return accountMeta;
|
|
686
|
+
};
|
|
687
|
+
const getNextOptionalAccount = () => {
|
|
688
|
+
const accountMeta = getNextAccount();
|
|
689
|
+
return accountMeta.address === OPTION_PROGRAM_PROGRAM_ADDRESS
|
|
690
|
+
? undefined
|
|
691
|
+
: accountMeta;
|
|
692
|
+
};
|
|
693
|
+
return {
|
|
694
|
+
programAddress: instruction.programAddress,
|
|
695
|
+
accounts: {
|
|
696
|
+
optionPool: getNextAccount(),
|
|
697
|
+
optionAccount: getNextAccount(),
|
|
698
|
+
collateralPool: getNextAccount(),
|
|
699
|
+
underlyingMint: getNextAccount(),
|
|
700
|
+
longMint: getNextAccount(),
|
|
701
|
+
escrowLongAccount: getNextAccount(),
|
|
702
|
+
premiumVault: getNextAccount(),
|
|
703
|
+
marketData: getNextAccount(),
|
|
704
|
+
priceUpdate: getNextAccount(),
|
|
705
|
+
buyerPosition: getNextAccount(),
|
|
706
|
+
buyerLongAccount: getNextAccount(),
|
|
707
|
+
buyerPayoutAccount: getNextAccount(),
|
|
708
|
+
collateralVault: getNextAccount(),
|
|
709
|
+
omlpVault: getNextOptionalAccount(),
|
|
710
|
+
buyer: getNextAccount(),
|
|
711
|
+
tokenProgram: getNextAccount(),
|
|
712
|
+
systemProgram: getNextAccount(),
|
|
713
|
+
},
|
|
714
|
+
data: getCloseLongToPoolInstructionDataDecoder().decode(instruction.data),
|
|
715
|
+
};
|
|
716
|
+
}
|