@epicentral/sos-sdk 0.6.0-alpha → 0.6.2-alpha

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/README.md CHANGED
@@ -89,6 +89,22 @@ Additional modules:
89
89
 
90
90
  Borrow/repay for writers: use `buildOptionMintTransactionWithDerivation` (with vault/poolLoan) and `buildRepayPoolLoanFromCollateralInstruction` or `buildUnwindWriterUnsoldWithLoanRepayment`.
91
91
 
92
+ ### Transaction size and Address Lookup Tables
93
+
94
+ Option mint (and buy/close) transactions exceed Solana's 1232-byte limit without compression. If you see **"encoding overruns Uint8Array"** when minting, pass `network` to `sendBuiltTransaction`:
95
+
96
+ ```ts
97
+ await sendBuiltTransaction({
98
+ instructions: tx.instructions,
99
+ rpc,
100
+ rpcSubscriptions,
101
+ feePayer: walletSigner,
102
+ network: "devnet", // or "mainnet" — auto-includes lookup table when configured
103
+ });
104
+ ```
105
+
106
+ Or pass `addressLookupTableAddresses: [getLookupTableAddressForNetwork("devnet")]` when non-null. Mainnet lookup table is `null` by default; create one via `yarn update:lookuptable` for mainnet.
107
+
92
108
  ### Token account closing (option mint and close long)
93
109
 
94
110
  - **Option mint (seller/writer):** After `option_mint`, all LONG tokens go to the pool escrow; the maker's LONG ATA is left with zero balance. The SDK **automatically appends an SPL CloseAccount instruction** (when `closeMakerLongAccount` is not set to `false`) so the maker reclaims rent. Use `buildOptionMintTransaction` or `buildOptionMintTransactionWithDerivation`; pass `closeMakerLongAccount: false` to skip closing the LONG ATA.
