@epicentral/sos-sdk 0.12.2-beta → 0.13.1-beta

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.
@@ -57,6 +57,10 @@ export type MarketDataAccount = {
57
57
  lastUpdated: bigint;
58
58
  authority: Address;
59
59
  switchboardFeedId: ReadonlyUint8Array;
60
+ /** Authority-updated HV feed ID (zeros = use historical_volatility only) */
61
+ switchboardVolatilityFeedId: ReadonlyUint8Array;
62
+ /** Keeper pubkey that publishes vol authority quotes */
63
+ volatilityQuoteAuthority: Address;
60
64
  };
61
65
 
62
66
  export type MarketDataAccountArgs = {
@@ -66,6 +70,10 @@ export type MarketDataAccountArgs = {
66
70
  lastUpdated: number | bigint;
67
71
  authority: Address;
68
72
  switchboardFeedId: ReadonlyUint8Array;
73
+ /** Authority-updated HV feed ID (zeros = use historical_volatility only) */
74
+ switchboardVolatilityFeedId: ReadonlyUint8Array;
75
+ /** Keeper pubkey that publishes vol authority quotes */
76
+ volatilityQuoteAuthority: Address;
69
77
  };
70
78
 
71
79
  /** Gets the encoder for {@link MarketDataAccountArgs} account data. */
@@ -79,6 +87,8 @@ export function getMarketDataAccountEncoder(): FixedSizeEncoder<MarketDataAccoun
79
87
  ["lastUpdated", getI64Encoder()],
80
88
  ["authority", getAddressEncoder()],
81
89
  ["switchboardFeedId", fixEncoderSize(getBytesEncoder(), 32)],
90
+ ["switchboardVolatilityFeedId", fixEncoderSize(getBytesEncoder(), 32)],
91
+ ["volatilityQuoteAuthority", getAddressEncoder()],
82
92
  ]),
83
93
  (value) => ({ ...value, discriminator: MARKET_DATA_ACCOUNT_DISCRIMINATOR }),
84
94
  );
@@ -94,6 +104,8 @@ export function getMarketDataAccountDecoder(): FixedSizeDecoder<MarketDataAccoun
94
104
  ["lastUpdated", getI64Decoder()],
95
105
  ["authority", getAddressDecoder()],
96
106
  ["switchboardFeedId", fixDecoderSize(getBytesDecoder(), 32)],
107
+ ["switchboardVolatilityFeedId", fixDecoderSize(getBytesDecoder(), 32)],
108
+ ["volatilityQuoteAuthority", getAddressDecoder()],
97
109
  ]);
98
110
  }
99
111
 
@@ -172,5 +184,5 @@ export async function fetchAllMaybeMarketDataAccount(
172
184
  }
173
185
 
174
186
  export function getMarketDataAccountSize(): number {
175
- return 128;
187
+ return 192;
176
188
  }
@@ -52,192 +52,194 @@ export const OPTION_PROGRAM_ERROR__STALE_ORACLE_PRICE = 0x1780; // 6016
52
52
  export const OPTION_PROGRAM_ERROR__LOW_ORACLE_PRICE_CONFIDENCE = 0x1781; // 6017
53
53
  /** InvalidOracleAccount: Invalid oracle account - cannot parse price feed */
54
54
  export const OPTION_PROGRAM_ERROR__INVALID_ORACLE_ACCOUNT = 0x1782; // 6018
55
+ /** VolatilityQuoteUnavailable: Authority volatility quote unavailable or stale */
56
+ export const OPTION_PROGRAM_ERROR__VOLATILITY_QUOTE_UNAVAILABLE = 0x1783; // 6019
55
57
  /** InvalidSwitchboardQuoteAccount: Invalid Switchboard quote account */
56
- export const OPTION_PROGRAM_ERROR__INVALID_SWITCHBOARD_QUOTE_ACCOUNT = 0x1783; // 6019
58
+ export const OPTION_PROGRAM_ERROR__INVALID_SWITCHBOARD_QUOTE_ACCOUNT = 0x1784; // 6020
57
59
  /** InvalidSwitchboardUpdateProof: Switchboard quote update proof missing or invalid */
58
- export const OPTION_PROGRAM_ERROR__INVALID_SWITCHBOARD_UPDATE_PROOF = 0x1784; // 6020
60
+ export const OPTION_PROGRAM_ERROR__INVALID_SWITCHBOARD_UPDATE_PROOF = 0x1785; // 6021
59
61
  /** OraclePriceUnavailable: Oracle price is unavailable */
60
- export const OPTION_PROGRAM_ERROR__ORACLE_PRICE_UNAVAILABLE = 0x1785; // 6021
62
+ export const OPTION_PROGRAM_ERROR__ORACLE_PRICE_UNAVAILABLE = 0x1786; // 6022
61
63
  /** InvalidOraclePrice: Invalid oracle price - must be positive */
62
- export const OPTION_PROGRAM_ERROR__INVALID_ORACLE_PRICE = 0x1786; // 6022
64
+ export const OPTION_PROGRAM_ERROR__INVALID_ORACLE_PRICE = 0x1787; // 6023
63
65
  /** InsufficientBalance: Insufficient balance for premium payment */
64
- export const OPTION_PROGRAM_ERROR__INSUFFICIENT_BALANCE = 0x1787; // 6023
66
+ export const OPTION_PROGRAM_ERROR__INSUFFICIENT_BALANCE = 0x1788; // 6024
65
67
  /** PositionNotFound: Position not found */
66
- export const OPTION_PROGRAM_ERROR__POSITION_NOT_FOUND = 0x1788; // 6024
68
+ export const OPTION_PROGRAM_ERROR__POSITION_NOT_FOUND = 0x1789; // 6025
67
69
  /** OptionAccountMismatch: Option account mismatch */
68
- export const OPTION_PROGRAM_ERROR__OPTION_ACCOUNT_MISMATCH = 0x1789; // 6025
70
+ export const OPTION_PROGRAM_ERROR__OPTION_ACCOUNT_MISMATCH = 0x178a; // 6026
69
71
  /** ArithmeticOverflow: Arithmetic overflow occurred */
70
- export const OPTION_PROGRAM_ERROR__ARITHMETIC_OVERFLOW = 0x178a; // 6026
72
+ export const OPTION_PROGRAM_ERROR__ARITHMETIC_OVERFLOW = 0x178b; // 6027
71
73
  /** ArithmeticUnderflow: Arithmetic underflow occurred */
