|
1 | 1 | # @mrgnlabs/marginfi-client-v2 |
2 | 2 |
|
| 3 | +## 5.0.0 |
| 4 | + |
| 5 | +### Major Changes |
| 6 | + |
| 7 | +- 9215e8f: # Major SDK Update 🚀 |
| 8 | + |
| 9 | + This release brings **significant improvements**, optimizations, and new features to the SDK—focusing on transaction builders, processing pipelines, and staked collateral support. **Please update your implementation** if you are using any transaction builders, as there are **context and syntax changes** (see provided JSDoc documentation for each function). |
| 10 | + |
| 11 | + *** |
| 12 | + |
| 13 | + ## 🔄 Transaction Builder Enhancements |
| 14 | + |
| 15 | + - **Updated Builder Syntax** |
| 16 | + |
| 17 | + - `account.make<Action>Tx` functions now include minor context and syntax changes to allow for greater customization. |
| 18 | + - **Flashloan Builders:** |
| 19 | + - Builders such as `makeLooperTx` and `makeRepayWithCollateralTx` have been revamped to optimize transaction size and prevent instruction overflow. |
| 20 | + |
| 21 | + - **Action Required:** |
| 22 | + - **Update Your Code:** Ensure you update your transaction builder usage to match the new syntax. |
| 23 | + |
| 24 | + *** |
| 25 | + |
| 26 | + ## 💼 Extended Solana Transaction Types |
| 27 | + |
| 28 | + All builders now return a `SolanaTransaction`, an extension of the standard Solana web3.js `Transaction` and `VersionedTransaction`. This extended type includes: |
| 29 | + |
| 30 | + - **`type`:** Enum representing the available SDK actions. |
| 31 | + - **`signers`:** An array of signers required for the transaction. |
| 32 | + - **`addressLookupTables`:** Lookup tables used during transaction signing and decompilation. |
| 33 | + - **`unitsConsumed`:** A value (default or dynamically updated) to help compute the priority fee, ensuring an optimal landing rate. |
| 34 | + |
| 35 | + **Benefits:** |
| 36 | + |
| 37 | + - Improved transaction inspection and decompilation. |
| 38 | + - Enhanced integration with custom transaction processing pipelines. |
| 39 | + |
| 40 | + *** |
| 41 | + |
| 42 | + ## ⚙️ Advanced Transaction Processing Pipeline |
| 43 | + |
| 44 | + The new processing flow is modular and highly optimized for both standard and flashloan transactions. There are two ways to access the pipeline: |
| 45 | + |
| 46 | + 1. **Within MarginfiAccountWrapper Actions:** |
| 47 | + |
| 48 | + - All account actions (e.g., deposit, withdraw, borrow) include the processing pipeline as part of their internal logic. |
| 49 | + |
| 50 | + 2. **Standalone from the Client:** |
| 51 | + - Use the standalone function `processTransactions` or leverage prefilled configuration via `client.processTransactions`. |
| 52 | + |
| 53 | + ### Pipeline Features |
| 54 | + |
| 55 | + 1. **Simulate to Fetch Compute Unit (CU) Limits:** |
| 56 | + |
| 57 | + - The transaction is simulated (ignoring the blockhash) to determine the required compute unit size. |
| 58 | + - The CU limit instruction is then updated accordingly. |
| 59 | + |
| 60 | + 2. **Transaction Formatting via `formatTransactions`:** |
| 61 | + |
| 62 | + - **Heavily Optimized for Flashloans:** |
| 63 | + - `formatTransactions` is tailored for flashloan transactions to ensure maximum throughput and reliability. |
| 64 | + - **Ad-hoc Integration:** |
| 65 | + - This step can be integrated ad-hoc into your existing transaction processing logic. |
| 66 | + - **Updates Blockhash:** |
| 67 | + - Ensures the transaction uses the most recent blockhash. |
| 68 | + - **Jito Bundles Support:** |
| 69 | + - Appends a bundle tip if the transaction is destined for a jito bundle. |
| 70 | + - Measures transaction size to decide whether the bundle tip should be appended inline or sent as a separate transaction. |
| 71 | + - _Note:_ Flashloan transactions will always have the bundle tip appended as a separate transaction due to fixed instruction index constraints. |
| 72 | + - **Accurate Priority Fee Assignment:** |
| 73 | + - Uses the computed CU size from simulation to assign a precise priority fee when sending over RPC. |
| 74 | + - **Optional Transaction Tagging:** |
| 75 | + - If `addTransactionTags` is enabled, a tag corresponding to the transaction action is added for easier parsing. |
| 76 | + |
| 77 | + 3. **Pre-Execution Simulation:** |
| 78 | + |
| 79 | + - An additional simulation step is performed to validate the transaction before waiting for it to land. |
| 80 | + |
| 81 | + 4. **Flexible Execution:** |
| 82 | + - Transactions are routed through jito bundles or RPC based on your configuration, with built-in fallbacks for optimal execution. |
| 83 | + - Special routing logic is applied for flashloan transactions. |
| 84 | + |
| 85 | + *** |
| 86 | + |
| 87 | + ## ⭐ Additional Enhancements |
| 88 | + |
| 89 | + - **Enhanced Flashloan Support** 🏦 |
| 90 | + |
| 91 | + - Improved flashloan handling and execution. |
| 92 | + - More efficient processing of flashloan transactions. |
| 93 | + |
| 94 | + - **More Configurable SDK Functions** ⚙️ |
| 95 | + |
| 96 | + - New options to fine-tune SDK behavior. |
| 97 | + - Increased flexibility for integrators. |
| 98 | + |
| 99 | + - **Optimized Flashloan Transaction Processing** ⚡ |
| 100 | + |
| 101 | + - Reduced overhead. |
| 102 | + - Improved speed and reliability. |
| 103 | + |
| 104 | + - **Full JSDoc Support** 📖 |
| 105 | + |
| 106 | + - Comprehensive documentation for improved developer experience. |
| 107 | + - Enhanced type safety and inline guidance. |
| 108 | + |
| 109 | + - **Staked Collateral Support** 🔐 |
| 110 | + |
| 111 | + - **New Functionality:** |
| 112 | + - The SDK now includes `makeAddPermissionlessStakedBankIx` within the group class to create new staked banks permissionlessly. |
| 113 | + - Pricing functions have been updated to handle this new staked collateral type. |
| 114 | + - **Future Expansion:** |
| 115 | + - This functionality will be further expanded in future releases. |
| 116 | + - For a full implementation (including uploading metadata and creating single SPL stake pools), please refer to: |
| 117 | + `mrgn-ts/apps/marginfi-v2-ui/src/pages/staked-assets/create.tsx`. |
| 118 | + |
| 119 | + - **General Improvements:** |
| 120 | + - Resolved multiple issues from previous versions. |
| 121 | + - Overall performance optimizations and stability improvements. |
| 122 | + |
| 123 | + *** |
| 124 | + |
| 125 | + Feel free to reach out with any questions or feedback regarding these changes. Happy coding! |
| 126 | + |
| 127 | +### Patch Changes |
| 128 | + |
| 129 | +- Updated dependencies [9215e8f] |
| 130 | + - @mrgnlabs/mrgn-common@2.0.0 |
| 131 | + |
3 | 132 | ## 5.0.0-beta.1 |
4 | 133 |
|
5 | 134 | ### Major Changes |
|
0 commit comments