@@ -115,6 +131,15 @@ Borrow/repay for writers: use `buildOptionMintTransactionWithDerivation` (with v
115
131
  | `getCreateAssociatedTokenIdempotentInstructionWithAddress` | Creates ATA if missing (idempotent). |
116
132
  | `NATIVE_MINT` | WSOL mint address. |
117
133
 
134
+ ### Oracle / Switchboard
135
+
136
+ | Function | Description |
137
+ |----------|-------------|
138
+ | `resolveSwitchboardFeedFromMarketData` | Resolves Switchboard feed address from market data account. |
139
+ | `buildSwitchboardPullFeedUpdate` | Builds Switchboard pull-feed update instructions for prepending to trade transactions. |
140
+
141
+ See [Frontend Switchboard Integration](../../docs/FRONTEND_SWITCHBOARD_INTEGRATION.md) for full setup and usage.
142
+
118
143
  ## Multi-Collateral Settlement
119
144
 
120
145
  The SDK supports universal multi-collateral settlement, allowing writers to use ANY supported asset as collateral for options (not just the underlying). This enables:
@@ -10,7 +10,9 @@ export const LOOKUP_TABLE_ADDRESSES: Record<"devnet" | "mainnet", Address | null
10
10
 
11
11
  export const LOOKUP_TABLE_ADDRESS: Address | null = LOOKUP_TABLE_ADDRESSES.devnet;
12
12
 
13
- export function detectNetwork(rpcUrl: string): "devnet" | "mainnet" {
13
+ export type LookupTableNetwork = "devnet" | "mainnet";
14
+
15
+ export function detectNetwork(rpcUrl: string): LookupTableNetwork {
14
16
  const lower = rpcUrl.toLowerCase();
15
17
  return lower.includes("mainnet") ? "mainnet" : "devnet";
16
18
  }
package/index.ts CHANGED
@@ -30,7 +30,12 @@ export * from "./short/preflight";
30
30
 
31
31
  export * from "./omlp/builders";
32
32
  export * from "./omlp/service";
33
- export * from "./oracle/switchboard";
33
+ export {
34
+ resolveSwitchboardFeedFromMarketData,
35
+ buildSwitchboardPullFeedUpdate,
36
+ type SwitchboardPullFeedLike,
37
+ type BuildSwitchboardPullFeedUpdateParams,
38
+ } from "./oracle/switchboard";
34
39
 
35
40
  export {
36
41
  getWrapSOLInstructions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epicentral/sos-sdk",
3
- "version": "0.6.0-alpha",
3
+ "version": "0.6.2-alpha",
4
4
  "private": false,
5
5
  "description": "Solana Option Standard SDK. The frontend-first SDK for Native Options Trading on Solana. Created by Epicentral Labs.",
6
6
  "type": "module",
@@ -21,6 +21,10 @@ import {
21
21
  import type { Instruction } from "@solana/kit";
22
22
  import { toAddress } from "../client/program";
23
23
  import type { AddressLike, BuiltTransaction, KitRpc } from "../client/types";
24
+ import {
25
+ getLookupTableAddressForNetwork,
26
+ type LookupTableNetwork,
27
+ } from "../client/lookup-table";
24
28
 
25
29
  export interface SendBuiltTransactionParams extends BuiltTransaction {
26
30
  rpc: KitRpc;
@@ -29,7 +33,18 @@ export interface SendBuiltTransactionParams extends BuiltTransaction {
29
33
  commitment?: "processed" | "confirmed" | "finalized";
30
34
  computeUnitLimit?: number;
31
35
  computeUnitPriceMicroLamports?: number;
36
+ /**
37
+ * Address Lookup Table addresses to compress the transaction.
38
+ * REQUIRED for option_mint and other large transactions to avoid
39
+ * "encoding overruns Uint8Array" (Solana's 1232-byte tx limit).
40
+ * Use getLookupTableAddressForNetwork(network) or pass network to auto-include.
41
+ */
32
42
  addressLookupTableAddresses?: AddressLike[];
43
+ /**
44
+ * When set, automatically includes the option program's lookup table for this network.
45
+ * Use this when sending option_mint, buy_from_pool, or other large transactions.
46
+ */
47
+ network?: LookupTableNetwork;
33
48
  }
34
49
 
35
50
  /**
@@ -58,6 +73,15 @@ export async function sendBuiltTransaction(
58
73
  }
59
74
  const allInstructions = [...computeBudgetInstructions, ...params.instructions];
60
75
 
76
+ // Resolve address lookup tables: explicit list, or from network for option program
77
+ let addressLookupTableAddresses = params.addressLookupTableAddresses ?? [];
78
+ if (params.network) {
79
+ const programAlt = getLookupTableAddressForNetwork(params.network);
80
+ if (programAlt && !addressLookupTableAddresses.some((a) => String(a) === String(programAlt))) {
81
+ addressLookupTableAddresses = [programAlt, ...addressLookupTableAddresses];
82
+ }
83
+ }
84
+
61
85
  let txMessage = pipe(
62
86
  createTransactionMessage({ version: 0 }),
63
87
  (tx) => setTransactionMessageFeePayerSigner(params.feePayer, tx),
@@ -65,12 +89,9 @@ export async function sendBuiltTransaction(
65
89
  (tx) => appendTransactionMessageInstructions(allInstructions, tx)
66
90
  );
67
91
 
68
- if (
69
- params.addressLookupTableAddresses &&
70
- params.addressLookupTableAddresses.length > 0
71
- ) {
92
+ if (addressLookupTableAddresses.length > 0) {
72
93
  const addressesByAddressLookupTable: AddressesByLookupTableAddress = {};
73
- for (const altAddress of params.addressLookupTableAddresses) {
94
+ for (const altAddress of addressLookupTableAddresses) {
74
95
  const resolvedAddress = toAddress(altAddress);
75
96
  const { data } = await fetchAddressLookupTable(params.rpc, resolvedAddress);
76
97
  addressesByAddressLookupTable[resolvedAddress] = data.addresses;