72
- export const OPTION_PROGRAM_ERROR__ARITHMETIC_UNDERFLOW = 0x178b; // 6027
74
+ export const OPTION_PROGRAM_ERROR__ARITHMETIC_UNDERFLOW = 0x178c; // 6028
73
75
  /** DivisionByZero: Division by zero */
74
- export const OPTION_PROGRAM_ERROR__DIVISION_BY_ZERO = 0x178c; // 6028
76
+ export const OPTION_PROGRAM_ERROR__DIVISION_BY_ZERO = 0x178d; // 6029
75
77
  /** PremiumCalculationFailed: Premium calculation failed */
76
- export const OPTION_PROGRAM_ERROR__PREMIUM_CALCULATION_FAILED = 0x178d; // 6029
78
+ export const OPTION_PROGRAM_ERROR__PREMIUM_CALCULATION_FAILED = 0x178e; // 6030
77
79
  /** GreeksCalculationFailed: Greeks calculation failed */
78
- export const OPTION_PROGRAM_ERROR__GREEKS_CALCULATION_FAILED = 0x178e; // 6030
80
+ export const OPTION_PROGRAM_ERROR__GREEKS_CALCULATION_FAILED = 0x178f; // 6031
79
81
  /** InvalidEscrowAuthority: Invalid escrow authority */
80
- export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_AUTHORITY = 0x178f; // 6031
82
+ export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_AUTHORITY = 0x1790; // 6032
81
83
  /** EscrowAccountFrozen: Escrow account is frozen */
82
- export const OPTION_PROGRAM_ERROR__ESCROW_ACCOUNT_FROZEN = 0x1790; // 6032
84
+ export const OPTION_PROGRAM_ERROR__ESCROW_ACCOUNT_FROZEN = 0x1791; // 6033
83
85
  /** MarketClosed: Market is closed */
84
- export const OPTION_PROGRAM_ERROR__MARKET_CLOSED = 0x1791; // 6033
86
+ export const OPTION_PROGRAM_ERROR__MARKET_CLOSED = 0x1792; // 6034
85
87
  /** MaxPositionsReached: Maximum positions limit reached */
86
- export const OPTION_PROGRAM_ERROR__MAX_POSITIONS_REACHED = 0x1792; // 6034
88
+ export const OPTION_PROGRAM_ERROR__MAX_POSITIONS_REACHED = 0x1793; // 6035
87
89
  /** MinimumPositionSizeNotMet: Minimum position size not met */
88
- export const OPTION_PROGRAM_ERROR__MINIMUM_POSITION_SIZE_NOT_MET = 0x1793; // 6035
90
+ export const OPTION_PROGRAM_ERROR__MINIMUM_POSITION_SIZE_NOT_MET = 0x1794; // 6036
89
91
  /** MaximumPositionSizeExceeded: Maximum position size exceeded */
90
- export const OPTION_PROGRAM_ERROR__MAXIMUM_POSITION_SIZE_EXCEEDED = 0x1794; // 6036
92
+ export const OPTION_PROGRAM_ERROR__MAXIMUM_POSITION_SIZE_EXCEEDED = 0x1795; // 6037
91
93
  /** InvalidMakerAuthority: Invalid maker authority */
92
- export const OPTION_PROGRAM_ERROR__INVALID_MAKER_AUTHORITY = 0x1795; // 6037
94
+ export const OPTION_PROGRAM_ERROR__INVALID_MAKER_AUTHORITY = 0x1796; // 6038
93
95
  /** InvalidBuyerAuthority: Invalid buyer authority */
94
- export const OPTION_PROGRAM_ERROR__INVALID_BUYER_AUTHORITY = 0x1796; // 6038
96
+ export const OPTION_PROGRAM_ERROR__INVALID_BUYER_AUTHORITY = 0x1797; // 6039
95
97
  /** OptionChainFull: Option chain is full */
96
- export const OPTION_PROGRAM_ERROR__OPTION_CHAIN_FULL = 0x1797; // 6039
98
+ export const OPTION_PROGRAM_ERROR__OPTION_CHAIN_FULL = 0x1798; // 6040
97
99
  /** DuplicateOption: Duplicate option exists */
98
- export const OPTION_PROGRAM_ERROR__DUPLICATE_OPTION = 0x1798; // 6040
100
+ export const OPTION_PROGRAM_ERROR__DUPLICATE_OPTION = 0x1799; // 6041
99
101
  /** PriceImpactTooHigh: Price impact too high */
100
- export const OPTION_PROGRAM_ERROR__PRICE_IMPACT_TOO_HIGH = 0x1799; // 6041
102
+ export const OPTION_PROGRAM_ERROR__PRICE_IMPACT_TOO_HIGH = 0x179a; // 6042
101
103
  /** SlippageToleranceExceeded: Slippage tolerance exceeded */
102
- export const OPTION_PROGRAM_ERROR__SLIPPAGE_TOLERANCE_EXCEEDED = 0x179a; // 6042
104
+ export const OPTION_PROGRAM_ERROR__SLIPPAGE_TOLERANCE_EXCEEDED = 0x179b; // 6043
103
105
  /** InsufficientPoolLiquidity: Insufficient pool liquidity available */
104
- export const OPTION_PROGRAM_ERROR__INSUFFICIENT_POOL_LIQUIDITY = 0x179b; // 6043
106
+ export const OPTION_PROGRAM_ERROR__INSUFFICIENT_POOL_LIQUIDITY = 0x179c; // 6044
105
107
  /** InsufficientPoolAggregateLiquidity: Insufficient aggregate pool liquidity for requested quantity */
106
- export const OPTION_PROGRAM_ERROR__INSUFFICIENT_POOL_AGGREGATE_LIQUIDITY = 0x179c; // 6044
108
+ export const OPTION_PROGRAM_ERROR__INSUFFICIENT_POOL_AGGREGATE_LIQUIDITY = 0x179d; // 6045
107
109
  /** InsufficientWriterPositionLiquidity: Insufficient active writer liquidity to fill requested quantity */
