@bounded-sh/core 0.0.107 → 0.0.108

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 (36) hide show
  1. package/dist/client/operations.d.ts +9 -1
  2. package/dist/client/solana-operations.d.ts +8 -2
  3. package/dist/client/solana-v1-operations.d.ts +2 -1
  4. package/dist/client/write-outcome.d.ts +32 -0
  5. package/dist/{index-62gjQH30.js → index-BawH-9Rq.js} +220 -194
  6. package/dist/index-BawH-9Rq.js.map +1 -0
  7. package/dist/{index-CLst0IiM.mjs → index-No5Vz0YM.mjs} +218 -193
  8. package/dist/index-No5Vz0YM.mjs.map +1 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.js +3 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/{realtime-store-9SCt1RPf.js → realtime-store-D_M3T5mH.js} +2 -2
  14. package/dist/{realtime-store-9SCt1RPf.js.map → realtime-store-D_M3T5mH.js.map} +1 -1
  15. package/dist/{realtime-store-C9AgPg7U.mjs → realtime-store-iXGbzhjG.mjs} +2 -2
  16. package/dist/{realtime-store-C9AgPg7U.mjs.map → realtime-store-iXGbzhjG.mjs.map} +1 -1
  17. package/dist/{solana-message-Deru1tF1.mjs → solana-message-BBKdydqt.mjs} +2 -2
  18. package/dist/{solana-message-Deru1tF1.mjs.map → solana-message-BBKdydqt.mjs.map} +1 -1
  19. package/dist/{solana-message-Bf2q_JO1.js → solana-message-DQVrh3NC.js} +2 -2
  20. package/dist/{solana-message-Bf2q_JO1.js.map → solana-message-DQVrh3NC.js.map} +1 -1
  21. package/dist/{solana-operations-eTiLgak2.js → solana-operations-CIiyUG3b.js} +63 -16
  22. package/dist/solana-operations-CIiyUG3b.js.map +1 -0
  23. package/dist/{solana-operations-Cm19J14R.mjs → solana-operations-Dtow91W5.mjs} +61 -15
  24. package/dist/solana-operations-Dtow91W5.mjs.map +1 -0
  25. package/dist/{solana-v1-operations-Dxs4XM_F.mjs → solana-v1-operations-BF5aGRmx.mjs} +9 -8
  26. package/dist/solana-v1-operations-BF5aGRmx.mjs.map +1 -0
  27. package/dist/{solana-v1-operations-CnmiKiyj.js → solana-v1-operations-DfZr0cjj.js} +10 -9
  28. package/dist/solana-v1-operations-DfZr0cjj.js.map +1 -0
  29. package/dist/types.d.ts +1 -0
  30. package/package.json +1 -1
  31. package/dist/index-62gjQH30.js.map +0 -1
  32. package/dist/index-CLst0IiM.mjs.map +0 -1
  33. package/dist/solana-operations-Cm19J14R.mjs.map +0 -1
  34. package/dist/solana-operations-eTiLgak2.js.map +0 -1
  35. package/dist/solana-v1-operations-CnmiKiyj.js.map +0 -1
  36. package/dist/solana-v1-operations-Dxs4XM_F.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import type { AuthProvider, MirrorSync, SetResult, SolanaWriteRpc } from '../types';
1
+ import type { AuthProvider, MirrorSync, SetResult, SolanaSubmittedSetResult, SolanaWriteRpc } from '../types';
2
2
  import { type ClientConfig } from './config';
