@epicentral/sos-sdk 0.14.0-beta → 0.14.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.
Files changed (2) hide show
  1. package/accounts/list.ts +22 -0
  2. package/package.json +1 -1
package/accounts/list.ts CHANGED
@@ -146,6 +146,28 @@ export async function fetchWriterPositionsForPool(
146
146
  );
147
147
  }
148
148
 
149
+ /**
150
+ * Fetches every WriterPosition account for the program in a single getProgramAccounts call.
151
+ *
152
+ * Use this instead of calling {@link fetchWriterPositionsForPool} once per pool when you need
153
+ * writer positions across many pools (e.g. option-chain sync). The caller can group the result
154
+ * by `data.optionPool` in memory, turning N RPC round-trips into one.
155
+ */
156
+ export async function fetchAllWriterPositions(
157
+ rpc: KitRpc,
158
+ programId?: AddressLike
159
+ ): Promise<Array<ListedAccount<WriterPosition>>> {
160
+ return fetchAndDecodeProgramAccounts(
161
+ rpc,
162
+ getWriterPositionDecoder(),
163
+ [
164
+ discriminatorFilter(WRITER_POSITION_DISCRIMINATOR),
165
+ { dataSize: BigInt(getWriterPositionSize()) },
166
+ ],
167
+ programId ?? PROGRAM_ID
168
+ );
169
+ }
170
+
149
171
  export async function fetchPositionAccountsByBuyer(
150
172
  rpc: KitRpc,
151
173
  buyer: AddressLike
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epicentral/sos-sdk",
3
- "version": "0.14.0-beta",
3
+ "version": "0.14.1-beta",
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",