108
- export const OPTION_PROGRAM_ERROR__INSUFFICIENT_WRITER_POSITION_LIQUIDITY = 0x179d; // 6045
110
+ export const OPTION_PROGRAM_ERROR__INSUFFICIENT_WRITER_POSITION_LIQUIDITY = 0x179e; // 6046
109
111
  /** InsufficientUserBalance: Insufficient user balance for withdrawal */
110
- export const OPTION_PROGRAM_ERROR__INSUFFICIENT_USER_BALANCE = 0x179e; // 6046
112
+ export const OPTION_PROGRAM_ERROR__INSUFFICIENT_USER_BALANCE = 0x179f; // 6047
111
113
  /** UnhealthyPosition: Health ratio below liquidation threshold */
112
- export const OPTION_PROGRAM_ERROR__UNHEALTHY_POSITION = 0x179f; // 6047
114
+ export const OPTION_PROGRAM_ERROR__UNHEALTHY_POSITION = 0x17a0; // 6048
113
115
  /** UnauthorizedOmlp: Unauthorized to perform this OMLP action */
114
- export const OPTION_PROGRAM_ERROR__UNAUTHORIZED_OMLP = 0x17a0; // 6048
116
+ export const OPTION_PROGRAM_ERROR__UNAUTHORIZED_OMLP = 0x17a1; // 6049
115
117
  /** InvalidTenor: Invalid loan tenor */
116
- export const OPTION_PROGRAM_ERROR__INVALID_TENOR = 0x17a1; // 6049
118
+ export const OPTION_PROGRAM_ERROR__INVALID_TENOR = 0x17a2; // 6050
117
119
  /** InvalidRate: Invalid interest rate */
118
- export const OPTION_PROGRAM_ERROR__INVALID_RATE = 0x17a2; // 6050
120
+ export const OPTION_PROGRAM_ERROR__INVALID_RATE = 0x17a3; // 6051
119
121
  /** NotForeclosable: Loan is not eligible for foreclosure */
120
- export const OPTION_PROGRAM_ERROR__NOT_FORECLOSABLE = 0x17a3; // 6051
122
+ export const OPTION_PROGRAM_ERROR__NOT_FORECLOSABLE = 0x17a4; // 6052
121
123
  /** InsufficientVaultLiquidity: Vault has insufficient liquidity */
122
- export const OPTION_PROGRAM_ERROR__INSUFFICIENT_VAULT_LIQUIDITY = 0x17a4; // 6052
124
+ export const OPTION_PROGRAM_ERROR__INSUFFICIENT_VAULT_LIQUIDITY = 0x17a5; // 6053
123
125
  /** InsufficientLoanCollateral: Collateral insufficient for loan */
124
- export const OPTION_PROGRAM_ERROR__INSUFFICIENT_LOAN_COLLATERAL = 0x17a5; // 6053
126
+ export const OPTION_PROGRAM_ERROR__INSUFFICIENT_LOAN_COLLATERAL = 0x17a6; // 6054
125
127
  /** OracleTooStale: Oracle price is stale - cannot validate */
126
- export const OPTION_PROGRAM_ERROR__ORACLE_TOO_STALE = 0x17a6; // 6054
128
+ export const OPTION_PROGRAM_ERROR__ORACLE_TOO_STALE = 0x17a7; // 6055
127
129
  /** ValidationRequired: Must call option_validate before borrow/settlement */
128
- export const OPTION_PROGRAM_ERROR__VALIDATION_REQUIRED = 0x17a7; // 6055
130
+ export const OPTION_PROGRAM_ERROR__VALIDATION_REQUIRED = 0x17a8; // 6056
129
131
  /** HealthCalculationFailed: Health ratio calculation failed */
130
- export const OPTION_PROGRAM_ERROR__HEALTH_CALCULATION_FAILED = 0x17a8; // 6056
132
+ export const OPTION_PROGRAM_ERROR__HEALTH_CALCULATION_FAILED = 0x17a9; // 6057
131
133
  /** ContractAlreadySettled: Contract already settled */
132
- export const OPTION_PROGRAM_ERROR__CONTRACT_ALREADY_SETTLED = 0x17a9; // 6057
134
+ export const OPTION_PROGRAM_ERROR__CONTRACT_ALREADY_SETTLED = 0x17aa; // 6058
133
135
  /** NoYieldAvailable: No yield available to claim */
134
- export const OPTION_PROGRAM_ERROR__NO_YIELD_AVAILABLE = 0x17aa; // 6058
136
+ export const OPTION_PROGRAM_ERROR__NO_YIELD_AVAILABLE = 0x17ab; // 6059
135
137
  /** UnauthorizedAccess: Unauthorized access - you don't own this resource */
136
- export const OPTION_PROGRAM_ERROR__UNAUTHORIZED_ACCESS = 0x17ab; // 6059
138
+ export const OPTION_PROGRAM_ERROR__UNAUTHORIZED_ACCESS = 0x17ac; // 6060
137
139
  /** InsufficientQuantity: Insufficient quantity available in ask position */
138
- export const OPTION_PROGRAM_ERROR__INSUFFICIENT_QUANTITY = 0x17ac; // 6060
140
+ export const OPTION_PROGRAM_ERROR__INSUFFICIENT_QUANTITY = 0x17ad; // 6061
139
141
  /** NothingToClaim: Nothing to claim - no unclaimed premium */
140
- export const OPTION_PROGRAM_ERROR__NOTHING_TO_CLAIM = 0x17ad; // 6061
142
+ export const OPTION_PROGRAM_ERROR__NOTHING_TO_CLAIM = 0x17ae; // 6062
141
143
  /** PoolNotActive: Pool is not active */
142
- export const OPTION_PROGRAM_ERROR__POOL_NOT_ACTIVE = 0x17ae; // 6062
144
+ export const OPTION_PROGRAM_ERROR__POOL_NOT_ACTIVE = 0x17af; // 6063
143
145
  /** PoolAlreadyExists: Pool already exists for this option */
144
- export const OPTION_PROGRAM_ERROR__POOL_ALREADY_EXISTS = 0x17af; // 6063
146
+ export const OPTION_PROGRAM_ERROR__POOL_ALREADY_EXISTS = 0x17b0; // 6064
145
147
  /** PoolNotExercised: Pool has not been exercised yet */