3
3
  import type { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
4
4
  /** Internal overrides for per-request auth and headers. */
@@ -33,6 +33,14 @@ export type RequestOverrides = {
33
33
  };
34
34
  export type SetOptions = {
35
35
  shouldSubmitTx?: boolean;
36
+ /**
37
+ * Called with the signed transaction's `submitted` receipt immediately BEFORE
38
+ * it is broadcast (Solana lanes only). Persist it to reconcile the exact
39
+ * signature and fence with `reconcileSetResult` after a lost response or a
40
+ * reload; a write whose hook never ran was never sent. Throwing aborts the
41
+ * send, and the write then fails as not applied (`before_broadcast`).
42
+ */
43
+ onBroadcast?: (receipt: SolanaSubmittedSetResult) => void | Promise<void>;
36
44
  _overrides?: RequestOverrides;
37
45
  };
38
46
  /**
@@ -1,6 +1,6 @@
1
1
  export { getTransactionJson, SOLANA_MAX_SUPPORTED_TRANSACTION_VERSION } from './solana-transaction-read';
2
2
  import type { VersionedTransaction } from '@solana/web3.js';
3
- import type { AuthProvider, SolanaTransactionResult } from '../types';
3
+ import type { AuthProvider, SolanaFence, SolanaTransactionResult } from '../types';
4
4
  import type { SetOptions } from './operations';
5
5
  /**
6
6
  * Minimal base58 encoder, used ONLY to derive a Solana transaction signature
@@ -136,9 +136,15 @@ export declare function validateServerTransactionSemantics(input: {
136
136
  */
137
137
  export declare const POOFNET_VOID_FEE_PAYER = "CAXES7Tt3KGsSw4A5knQXKKUJZWsrguu6PC7SDBL4oq2";
138
138
  export declare function signPoofnetTransaction(serializedTransaction: string, authProvider: AuthProvider, options: SetOptions | undefined, expectedIntent: ExpectedWriteIntent): Promise<string>;
139
+ /** Receives a signed transaction's identity immediately before it is broadcast; a throw aborts the send. */
140
+ export type BeforeBroadcast = (signed: {
141
+ transactionSignature: string;
142
+ signedTransaction: string;
143
+ fence: SolanaFence;
144
+ }) => void | Promise<void>;
139
145
  export declare function handlePreBuiltTransaction(tx: {
140
146
  serializedTransaction: string;
141
147
  blockhash: string;
142
148
  lastValidBlockHeight: number;
143
149
  network: string;
144
- }, authProvider: AuthProvider, options: SetOptions | undefined, expectedIntent: ExpectedWriteIntent): Promise<SolanaTransactionResult>;
150
+ }, authProvider: AuthProvider, options: SetOptions | undefined, expectedIntent: ExpectedWriteIntent, beforeBroadcast?: BeforeBroadcast): Promise<SolanaTransactionResult>;
@@ -1,9 +1,10 @@
1
1
  import type { AuthProvider, SolanaTransactionResult } from '../types';
2
2
  import type { SetOptions } from './operations';
3
+ import type { BeforeBroadcast } from './solana-operations';
3
4
  import { type ExpectedWriteIntent } from './solana-operations';
4
5
  export declare function handlePreBuiltV1Transaction(tx: {
5
6
  serializedTransaction: string;
6
7
  blockhash: string;
7
8
  lastValidBlockHeight: number;
8
9
  network: string;
9
- }, authProvider: AuthProvider, options: SetOptions | undefined, expectedIntent: ExpectedWriteIntent): Promise<SolanaTransactionResult>;
10
+ }, authProvider: AuthProvider, options: SetOptions | undefined, expectedIntent: ExpectedWriteIntent, beforeBroadcast?: BeforeBroadcast): Promise<SolanaTransactionResult>;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The one tag that says a failed write was definitively NOT applied.
3
+ *
4
+ * A thrown write is otherwise ambiguous to its caller: a lost response to a
5
+ * committed write and a wallet that declined to sign both arrive as an Error.
6
+ * Treating every throw as "maybe landed" wedges money flows on a pending state
7
+ * that can never resolve; treating every throw as "did not land" invites a
8
+ * second transfer beside one that did. So the SDK marks, at the exact point it
9
+ * knows, the throws where nothing was or ever can be applied, and leaves every
10
+ * other throw unmarked (ambiguous: reconcile by reading, never by resubmitting).
11
+ *
12
+ * - `before_broadcast`: failed before any bytes were sent (response validation,
13
+ * blockhash refresh, the wallet declining or failing to sign, a caller's
14
+ * `onBroadcast` hook refusing). Nothing was sent.
15
+ * - `broadcast_rejected`: the RPC definitively refused the signed bytes
16
+ * (preflight simulation, invalid transaction). They never entered the network.
17
+ * - `failed_onchain`: the transaction landed and failed, so the write reverted.
18
+ *
19
+ * The tag is plain data on the thrown object (`writeOutcome` + `writePhase`),
20
+ * so it survives bundling, duplicated SDK copies and structured cloning, and
21
+ * the thrown error keeps its own class (e.g. `BoundedOnchainRuleRejection`).
22
+ */
23
+ export type WriteNotAppliedPhase = 'before_broadcast' | 'broadcast_rejected' | 'failed_onchain';
24
+ export type WriteNotAppliedTag = {
25
+ writeOutcome: 'not_applied';
26
+ writePhase: WriteNotAppliedPhase;
27
+ };
28
+ /** Tag `error` as definitively not applied. An already-tagged error keeps its (earlier, more precise) phase. */
29
+ export declare function markWriteNotApplied<T>(error: T, phase: WriteNotAppliedPhase): T | (Error & WriteNotAppliedTag);
30
+ /** The phase a write stopped at when it was definitively not applied, else `null` (ambiguous or not a write error). */
31
+ export declare function writeNotAppliedPhase(error: unknown): WriteNotAppliedPhase | null;
32
+ export declare function isWriteNotApplied(error: unknown): boolean;