# Changelog

All notable changes to this project will be documented in this file.
Version changes are pinned to SDK releases.

## [0.15.0]

- add setWithdrawOnlyMode for vault.

## [0.13.0]

- Update initializeNormalOption and initializeComboOption to include extra compute requests.

## [0.11.2]

- flex: Fix for closing combo option accounts.

## [0.11.1]

- flex: Add missing accountCloseThresholdSecs state attribute.

## [0.11.0]

- flex: Add ability to close expired option/auction accounts.

## [0.10.0]

- vault: update process withdrawal queue and process deposit queue logic.

## [0.9.3]

- flex: Add HBB sdk constants.

## [0.9.2]

- flex: Add USH and USDH to sdk constants.

## [0.9.0]

- flex: Update initializeOptionV2 to also create a metadata account for the option mint with the name in the format { name: ASSET-TYPE-STRIKE-KIND, symbol: ZFLEX, uri: https://flex.zeta.markets/dashboard }. ([#97](https://github.com/zetamarkets/zeta-flex/pull/97))

## [0.8.8]

- flex: Reduce getPA calls and update all program accounts in a single call. Make update underlyings / options / bids / auctions private in favour of updateState. ([#96](https://github.com/zetamarkets/zeta-flex/pull/96))
- flex: Add underlyings to sdk and pyth price feeds. ([#98](https://github.com/zetamarkets/zeta-flex/pull/98))

## [0.8.6]

- client: return `TransactionMethodReturnData` that includes a list of signer and the instructions. ([#95](https://github.com/zetamarkets/zeta-flex/pull/95))

## [0.8.5]

- client: `InitializeOption` takes in optional argument to return a struct `{ ixs: TransactionInstruction[], signers: Signer[] }` instead of executing the transaction. ([#94](https://github.com/zetamarkets/zeta-flex/pull/94))

## [0.8.4]

- client: `InitializeOption` takes in optional argument to only return a `TransactionInstruction[]` instead of executing the transaction. ([#93](https://github.com/zetamarkets/zeta-flex/pull/93))
- utils: `createTokenAccountInstruction` now allows addresses off the curve. ([#93](https://github.com/zetamarkets/zeta-flex/pull/93))

## [0.8.3]

- flex: Fix a bug in client initializeCombooption to account for fees. ([#90](https://github.com/zetamarkets/zeta-flex/pull/90))

## [0.8.2]

- flex: Fix a bug in client.bids.optionInfo to store both comboOption key and normalOption key. ([#86](https://github.com/zetamarkets/zeta-flex/pull/86))
- flex: Change getAuctionByKey and getBidByKey to return null instead of throwing an error. ([#86](https://github.com/zetamarkets/zeta-flex/pull/86))

## [0.8.1]

- flex: Auction.optionInfo is now (Option | ComboOption | undefined). ([#86](https://github.com/zetamarkets/zeta-flex/pull/86))

### Breaking

- flex: Allow bid_currency_mint in InitializeAuction context to be set to Pubkey::default() for any bid currency auctions, it is now no longer deserialized in the context. ([#77](https://github.com/zetamarkets/zeta-flex/pull/77))
- flex: Auction.creatorBidCurrencyTokenAccount has been deprecated. ([#77](https://github.com/zetamarkets/zeta-flex/pull/77))
- flex: Bid.bidderAuctionTokenAccount has been deprecated, renamed to Bid.bidCurrencyMint. ([#77](https://github.com/zetamarkets/zeta-flex/pull/77))

## [0.8.0]

- flex: Change instruction format for expire option. ([#75](https://github.com/zetamarkets/zeta-flex/pull/75))
- flex: Add in functionality for new SettlementAccount. ([#75](https://github.com/zetamarkets/zeta-flex/pull/75))
- flex: Upgrade @solana web3.js version and remove async program address calls. ([#75](https://github.com/zetamarkets/zeta-flex/pull/75))
- flex: Deprecate initializeOption and initializeComboOption for initializeOptionV2 and initializeComboOptionV2. ([#76](https://github.com/zetamarkets/zeta-flex/pull/76))
- flex: Add in mint option fees. ([#76](https://github.com/zetamarkets/zeta-flex/pull/76))
- flex: Add whitelist fees accounts & refactor the state account to store a feeRecipient + mint option fee (in tenth of a bps). ([#76](https://github.com/zetamarkets/zeta-flex/pull/76))
- flex: Update sdk to allow for auctions with any bid currency. ([#77](https://github.com/zetamarkets/zeta-flex/pull/77))
- flex: Update sdk for auctions to store comboOption metadata as well. ([#77](https://github.com/zetamarkets/zeta-flex/pull/77))
- vault: Update sdk with all breaking changes outlined in CHANGELOG. ([#77](https://github.com/zetamarkets/zeta-flex/pull/77))
- vault: Update sdk to remove unnecessary async in PDA creation. ([#77](https://github.com/zetamarkets/zeta-flex/pull/77))

## [0.6.5]

- flex: Change optionInfo.strike from number to BN.
- This can still cause failures if ComboOptions have strikes > 53 bits or if attempting to exercise a physically settled option with a strike > 53 bits.

## [0.6.2]

- flex: Add zeta mock-cusdc for solend mapping and underlying mapping.
- flex: Add portal eth to underlying mapping.

## [0.6.1]

- flex: Small bug fix on client.bidAuction where the creation of an auction_token_account wasn't done. ([#70](https://github.com/zetamarkets/zeta-flex/pull/70))

## [0.6.0]

- flex: Add Enum for differentiating between different FlexOptionTypes { Normal, Combo }. ([#70](https://github.com/zetamarkets/zeta-flex/pull/70))
- flex: Allow expiry of both Normal and Combo option types by specifying FlexOptionType. ([#70](https://github.com/zetamarkets/zeta-flex/pull/70))
- flex: Add helper methods for fetching comboOption metadata. ([#70](https://github.com/zetamarkets/zeta-flex/pull/70))
- flex-client; Refactor old instructions and creating wrapped native token account instructions. ([#70](https://github.com/zetamarkets/zeta-flex/pull/70))
- flex-client: Add initializeComboOption and exerciseComboOption specific instructions for comboOptions. ([#70](https://github.com/zetamarkets/zeta-flex/pull/70))
- flex-client: Refactor to allow other option related instructions to work based on flexOptionType passed in. ([#70](https://github.com/zetamarkets/zeta-flex/pull/70))
- flex-utils: Add in util function to calculate / simulate how much collateral an arbitrary set of comboOption params will require. ([#70](https://github.com/zetamarkets/zeta-flex/pull/70))

## [0.5.3]

- vault: Add in GMT to underlyings list.

## [0.5.2]

- vault: Patch process withdraw queue.

## [0.5.1]

- flex: SDK bug fixes in some instruction builders, cancelAuction, bidAuction and initializeAuction. ([#69](https://github.com/zetamarkets/zeta-flex/pull/69))

## [0.5.0]

- flex: Bump anchor version to 0.22.1. ([#61](https://github.com/zetamarkets/zeta-flex/pull/61))
- vault: Bump anchor version to 0.22.1. ([#61](https://github.com/zetamarkets/flex-vault/pull/47))
- flex: Bump spl-token ts package to 0.2.0. ([#63](https://github.com/zetamarkets/zeta-flex/pull/63))
- flex-client: Add full functionality to the flex client. ([#48](https://github.com/zetamarkets/zeta-flex/pull/48))
- utils: removal of more helper functions that can be found in spl-token 0.2.0. ([#48](https://github.com/zetamarkets/zeta-flex/pull/48))
- SDK: Bump anchor version to 0.24.2. ([#67](https://github.com/zetamarkets/zeta-flex/pull/67))
- SDK: Bump solana/web3.js version to 1.39.1. ([#67](https://github.com/zetamarkets/zeta-flex/pull/67))
- flex: update idl to the latest version. ([#68](https://github.com/zetamarkets/zeta-flex/pull/68))

### Breaking

- Nonce arguments removed from instructions where previously required.
- IDL error codes have changed to reflect the new anchor schema.
- getTokenAccountInfo and getMintInfo now removed from the sdk in common utils. Use the spl-token package functions instead (getAccount, getMint respectively). ([#63](https://github.com/zetamarkets/zeta-flex/pull/63))
- in utils, getAssociatedTokenAddress, createAssociatedTokenAccount instructions have now been removed. use the exact same equivalent instructions in spl-token 0.2.0. ([#48](https://github.com/zetamarkets/zeta-flex/pull/48))
- client token account amounts are now typed as bigint instead of number. ([#48](https://github.com/zetamarkets/zeta-flex/pull/48))

## [0.4.2]

- vault: Create user redeemable token accounts if they don't exist when processing deposit queue.

## [0.4.1]

- flex-client: expired positions now contain cash settled positions after expiry and only physical settled positions within the settlement window.

## [0.4.0]

- flex: Physically options release with corrections and fixes. ([#59](https://github.com/zetamarkets/zeta-flex/pull/59))

## [0.3.1]

- flex: Physically settled options changes. ([#59](https://github.com/zetamarkets/zeta-flex/pull/59))

### Breaking

- flex-client: exerciseOption now takes in an optional argument for number of option tokens the user would like to exercise. ([#59](https://github.com/zetamarkets/zeta-flex/pull/59))

## [0.3.0] - 2022-03-23

- Small changes to constants for mainnet cTokens feature.

## [0.2.16] - 2022-03-21

- common-constants: Change UNDERLYINGS_MAP to PUBKEY_TO_UNDERLYINGS_MAP, added in UNDERLYINGS_TO_PUBKEY_MAP. ([#58](https://github.com/zetamarkets/zeta-flex/pull/58))
- common-utils: add in getUnderlyingToKeyMapping(), this will provide a map from the underlying string to the mint pubkey. ([#58](https://github.com/zetamarkets/zeta-flex/pull/58))
- flex: Changed the underlying account structure by adding in a new underlying type. ([#58](https://github.com/zetamarkets/zeta-flex/pull/58))
- flex: Added in expire option logic to allow for expiring solend ctoken options. ([#58](https://github.com/zetamarkets/zeta-flex/pull/58))
- solend-utils: A collection of helper functions for interacting with solend accounts ([#58](https://github.com/zetamarkets/zeta-flex/pull/58))
- solend-constants: Important constants stored to interact with Solend protocol. ([#58](https://github.com/zetamarkets/zeta-flex/pull/58))

## [0.2.15] - 2022-03-01

- general: Small fixes for integration tests.
- 0.2.14 (skipped)

## [0.2.13] - 2022-02-21

- flex client: Add bid currency mint to bids. ([#45](https://github.com/zetamarkets/zeta-flex/pull/45))
- vault: Update constant for maximum queue process limit. ([#47](https://github.com/zetamarkets/zeta-flex/pull/47))
- vault: Optimise polling for deposit and withdrawal queues. ([#50](https://github.com/zetamarkets/zeta-flex/pull/50))
- vault: Add creation of user token account for processing withdrawals. ([#52](https://github.com/zetamarkets/zeta-flex/pull/52))

## [0.2.11] - 2022-02-17

- vault: Add `updateFeeRecipients` instruction. ([#49](https://github.com/zetamarkets/zeta-flex/pull/49))
- vault: Return transaction signature on transaction calls. ([#49](https://github.com/zetamarkets/zeta-flex/pull/49))

## [0.2.9] - 2022-02-11

- flex client: Use `getTokenAccountsByOwner` due to RPC limitations. ([#43](https://github.com/zetamarkets/zeta-flex/pull/43))
- flex client: Store option account in client bids for the case that the auction doesn't exist i.e. was cancelled. ([#43](https://github.com/zetamarkets/zeta-flex/pull/43))

## [0.2.8] - 2022-02-11

- flex client: Fix exercise for put options. ([#43](https://github.com/zetamarkets/zeta-flex/pull/43))

## [0.2.7] - 2022-02-10

- common: Fix typo in underlying mapping. ([#42](https://github.com/zetamarkets/zeta-flex/pull/42))

## [0.2.6] - 2022-02-10

- common: Add more underlyings to mapping and pyth feeds. ([#41](https://github.com/zetamarkets/zeta-flex/pull/41))

## [0.2.5] - 2022-02-10

- common: add more pyth feeds to mapping and add in mock srm token.

## [0.2.4] - 2022-02-07

- flex client: Optimise `updateState` call. Clients don't need to call `Flex.updateState` as that is baked into the `client.updateState`. ([#34](https://github.com/zetamarkets/zeta-flex/pull/34))
- flex: Remove double iteration over options and auctions in polls. ([#34](https://github.com/zetamarkets/zeta-flex/pull/34))
- flex: Support manual print oracle type. ([#38](https://github.com/zetamarkets/zeta-flex/pull/38)

## [0.2.3] - 2022-02-07

- flex: Return transaction signatures for client methods. ([#32](https://github.com/zetamarkets/zeta-flex/pull/32))
- flex: Remove get program address from flex object update state. ([#32](https://github.com/zetamarkets/zeta-flex/pull/32))

## [0.2.2] - 2022-02-07

- flex: Add `overrideVaultEpochTimes` instruction and rework updateAdmin instruction. ([#33](https://github.com/zetamarkets/zeta-flex/pull/33))

## [0.2.1] - 2022-02-04

- network: change mainnet_beta enum. ([#31](https://github.com/zetamarkets/zeta-flex/pull/31))

## [0.2.0] - 2022-02-03

- constants: Add more pyth feeds to mapping. ([#30](https://github.com/zetamarkets/zeta-flex/pull/30))

## [0.1.12] 2022-02-02

- flex: Client changes to make state more stable. ([#28](https://github.com/zetamarkets/zeta-flex/pull/28))
- flex: Update exercise option instruction. ([#28](https://github.com/zetamarkets/zeta-flex/pull/28))

## [0.1.11] 2022-02-02

- flex: Update option account to have new fields for settlement. ([#25](https://github.com/zetamarkets/zeta-flex/pull/25))

## [0.1.10] 2023-02-01

- general: update underlyings map to support localnet. ([#23](https://github.com/zetamarkets/zeta-flex/pull/23))

## [0.1.9] 2022-02-01

- vault: Minor fix for getting auctions for vaults. ([#23](https://github.com/zetamarkets/zeta-flex/pull/23))

## [0.1.8] 2022-01-31

- vault: Minor fixes to support multiple vault processing and interaction. ([#21](https://github.com/zetamarkets/zeta-flex/pull/21))
- flex: Added safety in storing option information in JS. ([#21](https://github.com/zetamarkets/zeta-flex/pull/21))

## [0.1.7] 2022-01-28

- flex: set array fields to empty list by default.

## [0.1.6] 2022-01-28

- skip due to npm issue.

## [0.1.5] 2022-01-28

- flex: refactor program files. ([#17](https://github.com/zetamarkets/zeta-flex/pull/17))
- flex: refactor to support flex puts. ([#18](https://github.com/zetamarkets/zeta-flex/pull/18))
- flex: move native account closure to sdk tx creation. ([#18](https://github.com/zetamarkets/zeta-flex/pull/18))

## [0.1.4] 2022-01-28

- vault: Add in functionality for queued deposits and withdrawals. ([#16](https://github.com/zetamarkets/zeta-flex/pull/16))

## [0.1.3] 2022-01-22

- flex: Fix `getClockTimestamp` for front end usage. ([#10](https://github.com/zetamarkets/zeta-flex/pull/10))
- vault: Add data fetching tools and types. ([#14](https://github.com/zetamarkets/zeta-flex/pull/14))
- vault: Add withdrawal and deposit events. ([#14](https://github.com/zetamarkets/zeta-flex/pull/14))

## [0.1.2] 2022-01-18

- vault: Add deposit limit. ([#10](https://github.com/zetamarkets/zeta-flex/pull/10))
- vault: Add epoch sequence number. ([#10](https://github.com/zetamarkets/zeta-flex/pull/10))
- flex-client: Add in more instructions that require wrapped native accounts. ([#11](https://github.com/zetamarkets/zeta-flex/pull/11))
- vault-client: Add in instructions required for extra test cases. ([#11](https://github.com/zetamarkets/zeta-flex/pull/11))

## [0.1.1] 2022-01-12

- dependency: Bump solana web3 dependency to 1.31.0

## [0.1.0] 2022-01-12

- vault: Handle core functionality to interact with the vault program and CPIs to the flex program.
- general: core functionality for client and flex added. ([#2](https://github.com/zetamarkets/zeta-flex/pull/2))
- client: Able to bidAuction, cancelBid, excerciseOptions. ([#2](https://github.com/zetamarkets/zeta-flex/pull/2))
- client: Able to fetch all option positions, bids and relevant token accounts. ([#2](https://github.com/zetamarkets/zeta-flex/pull/2))
- flex: Able to initializeUnderlying, initializeState, expireOptionOverride. ([#2](https://github.com/zetamarkets/zeta-flex/pull/2))
- flex: Able to fetch all live auctions, all auctions, all options. ([#2](https://github.com/zetamarkets/zeta-flex/pull/2))
- flex: all auctions have relevant option information and their associated bids stored with them, in the case with no option or bids these fields are undefined. ([#2](https://github.com/zetamarkets/zeta-flex/pull/2))
- general: Flex sdk upgrades that will make using it easier, including adding more constants, cleaning up Flex client and Flex object. ([#6](https://github.com/zetamarkets/zeta-flex/pull/6))
- flex-client: Reduce the number of account fetches required to populate bids ([#6](https://github.com/zetamarkets/zeta-flex/pull/6))
- flex-client: Handle sol bid currency auctions. ([#6](https://github.com/zetamarkets/zeta-flex/pull/6))
- flex-client: Handle more cases where users have no option token account. ([#6](https://github.com/zetamarkets/zeta-flex/pull/6))
- flex: cleanup some of the types and remove unnecessary attributes. Add in more functionality for different use cases. ([#6](https://github.com/zetamarkets/zeta-flex/pull/6))