146
- export const OPTION_PROGRAM_ERROR__POOL_NOT_EXERCISED = 0x17b0; // 6064
148
+ export const OPTION_PROGRAM_ERROR__POOL_NOT_EXERCISED = 0x17b1; // 6065
147
149
  /** AlreadySettled: Maker's collateral share has already been settled */
148
- export const OPTION_PROGRAM_ERROR__ALREADY_SETTLED = 0x17b1; // 6065
150
+ export const OPTION_PROGRAM_ERROR__ALREADY_SETTLED = 0x17b2; // 6066
149
151
  /** InsufficientPoolCollateral: Insufficient collateral in pool for exercise */
150
- export const OPTION_PROGRAM_ERROR__INSUFFICIENT_POOL_COLLATERAL = 0x17b2; // 6066
152
+ export const OPTION_PROGRAM_ERROR__INSUFFICIENT_POOL_COLLATERAL = 0x17b3; // 6067
151
153
  /** CollateralPoolNotFound: Collateral pool does not exist */
152
- export const OPTION_PROGRAM_ERROR__COLLATERAL_POOL_NOT_FOUND = 0x17b3; // 6067
154
+ export const OPTION_PROGRAM_ERROR__COLLATERAL_POOL_NOT_FOUND = 0x17b4; // 6068
153
155
  /** NoCollateralToWithdraw: No collateral to withdraw */
154
- export const OPTION_PROGRAM_ERROR__NO_COLLATERAL_TO_WITHDRAW = 0x17b4; // 6068
156
+ export const OPTION_PROGRAM_ERROR__NO_COLLATERAL_TO_WITHDRAW = 0x17b5; // 6069
155
157
  /** OptionNotExpired: Option has not expired yet - cannot settle */
156
- export const OPTION_PROGRAM_ERROR__OPTION_NOT_EXPIRED = 0x17b5; // 6069
158
+ export const OPTION_PROGRAM_ERROR__OPTION_NOT_EXPIRED = 0x17b6; // 6070
157
159
  /** LenderRepaymentNotComplete: Lender repayment phase is not complete */
158
- export const OPTION_PROGRAM_ERROR__LENDER_REPAYMENT_NOT_COMPLETE = 0x17b6; // 6070
160
+ export const OPTION_PROGRAM_ERROR__LENDER_REPAYMENT_NOT_COMPLETE = 0x17b7; // 6071
159
161
  /** BuyerPayoutNotComplete: Buyer payout phase is not complete */
160
- export const OPTION_PROGRAM_ERROR__BUYER_PAYOUT_NOT_COMPLETE = 0x17b7; // 6071
162
+ export const OPTION_PROGRAM_ERROR__BUYER_PAYOUT_NOT_COMPLETE = 0x17b8; // 6072
161
163
  /** SettlementClaimAlreadyPrepared: Settlement claim has already been prepared */
162
- export const OPTION_PROGRAM_ERROR__SETTLEMENT_CLAIM_ALREADY_PREPARED = 0x17b8; // 6072
164
+ export const OPTION_PROGRAM_ERROR__SETTLEMENT_CLAIM_ALREADY_PREPARED = 0x17b9; // 6073
163
165
  /** SettlementClaimNotPrepared: Settlement claim has not been prepared */
164
- export const OPTION_PROGRAM_ERROR__SETTLEMENT_CLAIM_NOT_PREPARED = 0x17b9; // 6073
166
+ export const OPTION_PROGRAM_ERROR__SETTLEMENT_CLAIM_NOT_PREPARED = 0x17ba; // 6074
165
167
  /** SettlementClaimAlreadyClaimed: Settlement claim has already been claimed */
166
- export const OPTION_PROGRAM_ERROR__SETTLEMENT_CLAIM_ALREADY_CLAIMED = 0x17ba; // 6074
168
+ export const OPTION_PROGRAM_ERROR__SETTLEMENT_CLAIM_ALREADY_CLAIMED = 0x17bb; // 6075
167
169
  /** MakerLiquidated: Maker was liquidated and is excluded from expiry settlement */
168
- export const OPTION_PROGRAM_ERROR__MAKER_LIQUIDATED = 0x17bb; // 6075
170
+ export const OPTION_PROGRAM_ERROR__MAKER_LIQUIDATED = 0x17bc; // 6076
169
171
  /** SupplyLimitExceeded: Deposit would exceed vault supply limit */
170
- export const OPTION_PROGRAM_ERROR__SUPPLY_LIMIT_EXCEEDED = 0x17bc; // 6076
172
+ export const OPTION_PROGRAM_ERROR__SUPPLY_LIMIT_EXCEEDED = 0x17bd; // 6077
171
173
  /** InvalidFeeWallet: Invalid fee wallet - must match protocol constant */
172
- export const OPTION_PROGRAM_ERROR__INVALID_FEE_WALLET = 0x17bd; // 6077
174
+ export const OPTION_PROGRAM_ERROR__INVALID_FEE_WALLET = 0x17be; // 6078
173
175
  /** InvalidProtocolFee: Invalid protocol fee rate */
174
- export const OPTION_PROGRAM_ERROR__INVALID_PROTOCOL_FEE = 0x17be; // 6078
176
+ export const OPTION_PROGRAM_ERROR__INVALID_PROTOCOL_FEE = 0x17bf; // 6079
175
177
  /** UnderlyingAssetMismatch: Underlying asset mismatch - market data or mint does not match option */
176
- export const OPTION_PROGRAM_ERROR__UNDERLYING_ASSET_MISMATCH = 0x17bf; // 6079
178
+ export const OPTION_PROGRAM_ERROR__UNDERLYING_ASSET_MISMATCH = 0x17c0; // 6080
177
179
  /** InvalidMint: Invalid token mint - does not match expected underlying asset */
178
- export const OPTION_PROGRAM_ERROR__INVALID_MINT = 0x17c0; // 6080
180
+ export const OPTION_PROGRAM_ERROR__INVALID_MINT = 0x17c1; // 6081
179
181
  /** BatchSizeExceeded: Batch size exceeds maximum allowed (10 positions) */
180
- export const OPTION_PROGRAM_ERROR__BATCH_SIZE_EXCEEDED = 0x17c1; // 6081
182
+ export const OPTION_PROGRAM_ERROR__BATCH_SIZE_EXCEEDED = 0x17c2; // 6082
181
183
  /** NoPositionsProvided: No positions provided in batch */
182
- export const OPTION_PROGRAM_ERROR__NO_POSITIONS_PROVIDED = 0x17c2; // 6082
184
+ export const OPTION_PROGRAM_ERROR__NO_POSITIONS_PROVIDED = 0x17c3; // 6083
183
185
  /** PositionOptionMismatch: Position account does not belong to this option */
184
- export const OPTION_PROGRAM_ERROR__POSITION_OPTION_MISMATCH = 0x17c3; // 6083
186
+ export const OPTION_PROGRAM_ERROR__POSITION_OPTION_MISMATCH = 0x17c4; // 6084
185
187
  /** OptionPoolMismatch: Option account does not match the option pool's option account */
186
- export const OPTION_PROGRAM_ERROR__OPTION_POOL_MISMATCH = 0x17c4; // 6084
188
+ export const OPTION_PROGRAM_ERROR__OPTION_POOL_MISMATCH = 0x17c5; // 6085
187
189
  /** InvalidSeed: Invalid seed - must be exactly 32 bytes */
188
- export const OPTION_PROGRAM_ERROR__INVALID_SEED = 0x17c5; // 6085
190
+ export const OPTION_PROGRAM_ERROR__INVALID_SEED = 0x17c6; // 6086
189
191
  /** InvalidAuthority: Invalid authority - does not match escrow authority */
190
- export const OPTION_PROGRAM_ERROR__INVALID_AUTHORITY = 0x17c6; // 6086
192
+ export const OPTION_PROGRAM_ERROR__INVALID_AUTHORITY = 0x17c7; // 6087
191
193
  /** EscrowAccountRequired: Escrow accounts required when borrowed_amount > 0 */
192
- export const OPTION_PROGRAM_ERROR__ESCROW_ACCOUNT_REQUIRED = 0x17c7; // 6087
194
+ export const OPTION_PROGRAM_ERROR__ESCROW_ACCOUNT_REQUIRED = 0x17c8; // 6088
193
195
  /** InvalidEscrowMaker: Escrow state maker does not match instruction maker */
194
- export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_MAKER = 0x17c8; // 6088
196
+ export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_MAKER = 0x17c9; // 6089
195
197
  /** EscrowMintMismatch: Escrow collateral mint does not match collateral pool mint */
196
- export const OPTION_PROGRAM_ERROR__ESCROW_MINT_MISMATCH = 0x17c9; // 6089
198
+ export const OPTION_PROGRAM_ERROR__ESCROW_MINT_MISMATCH = 0x17ca; // 6090
197
199
  /** InsufficientEscrowBalance: Insufficient balance in escrow token account */
198
- export const OPTION_PROGRAM_ERROR__INSUFFICIENT_ESCROW_BALANCE = 0x17ca; // 6090
200
+ export const OPTION_PROGRAM_ERROR__INSUFFICIENT_ESCROW_BALANCE = 0x17cb; // 6091
199
201
  /** InvalidEscrowOwner: Escrow token account owner mismatch */
200
- export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_OWNER = 0x17cb; // 6091
202
+ export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_OWNER = 0x17cc; // 6092
201
203
  /** InvalidEscrowMint: Escrow token account mint mismatch */
202
- export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_MINT = 0x17cc; // 6092
204
+ export const OPTION_PROGRAM_ERROR__INVALID_ESCROW_MINT = 0x17cd; // 6093
203
205
  /** AccountFrozen: Token account is frozen and cannot be burned */
204
- export const OPTION_PROGRAM_ERROR__ACCOUNT_FROZEN = 0x17cd; // 6093
206
+ export const OPTION_PROGRAM_ERROR__ACCOUNT_FROZEN = 0x17ce; // 6094
205
207
  /** InvalidAccount: Invalid account - does not match expected account */
206
- export const OPTION_PROGRAM_ERROR__INVALID_ACCOUNT = 0x17ce; // 6094
208
+ export const OPTION_PROGRAM_ERROR__INVALID_ACCOUNT = 0x17cf; // 6095
207
209
  /** UnwindRepayAccountsMissing: Unwind repayment accounts are required when active pool loans exist */
208
- export const OPTION_PROGRAM_ERROR__UNWIND_REPAY_ACCOUNTS_MISSING = 0x17cf; // 6095
210
+ export const OPTION_PROGRAM_ERROR__UNWIND_REPAY_ACCOUNTS_MISSING = 0x17d0; // 6096
209
211
  /** InsufficientCollateralVault: Collateral vault has insufficient funds for unwind collateral return */
210
- export const OPTION_PROGRAM_ERROR__INSUFFICIENT_COLLATERAL_VAULT = 0x17d0; // 6096
212
+ export const OPTION_PROGRAM_ERROR__INSUFFICIENT_COLLATERAL_VAULT = 0x17d1; // 6097
211
213
  /** InvalidVaultMint: Invalid vault mint - does not match expected collateral mint */
212
- export const OPTION_PROGRAM_ERROR__INVALID_VAULT_MINT = 0x17d1; // 6097
214
+ export const OPTION_PROGRAM_ERROR__INVALID_VAULT_MINT = 0x17d2; // 6098
213
215
  /** InvalidCollateralMint: Invalid collateral mint - not supported or no vault exists */
214
- export const OPTION_PROGRAM_ERROR__INVALID_COLLATERAL_MINT = 0x17d2; // 6098
216
+ export const OPTION_PROGRAM_ERROR__INVALID_COLLATERAL_MINT = 0x17d3; // 6099
215
217
  /** CollateralMismatch: Collateral mint mismatch - position uses different collateral type */
216
- export const OPTION_PROGRAM_ERROR__COLLATERAL_MISMATCH = 0x17d3; // 6099
218
+ export const OPTION_PROGRAM_ERROR__COLLATERAL_MISMATCH = 0x17d4; // 6100
217
219
  /** BuyRemainingAccountsUnsorted: buy_from_pool remaining_accounts are not sorted by (created_at asc, pubkey asc) */
218
- export const OPTION_PROGRAM_ERROR__BUY_REMAINING_ACCOUNTS_UNSORTED = 0x17d4; // 6100
220
+ export const OPTION_PROGRAM_ERROR__BUY_REMAINING_ACCOUNTS_UNSORTED = 0x17d5; // 6101
219
221
  /** CloseLongWritersIncomplete: close_long_to_pool requires a complete set of active WriterPositions: sum(sold_qty) must equal pool.total_sold_qty */
220
- export const OPTION_PROGRAM_ERROR__CLOSE_LONG_WRITERS_INCOMPLETE = 0x17d5; // 6101
222
+ export const OPTION_PROGRAM_ERROR__CLOSE_LONG_WRITERS_INCOMPLETE = 0x17d6; // 6102
221
223
  /** CloseLongNoSoldInventory: close_long_to_pool cannot run because no writer has sold inventory for this pool */
222
- export const OPTION_PROGRAM_ERROR__CLOSE_LONG_NO_SOLD_INVENTORY = 0x17d6; // 6102
224
+ export const OPTION_PROGRAM_ERROR__CLOSE_LONG_NO_SOLD_INVENTORY = 0x17d7; // 6103
223
225
  /** CloseLongDuplicateWriter: close_long_to_pool remaining_accounts contain duplicate WriterPosition entries */
224
- export const OPTION_PROGRAM_ERROR__CLOSE_LONG_DUPLICATE_WRITER = 0x17d7; // 6103
226
+ export const OPTION_PROGRAM_ERROR__CLOSE_LONG_DUPLICATE_WRITER = 0x17d8; // 6104
225
227
  /** MaintenanceBufferBreached: Writer position breaches maintenance buffer: free_collateral + claimable_theta < accrued_interest + fees + buffer */
226
- export const OPTION_PROGRAM_ERROR__MAINTENANCE_BUFFER_BREACHED = 0x17d8; // 6104
228
+ export const OPTION_PROGRAM_ERROR__MAINTENANCE_BUFFER_BREACHED = 0x17d9; // 6105
227
229
  /** LiquidationInsufficientCollateralForDebt: Liquidation cannot cover full debt (principal + interest + fees) from writer's collateral + theta; call rescue path instead */
228
- export const OPTION_PROGRAM_ERROR__LIQUIDATION_INSUFFICIENT_COLLATERAL_FOR_DEBT = 0x17d9; // 6105
230
+ export const OPTION_PROGRAM_ERROR__LIQUIDATION_INSUFFICIENT_COLLATERAL_FOR_DEBT = 0x17da; // 6106
229
231
  /** ThetaClaimDisabled: claim_theta instruction has been removed; theta is now auto-realized on unwind or forfeited on liquidation */
230
- export const OPTION_PROGRAM_ERROR__THETA_CLAIM_DISABLED = 0x17da; // 6106
232
+ export const OPTION_PROGRAM_ERROR__THETA_CLAIM_DISABLED = 0x17db; // 6107
231
233
  /** PoolLoanWriterMismatch: PoolLoan.writer_position does not match the WriterPosition in this instruction */
232
- export const OPTION_PROGRAM_ERROR__POOL_LOAN_WRITER_MISMATCH = 0x17db; // 6107
234
+ export const OPTION_PROGRAM_ERROR__POOL_LOAN_WRITER_MISMATCH = 0x17dc; // 6108
233
235
  /** MaintenanceLoansIncomplete: Maintenance debt sync remaining_accounts must contain every active PoolLoan for this writer */
234
- export const OPTION_PROGRAM_ERROR__MAINTENANCE_LOANS_INCOMPLETE = 0x17dc; // 6108
236
+ export const OPTION_PROGRAM_ERROR__MAINTENANCE_LOANS_INCOMPLETE = 0x17dd; // 6109
235
237
  /** RescueUnauthorized: Rescue liquidation is gated to the vault keeper */
236
- export const OPTION_PROGRAM_ERROR__RESCUE_UNAUTHORIZED = 0x17dd; // 6109
238
+ export const OPTION_PROGRAM_ERROR__RESCUE_UNAUTHORIZED = 0x17de; // 6110
237
239
  /** InvalidLoanRepayment: Loan repayment amount exceeds synced balances (principal/interest/fees) */
238
- export const OPTION_PROGRAM_ERROR__INVALID_LOAN_REPAYMENT = 0x17de; // 6110
240
+ export const OPTION_PROGRAM_ERROR__INVALID_LOAN_REPAYMENT = 0x17df; // 6111
239
241
  /** RescuePreconditionsNotMet: Rescue preconditions not met: collateral_vault must be short of the remaining debt after theta forfeiture */
240
- export const OPTION_PROGRAM_ERROR__RESCUE_PRECONDITIONS_NOT_MET = 0x17df; // 6111
242
+ export const OPTION_PROGRAM_ERROR__RESCUE_PRECONDITIONS_NOT_MET = 0x17e0; // 6112
241
243
 
242
244
  export type OptionProgramError =
243
245
  | typeof OPTION_PROGRAM_ERROR__ACCOUNT_FROZEN
@@ -351,7 +353,8 @@ export type OptionProgramError =
351
353
  | typeof OPTION_PROGRAM_ERROR__UNDERLYING_ASSET_MISMATCH
352
354
  | typeof OPTION_PROGRAM_ERROR__UNHEALTHY_POSITION
353
355
  | typeof OPTION_PROGRAM_ERROR__UNWIND_REPAY_ACCOUNTS_MISSING
354
- | typeof OPTION_PROGRAM_ERROR__VALIDATION_REQUIRED;
356
+ | typeof OPTION_PROGRAM_ERROR__VALIDATION_REQUIRED
357
+ | typeof OPTION_PROGRAM_ERROR__VOLATILITY_QUOTE_UNAVAILABLE;
355
358
 
356
359
  let optionProgramErrorMessages: Record<OptionProgramError, string> | undefined;
357
360
  if (process.env.NODE_ENV !== "production") {
@@ -468,6 +471,7 @@ if (process.env.NODE_ENV !== "production") {
468
471
  [OPTION_PROGRAM_ERROR__UNHEALTHY_POSITION]: `Health ratio below liquidation threshold`,
469
472
  [OPTION_PROGRAM_ERROR__UNWIND_REPAY_ACCOUNTS_MISSING]: `Unwind repayment accounts are required when active pool loans exist`,
470
473
  [OPTION_PROGRAM_ERROR__VALIDATION_REQUIRED]: `Must call option_validate before borrow/settlement`,
474
+ [OPTION_PROGRAM_ERROR__VOLATILITY_QUOTE_UNAVAILABLE]: `Authority volatility quote unavailable or stale`,
471
475
  };
472
476
  }
473
477
 
@@ -58,6 +58,7 @@ export type BuyFromPoolInstruction<
58
58
  TAccountLongMint extends string | AccountMeta<string> = string,
59
59
  TAccountUnderlyingMint extends string | AccountMeta<string> = string,
60
60
  TAccountMarketData extends string | AccountMeta<string> = string,
61
+ TAccountVolatilityQuoteAccount extends string | AccountMeta<string> = string,
61
62
  TAccountSwitchboardQueue extends string | AccountMeta<string> = string,
62
63
  TAccountSlotHashesSysvar extends string | AccountMeta<string> =
63
64
  "SysvarS1otHashes111111111111111111111111111",
@@ -97,6 +98,9 @@ export type BuyFromPoolInstruction<
97
98
  TAccountMarketData extends string
98
99
  ? ReadonlyAccount<TAccountMarketData>
99
100
  : TAccountMarketData,
101
+ TAccountVolatilityQuoteAccount extends string
102
+ ? ReadonlyAccount<TAccountVolatilityQuoteAccount>
103
+ : TAccountVolatilityQuoteAccount,
100
104
  TAccountSwitchboardQueue extends string
101
105
  ? ReadonlyAccount<TAccountSwitchboardQueue>
102
106
  : TAccountSwitchboardQueue,
@@ -190,6 +194,7 @@ export type BuyFromPoolAsyncInput<
190
194
  TAccountLongMint extends string = string,
191
195
  TAccountUnderlyingMint extends string = string,
192
196
  TAccountMarketData extends string = string,
197
+ TAccountVolatilityQuoteAccount extends string = string,
193
198
  TAccountSwitchboardQueue extends string = string,
194
199
  TAccountSlotHashesSysvar extends string = string,
195
200
  TAccountInstructionsSysvar extends string = string,
@@ -218,6 +223,7 @@ export type BuyFromPoolAsyncInput<
218
223
  underlyingMint: Address<TAccountUnderlyingMint>;
219
224
  /** Market data account (provides risk-free rate and switchboard_feed_id) */
220
225
  marketData: Address<TAccountMarketData>;
226
+ volatilityQuoteAccount: Address<TAccountVolatilityQuoteAccount>;
221
227
  switchboardQueue: Address<TAccountSwitchboardQueue>;
222
228
  slotHashesSysvar?: Address<TAccountSlotHashesSysvar>;
223
229
  instructionsSysvar?: Address<TAccountInstructionsSysvar>;
@@ -249,6 +255,7 @@ export async function getBuyFromPoolInstructionAsync<
249
255
  TAccountLongMint extends string,
250
256
  TAccountUnderlyingMint extends string,
251
257
  TAccountMarketData extends string,
258
+ TAccountVolatilityQuoteAccount extends string,
252
259
  TAccountSwitchboardQueue extends string,
253
260
  TAccountSlotHashesSysvar extends string,
254
261
  TAccountInstructionsSysvar extends string,
@@ -271,6 +278,7 @@ export async function getBuyFromPoolInstructionAsync<
271
278
  TAccountLongMint,
272
279
  TAccountUnderlyingMint,
273
280
  TAccountMarketData,
281
+ TAccountVolatilityQuoteAccount,
274
282
  TAccountSwitchboardQueue,
275
283
  TAccountSlotHashesSysvar,
276
284
  TAccountInstructionsSysvar,
@@ -295,6 +303,7 @@ export async function getBuyFromPoolInstructionAsync<
295
303
  TAccountLongMint,
296
304
  TAccountUnderlyingMint,
297
305
  TAccountMarketData,
306
+ TAccountVolatilityQuoteAccount,
298
307
  TAccountSwitchboardQueue,
299
308
  TAccountSlotHashesSysvar,
300
309
  TAccountInstructionsSysvar,
@@ -322,6 +331,10 @@ export async function getBuyFromPoolInstructionAsync<
322
331
  longMint: { value: input.longMint ?? null, isWritable: false },
323
332
  underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
324
333
  marketData: { value: input.marketData ?? null, isWritable: false },
334
+ volatilityQuoteAccount: {
335
+ value: input.volatilityQuoteAccount ?? null,
336
+ isWritable: false,
337
+ },
325
338
  switchboardQueue: {
326
339
  value: input.switchboardQueue ?? null,
327
340
  isWritable: false,
@@ -439,6 +452,7 @@ export async function getBuyFromPoolInstructionAsync<
439
452
  getAccountMeta(accounts.longMint),
440
453
  getAccountMeta(accounts.underlyingMint),
441
454
  getAccountMeta(accounts.marketData),
455
+ getAccountMeta(accounts.volatilityQuoteAccount),
442
456
  getAccountMeta(accounts.switchboardQueue),
443
457
  getAccountMeta(accounts.slotHashesSysvar),
444
458
  getAccountMeta(accounts.instructionsSysvar),
@@ -465,6 +479,7 @@ export async function getBuyFromPoolInstructionAsync<
465
479
  TAccountLongMint,
466
480
  TAccountUnderlyingMint,
467
481
  TAccountMarketData,
482
+ TAccountVolatilityQuoteAccount,
468
483
  TAccountSwitchboardQueue,
469
484
  TAccountSlotHashesSysvar,
470
485
  TAccountInstructionsSysvar,
@@ -488,6 +503,7 @@ export type BuyFromPoolInput<
488
503
  TAccountLongMint extends string = string,
489
504
  TAccountUnderlyingMint extends string = string,
490
505
  TAccountMarketData extends string = string,
506
+ TAccountVolatilityQuoteAccount extends string = string,
491
507
  TAccountSwitchboardQueue extends string = string,
492
508
  TAccountSlotHashesSysvar extends string = string,
493
509
  TAccountInstructionsSysvar extends string = string,
@@ -516,6 +532,7 @@ export type BuyFromPoolInput<
516
532
  underlyingMint: Address<TAccountUnderlyingMint>;
517
533
  /** Market data account (provides risk-free rate and switchboard_feed_id) */
518
534
  marketData: Address<TAccountMarketData>;
535
+ volatilityQuoteAccount: Address<TAccountVolatilityQuoteAccount>;
519
536
  switchboardQueue: Address<TAccountSwitchboardQueue>;
520
537
  slotHashesSysvar?: Address<TAccountSlotHashesSysvar>;
521
538
  instructionsSysvar?: Address<TAccountInstructionsSysvar>;
@@ -547,6 +564,7 @@ export function getBuyFromPoolInstruction<
547
564
  TAccountLongMint extends string,
548
565
  TAccountUnderlyingMint extends string,
549
566
  TAccountMarketData extends string,
567
+ TAccountVolatilityQuoteAccount extends string,
550
568
  TAccountSwitchboardQueue extends string,
551
569
  TAccountSlotHashesSysvar extends string,
552
570
  TAccountInstructionsSysvar extends string,
@@ -569,6 +587,7 @@ export function getBuyFromPoolInstruction<
569
587
  TAccountLongMint,
570
588
  TAccountUnderlyingMint,
571
589
  TAccountMarketData,
590
+ TAccountVolatilityQuoteAccount,
572
591
  TAccountSwitchboardQueue,
573
592
  TAccountSlotHashesSysvar,
574
593
  TAccountInstructionsSysvar,
@@ -592,6 +611,7 @@ export function getBuyFromPoolInstruction<
592
611
  TAccountLongMint,
593
612
  TAccountUnderlyingMint,
594
613
  TAccountMarketData,
614
+ TAccountVolatilityQuoteAccount,
595
615
  TAccountSwitchboardQueue,
596
616
  TAccountSlotHashesSysvar,
597
617
  TAccountInstructionsSysvar,
@@ -618,6 +638,10 @@ export function getBuyFromPoolInstruction<
618
638
  longMint: { value: input.longMint ?? null, isWritable: false },
619
639
  underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
620
640
  marketData: { value: input.marketData ?? null, isWritable: false },
641
+ volatilityQuoteAccount: {
642
+ value: input.volatilityQuoteAccount ?? null,
643
+ isWritable: false,
644
+ },
621
645
  switchboardQueue: {
622
646
  value: input.switchboardQueue ?? null,
623
647
  isWritable: false,
@@ -692,6 +716,7 @@ export function getBuyFromPoolInstruction<
692
716
  getAccountMeta(accounts.longMint),
693
717
  getAccountMeta(accounts.underlyingMint),
694
718
  getAccountMeta(accounts.marketData),
719
+ getAccountMeta(accounts.volatilityQuoteAccount),
695
720
  getAccountMeta(accounts.switchboardQueue),
696
721
  getAccountMeta(accounts.slotHashesSysvar),
697
722
  getAccountMeta(accounts.instructionsSysvar),
@@ -718,6 +743,7 @@ export function getBuyFromPoolInstruction<
718
743
  TAccountLongMint,
719
744
  TAccountUnderlyingMint,
720
745
  TAccountMarketData,
746
+ TAccountVolatilityQuoteAccount,
721
747
  TAccountSwitchboardQueue,
722
748
  TAccountSlotHashesSysvar,
723
749
  TAccountInstructionsSysvar,
@@ -754,27 +780,28 @@ export type ParsedBuyFromPoolInstruction<
754
780
  underlyingMint: TAccountMetas[3];
755
781
  /** Market data account (provides risk-free rate and switchboard_feed_id) */
756
782
  marketData: TAccountMetas[4];
757
- switchboardQueue: TAccountMetas[5];
758
- slotHashesSysvar: TAccountMetas[6];
759
- instructionsSysvar: TAccountMetas[7];
783
+ volatilityQuoteAccount: TAccountMetas[5];
784
+ switchboardQueue: TAccountMetas[6];
785
+ slotHashesSysvar: TAccountMetas[7];
786
+ instructionsSysvar: TAccountMetas[8];
760
787
  /** Buyer's position account (created for tracking) */
761
- buyerPosition: TAccountMetas[8];
788
+ buyerPosition: TAccountMetas[9];
762
789
  /** Buyer's LONG token account (receives LONG tokens) */
763
- buyerOptionAccount: TAccountMetas[9];
790
+ buyerOptionAccount: TAccountMetas[10];
764
791
  /** Premium payment mint (must match premium_vault.mint on-chain) */
765
- paymentMint: TAccountMetas[10];
792
+ paymentMint: TAccountMetas[11];
766
793
  /** Buyer's payment account (source of premium) */
767
- buyerPaymentAccount: TAccountMetas[11];
794
+ buyerPaymentAccount: TAccountMetas[12];
768
795
  /** Pool's LONG escrow (source of LONG tokens) */
769
- escrowLongAccount: TAccountMetas[12];
796
+ escrowLongAccount: TAccountMetas[13];
770
797
  /** Pool's premium vault (receives premium) */
771
- premiumVault: TAccountMetas[13];
798
+ premiumVault: TAccountMetas[14];
772
799
  /** Collateral pool (settlement mint for buyer position tracking) */
773
- collateralPool: TAccountMetas[14];
774
- buyer: TAccountMetas[15];
775
- tokenProgram: TAccountMetas[16];
776
- associatedTokenProgram: TAccountMetas[17];
777
- systemProgram: TAccountMetas[18];
800
+ collateralPool: TAccountMetas[15];
801
+ buyer: TAccountMetas[16];
802
+ tokenProgram: TAccountMetas[17];
803
+ associatedTokenProgram: TAccountMetas[18];
804
+ systemProgram: TAccountMetas[19];
778
805
  };
779
806
  data: BuyFromPoolInstructionData;
780
807
  };
@@ -787,7 +814,7 @@ export function parseBuyFromPoolInstruction<
787
814
  InstructionWithAccounts<TAccountMetas> &
788
815
  InstructionWithData<ReadonlyUint8Array>,
789
816
  ): ParsedBuyFromPoolInstruction<TProgram, TAccountMetas> {
790
- if (instruction.accounts.length < 19) {
817
+ if (instruction.accounts.length < 20) {
791
818
  // TODO: Coded error.
792
819
  throw new Error("Not enough accounts");
793
820
  }
@@ -805,6 +832,7 @@ export function parseBuyFromPoolInstruction<
805
832
  longMint: getNextAccount(),
806
833
  underlyingMint: getNextAccount(),
807
834
  marketData: getNextAccount(),
835
+ volatilityQuoteAccount: getNextAccount(),
808
836
  switchboardQueue: getNextAccount(),
809
837
  slotHashesSysvar: getNextAccount(),
810
838
  instructionsSysvar: getNextAccount(),