@bounded-sh/core 0.0.68 → 0.0.70

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 (32) hide show
  1. package/README.md +0 -1
  2. package/dist/client/config.d.ts +4 -8
  3. package/dist/client/operations.d.ts +0 -3
  4. package/dist/client/reconcile.d.ts +7 -16
  5. package/dist/{index-C9w7qQpj.js → index-CqTl6vHg.js} +76 -632
  6. package/dist/index-CqTl6vHg.js.map +1 -0
  7. package/dist/{index-C9h-Bnjk.mjs → index-Csf_2uZF.mjs} +77 -629
  8. package/dist/index-Csf_2uZF.mjs.map +1 -0
  9. package/dist/index.d.ts +0 -2
  10. package/dist/index.js +1 -5
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/{realtime-store-B_Szs6F3.mjs → realtime-store-ByP5wYsa.mjs} +2 -2
  14. package/dist/{realtime-store-B_Szs6F3.mjs.map → realtime-store-ByP5wYsa.mjs.map} +1 -1
  15. package/dist/{realtime-store-CQiij3zc.js → realtime-store-DfeKV55-.js} +2 -2
  16. package/dist/{realtime-store-CQiij3zc.js.map → realtime-store-DfeKV55-.js.map} +1 -1
  17. package/dist/{solana-message-ngQQt80s.mjs → solana-message-BFqre_Oi.mjs} +2 -2
  18. package/dist/{solana-message-ngQQt80s.mjs.map → solana-message-BFqre_Oi.mjs.map} +1 -1
  19. package/dist/{solana-message-DibkzgkZ.js → solana-message-BecAT47y.js} +2 -2
  20. package/dist/{solana-message-DibkzgkZ.js.map → solana-message-BecAT47y.js.map} +1 -1
  21. package/dist/{solana-operations-B0Q9UOHR.mjs → solana-operations-ByMDnjog.mjs} +127 -8
  22. package/dist/solana-operations-ByMDnjog.mjs.map +1 -0
  23. package/dist/{solana-operations-XjBhPOnu.js → solana-operations-uN89eqO2.js} +127 -8
  24. package/dist/solana-operations-uN89eqO2.js.map +1 -0
  25. package/dist/types.d.ts +14 -182
  26. package/dist/utils/session-events.d.ts +2 -2
  27. package/package.json +2 -2
  28. package/dist/index-C9h-Bnjk.mjs.map +0 -1
  29. package/dist/index-C9w7qQpj.js.map +0 -1
  30. package/dist/solana-operations-B0Q9UOHR.mjs.map +0 -1
  31. package/dist/solana-operations-XjBhPOnu.js.map +0 -1
  32. package/dist/utils/evm/evm-transaction-validation.d.ts +0 -46
package/dist/types.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import type { PublicKey, TransactionInstruction, Transaction, VersionedTransaction } from "@solana/web3.js";
2
- import type { SetOptions } from "./client/operations";
3
2
  import type { ClientConfig } from "./client/config";
4
3
  export interface AuthProvider {
5
4
  login(): Promise<User | null>;
6
- runTransaction(evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
7
5
  signMessage(message: string): Promise<string>;
8
6
  signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
9
7
  /**
@@ -23,18 +21,6 @@ export interface AuthProvider {
23
21
  restoreSession(): Promise<User | null>;
24
22
  logout(): Promise<void>;
25
23
  getNativeMethods(): Promise<any>;
26
- /**
27
- * Poll an already-broadcast EVM transaction through THIS provider's own
28
- * transport, so `reconcileSetResult` never has to guess an RPC endpoint or
29
- * cross wallet identities. Optional: a provider that cannot submit EVM
30
- * transactions has nothing to reconcile, and a `submitted` receipt simply
31
- * stays `submitted`.
32
- *
33
- * It must NEVER build a fresh transaction. It may rebroadcast the
34
- * byte-identical fenced bytes only when `allowRebroadcast` is true and the
35
- * fenced nonce is still unused.
36
- */
37
- reconcileEvmTransaction?(request: EvmReconcileRequest): Promise<TransactionReconciliation>;
38
24
  }
39
25
  export interface User {
40
26
  /**
@@ -85,28 +71,6 @@ export interface User {
85
71
  evmAddress?: string | null;
86
72
  provider: AuthProvider;
87
73
  }
88
- export interface EVMTransaction {
89
- contractAddress?: string;
90
- contractAbi?: string | any;
91
- functionName?: string;
92
- txArgs?: any[];
93
- /** Target contract (the per-chain BoundedRuntime address). */
94
- to?: string;
95
- /** ABI-encoded calldata (setDocuments(...)). */
96
- data?: string;
97
- /** Wei value to send with the call, as a decimal or 0x-hex string. Default "0". */
98
- value?: string;
99
- /** EIP-155 chain id the tx must execute on (used for the chain-switch guard). */
100
- chainId?: number;
101
- /** Optional gas limit hint (the worker's eth_estimateGas ×1.2). */
102
- gas?: string;
103
- /** Optional EIP-1559 max fee per gas. */
104
- maxFeePerGas?: string;
105
- /** Optional EIP-1559 max priority fee per gas. */
106
- maxPriorityFeePerGas?: string;
107
- /** Optional nonce; normally omitted so the signing wallet fills it. */
108
- nonce?: number;
109
- }
110
74
  export interface SolTransaction {
111
75
  appId: string;
112
76
  txArgs: any[];
@@ -123,16 +87,6 @@ export interface SolTransaction {
123
87
  * worker on its 202; the SDK never infers it from the app protocol.
124
88
  */
125
89
  export type SolanaChainTag = 'solana_devnet' | 'solana_mainnet';
126
- /**
127
- * Execution-lane tag for an EVM write, reported verbatim by the realtime worker
128
- * as the resolved EVM NETWORK key (protocol tier × chain), e.g. `base_sepolia`
129
- * on a testnet-tier app and `base_mainnet` on a mainnet-tier one. The
130
- * `evm_<chain>` form is the worker's fallback when a network cannot be resolved.
131
- *
132
- * The SDK never derives this from `evmTransaction.chainId`: a receipt states
133
- * where the write actually ran, and only the worker knows that.
134
- */
135
- export type EvmChainTag = 'base_sepolia' | 'base_mainnet' | 'robinhood_testnet' | 'robinhood_mainnet' | 'eth_sepolia' | 'eth_mainnet' | `evm_${string}`;
136
90
  /**
137
91
  * The execution lane a write actually ran on — NOT the app's declared protocol.
138
92
  * Routing is per batch, so a batch touching only unflagged collections in a
@@ -144,7 +98,7 @@ export type EvmChainTag = 'base_sepolia' | 'base_mainnet' | 'robinhood_testnet'
144
98
  * all. Discarding a committed write's receipt over a missing tag would be worse
145
99
  * than reporting the gap honestly.
146
100
  */
147
- export type ChainTag = SolanaChainTag | EvmChainTag | 'realtime_offchain' | 'unknown' | (string & {});
101
+ export type ChainTag = SolanaChainTag | 'realtime_offchain' | 'unknown' | (string & {});
148
102
  /**
149
103
  * One requested write, keyed by its CONCRETE destination path (never by index).
150
104
  * A `null` document means the entry was deleted or is absent.
@@ -164,18 +118,6 @@ export type SolanaFence = {
164
118
  blockhash: string;
165
119
  lastValidBlockHeight: number;
166
120
  };
167
- /**
168
- * EVM fence for a SERVER-KEYPAIR write: the exact signed bytes plus the sender
169
- * and nonce they consume. Reconciliation may rebroadcast these identical bytes
170
- * while the nonce is still unused, which cannot produce a second execution.
171
- * Injected browser wallets never produce one (the wallet holds the signed bytes).
172
- */
173
- export type EvmFence = {
174
- chainId: number;
175
- sender: string;
176
- nonce: number;
177
- signedTransaction: string;
178
- };
179
121
  /**
180
122
  * Whether server state was actually observed after a write.
181
123
  *
@@ -219,18 +161,7 @@ export type SolanaConfirmedSetResult = {
219
161
  confirmationContextSlot: number;
220
162
  mirrorSync: MirrorSync;
221
163
  };
222
- /** An EVM transaction whose receipt reported success. */
223
- export type EvmConfirmedSetResult = {
224
- status: 'confirmed';
225
- appId: string;
226
- requestedDocuments: SetDocuments;
227
- chain: EvmChainTag;
228
- transactionId: string;
229
- /** A real EVM block number. */
230
- blockNumber: number;
231
- mirrorSync: MirrorSync;
232
- };
233
- export type ConfirmedSetResult = SolanaConfirmedSetResult | EvmConfirmedSetResult;
164
+ export type ConfirmedSetResult = SolanaConfirmedSetResult;
234
165
  /**
235
166
  * Solana broadcast whose confirmation outcome is unknown. The signature is
236
167
  * derived from the signed bytes BEFORE broadcast, so it survives a lost send
@@ -249,63 +180,11 @@ export type SolanaSubmittedSetResult = {
249
180
  reason: string;
250
181
  };
251
182
  };
252
- /**
253
- * Server-keypair EVM broadcast with an unknown outcome. Fenced, so
254
- * reconciliation may rebroadcast the byte-identical signed transaction while
255
- * the nonce is unused. There is deliberately NO retry-safe terminal state here.
256
- */
257
- export type EvmFencedSubmittedSetResult = {
258
- status: 'submitted';
259
- appId: string;
260
- requestedDocuments: SetDocuments;
261
- chain: EvmChainTag;
262
- transactionId: string;
263
- fence: EvmFence;
264
- confirmation: {
265
- state: 'unknown';
266
- reason: string;
267
- };
268
- };
269
- /**
270
- * Injected-wallet EVM broadcast whose hash IS known (eth_sendTransaction
271
- * returned before receipt polling timed out). Pollable, never rebroadcastable:
272
- * the signed bytes live inside the wallet.
273
- */
274
- export type EvmHashKnownSubmittedSetResult = {
275
- status: 'submitted';
276
- appId: string;
277
- requestedDocuments: SetDocuments;
278
- chain: EvmChainTag;
279
- transactionId: string;
280
- rebroadcastable: false;
281
- confirmation: {
282
- state: 'unknown';
283
- reason: string;
284
- };
285
- };
286
- /**
287
- * Injected-wallet EVM send whose RESPONSE was lost, so no hash exists at all.
288
- * Explicitly irreconcilable and never auto-retried: the wallet owns nonce
289
- * selection and may have replaced the transaction outside our view.
290
- */
291
- export type EvmIrreconcilableSubmittedSetResult = {
292
- status: 'submitted';
293
- appId: string;
294
- requestedDocuments: SetDocuments;
295
- chain: EvmChainTag;
296
- transactionId: null;
297
- confirmation: {
298
- state: 'unknown';
299
- reason: string;
300
- reconcilable: false;
301
- };
302
- };
303
- export type SubmittedSetResult = SolanaSubmittedSetResult | EvmFencedSubmittedSetResult | EvmHashKnownSubmittedSetResult | EvmIrreconcilableSubmittedSetResult;
183
+ export type SubmittedSetResult = SolanaSubmittedSetResult;
304
184
  /**
305
185
  * The one retry-safe terminal state: the write provably did NOT land. Reached
306
186
  * only after observed blockhash expiry PLUS history proving the signature is
307
- * absent. Solana only — nonce advancement is not proof an EVM write did not
308
- * execute, so EVM has no equivalent by design.
187
+ * absent.
309
188
  */
310
189
  export type SolanaExpiredNotLandedSetResult = {
311
190
  status: 'expired_not_landed';
@@ -318,8 +197,7 @@ export type SolanaExpiredNotLandedSetResult = {
318
197
  /**
319
198
  * `shouldSubmitTx: false`: the transaction was signed and NOT sent. There is no
320
199
  * signature to report and nothing to mirror, so `transactionId` is `null` (not
321
- * an empty string) and no synchronization is attempted. Solana only — the EVM
322
- * providers sign and submit atomically.
200
+ * an empty string) and no synchronization is attempted.
323
201
  */
324
202
  export type SolanaSignedSetResult = {
325
203
  status: 'signed';
@@ -338,14 +216,14 @@ export type SolanaSignedSetResult = {
338
216
  * direct write is ambiguous. The SDK never retries writes for that reason;
339
217
  * resolve an ambiguous direct write by reading the path back, not by resubmitting.
340
218
  */
341
- export type SetResult = CommittedSetResult | SolanaConfirmedSetResult | EvmConfirmedSetResult | SolanaSubmittedSetResult | EvmFencedSubmittedSetResult | EvmHashKnownSubmittedSetResult | EvmIrreconcilableSubmittedSetResult | SolanaExpiredNotLandedSetResult | SolanaSignedSetResult;
219
+ export type SetResult = CommittedSetResult | SolanaConfirmedSetResult | SolanaSubmittedSetResult | SolanaExpiredNotLandedSetResult | SolanaSignedSetResult;
342
220
  /**
343
- * What `AuthProvider.runTransaction` (and the Solana pre-built lane) resolves
344
- * to. Discriminated so the identifier ESCAPES an unknown confirmation outcome:
221
+ * What the Solana pre-built write lane resolves to. Discriminated so the
222
+ * identifier ESCAPES an unknown confirmation outcome:
345
223
  * previously every lane awaited a receipt and threw on timeout, so a landed
346
224
  * transaction surfaced as an error with no hash and invited a duplicate submit.
347
225
  *
348
- * Definitive failures — an EIP-1193 user rejection, pre-broadcast validation,
226
+ * Definitive failures — a wallet user rejection, pre-broadcast validation,
349
227
  * or an on-chain revert/err — still THROW. Only an ambiguous transport outcome
350
228
  * resolves as `submitted`.
351
229
  */
@@ -375,51 +253,16 @@ export type SolanaSignedTransactionResult = {
375
253
  signedTransaction: string;
376
254
  fence: SolanaFence;
377
255
  };
378
- export type EvmConfirmedTransactionResult = {
379
- outcome: 'confirmed';
380
- lane: 'evm';
381
- transactionSignature: string;
382
- blockNumber: number;
383
- gasUsed: string;
384
- data?: unknown;
385
- };
386
- /** Server-keypair EVM: fenced, so the identical bytes may be rebroadcast. */
387
- export type EvmFencedSubmittedTransactionResult = {
388
- outcome: 'submitted';
389
- lane: 'evm';
390
- transactionSignature: string;
391
- fence: EvmFence;
392
- reason: string;
393
- };
394
- /** Injected wallet, hash known: pollable, never rebroadcastable. */
395
- export type EvmHashKnownSubmittedTransactionResult = {
396
- outcome: 'submitted';
397
- lane: 'evm';
398
- transactionSignature: string;
399
- rebroadcastable: false;
400
- reason: string;
401
- };
402
- /** Injected wallet, send response lost: no hash at all. */
403
- export type EvmIrreconcilableSubmittedTransactionResult = {
404
- outcome: 'submitted';
405
- lane: 'evm';
406
- transactionSignature: null;
407
- reconcilable: false;
408
- reason: string;
409
- };
410
256
  export type SolanaTransactionResult = SolanaConfirmedTransactionResult | SolanaSubmittedTransactionResult | SolanaSignedTransactionResult;
411
- export type EvmTransactionResult = EvmConfirmedTransactionResult | EvmFencedSubmittedTransactionResult | EvmHashKnownSubmittedTransactionResult | EvmIrreconcilableSubmittedTransactionResult;
412
- export type TransactionResult = SolanaTransactionResult | EvmTransactionResult;
257
+ export type TransactionResult = SolanaTransactionResult;
413
258
  /**
414
- * The result of polling an already-broadcast transaction. Providers implement
415
- * `reconcileEvmTransaction` to answer it for their own transport; Solana is
416
- * reconciled by core against the configured RPC.
259
+ * The result of polling an already-broadcast transaction. Solana is reconciled
260
+ * by core against the configured RPC.
417
261
  */
418
262
  export type TransactionReconciliation =
419
- /** A receipt/status exists and reports success. */
263
+ /** A confirmation/status exists and reports success. */
420
264
  {
421
265
  state: 'confirmed';
422
- blockNumber?: number;
423
266
  confirmationContextSlot?: number;
424
267
  }
425
268
  /** It landed and FAILED on-chain. The caller throws; this is not `submitted`. */
@@ -427,7 +270,7 @@ export type TransactionReconciliation =
427
270
  state: 'failed';
428
271
  reason: string;
429
272
  }
430
- /** Solana only: expiry observed AND history proves the signature is absent. */
273
+ /** Expiry observed AND history proves the signature is absent. */
431
274
  | {
432
275
  state: 'absent_after_expiry';
433
276
  }
@@ -468,17 +311,6 @@ export interface SolanaWriteRpc {
468
311
  }>;
469
312
  getBlockHeight?(commitment?: any): Promise<number>;
470
313
  }
471
- /** Request passed to a provider's `reconcileEvmTransaction`. */
472
- export type EvmReconcileRequest = {
473
- transactionHash: string;
474
- /** Present only for the fenced (server-keypair) receipt. */
475
- fence?: EvmFence;
476
- /**
477
- * Whether the caller permits a byte-identical rebroadcast of `fence`'s signed
478
- * transaction while its nonce is unused. Always false for injected wallets.
479
- */
480
- allowRebroadcast: boolean;
481
- };
482
314
  export interface TransactionReceipt {
483
315
  }
484
316
  export interface SubscriptionOptions {
@@ -5,8 +5,8 @@
5
5
  * event bus, so a session dying inside a session manager used to be invisible to
6
6
  * the SDK: `setCurrentUser(null)` was only ever called by `logout()` and `init()`.
7
7
  * The result was a UI that kept showing a connected wallet long after the session
8
- * it was showing had been wiped, which is exactly what let the Solana lab freeze a
9
- * review against a wallet the server no longer knew about.
8
+ * it was showing had been wiped, which is exactly what let a wallet-review UI
9
+ * freeze a review against a wallet the server no longer knew about.
10
10
  *
11
11
  * `js-sdk` registers a handler at init; core fires it ONLY when storage was
12
12
  * actually cleared, never on a failed-but-preserved refresh. Firing on a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bounded-sh/core",
3
- "version": "0.0.68",
3
+ "version": "0.0.70",
4
4
  "description": "Shared client, data-plane, and transport primitives for Bounded, the full-stack app builder and runtime for AI-built apps: policy-enforced operations, files, functions, and realtime.",
5
5
  "homepage": "https://bounded.sh/docs/sdk",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "scripts": {
17
17
  "build": "rm -rf ./dist ./.rollup-tmp && tsc -p tsconfig.build.json --outDir .rollup-tmp --declarationDir .rollup-tmp --emitDeclarationOnly false && rollup -c && tsc -p tsconfig.build.json --emitDeclarationOnly --declarationDir dist && rm -rf ./.rollup-tmp",
18
18
  "watch": "rollup -c -w",
19
- "test": "node src/client/run-config-network-test.mjs && node src/client/run-read-principal-test.mjs && node src/client/run-principal-collision-test.mjs && node src/client/run-abortable-read-test.mjs && node src/utils/run-api-abort-test.mjs && node src/utils/run-api-transient-get-retry-test.mjs && node src/utils/run-auth-api-issuer-switch-test.mjs && node src/utils/run-auth-api-server-credential-test.mjs && node src/utils/run-session-manager-binding-test.mjs && node src/utils/run-web-session-manager-signout-test.mjs && node src/utils/run-auth-api-refresh-per-token-test.mjs && node src/utils/run-core-platform-encode-test.mjs && node src/utils/rn-session-manager-example.source.test.mjs && node src/utils/run-session-protocol-test.mjs && node src/utils/run-auth-token-freshness-test.mjs && node src/utils/run-api-401-recovery-test.mjs && node src/utils/run-server-session-manager-test.mjs && node src/utils/api-refresh-inflight-key.source.test.mjs && node src/client/run-row-shape-test.mjs && node src/client/run-transport-test.mjs && node src/client/run-queries-coalesce-test.mjs && node src/client/run-runexpression-overrides-test.mjs && node src/client/run-subscribe-query-test.mjs && node src/client/subscribe-query-defaults.source.test.mjs && node src/client/run-public-export-surface-test.mjs && node src/client/run-decline-cause-test.mjs && node src/client/run-live-auth-test.mjs && node src/client/run-live-view-principal-test.mjs && node src/client/run-subscription-auth-error-test.mjs && node src/client/run-subscription-confirmation-retry-test.mjs && node src/client/subscription-handoff-grace.source.test.mjs && node src/client/run-onchain-validation-test.mjs && node src/client/run-evm-dispatch-test.mjs && node src/client/run-set-result-test.mjs && node src/client/run-reconcile-set-result-test.mjs && node src/client/run-set-file-result-test.mjs && node src/client/run-set-result-types-test.mjs && node src/utils/evm/run-evm-utils-test.mjs && node src/client/websocket-auth-url.test.mjs && node src/client/run-create-client-http-test.mjs && node src/client/run-create-client-subscribe-test.mjs && node src/client/run-wallet-config-binding-test.mjs && node src/client/run-functions-timeout-test.mjs && node src/run-user-address-nullable-test.mjs",
19
+ "test": "node src/client/run-config-network-test.mjs && node src/client/run-read-principal-test.mjs && node src/client/run-principal-collision-test.mjs && node src/client/run-abortable-read-test.mjs && node src/utils/run-api-abort-test.mjs && node src/utils/run-api-transient-get-retry-test.mjs && node src/utils/run-auth-api-issuer-switch-test.mjs && node src/utils/run-auth-api-server-credential-test.mjs && node src/utils/run-auth-api-revoke-test.mjs && node src/utils/run-session-manager-binding-test.mjs && node src/utils/run-web-session-manager-signout-test.mjs && node src/utils/run-auth-api-refresh-per-token-test.mjs && node src/utils/run-core-platform-encode-test.mjs && node src/utils/rn-session-manager-example.source.test.mjs && node src/utils/run-session-protocol-test.mjs && node src/utils/run-auth-token-freshness-test.mjs && node src/utils/run-api-401-recovery-test.mjs && node src/utils/run-server-session-manager-test.mjs && node src/utils/api-refresh-inflight-key.source.test.mjs && node src/client/run-row-shape-test.mjs && node src/client/run-transport-test.mjs && node src/client/run-queries-coalesce-test.mjs && node src/client/run-runexpression-overrides-test.mjs && node src/client/run-subscribe-query-test.mjs && node src/client/subscribe-query-defaults.source.test.mjs && node src/client/run-public-export-surface-test.mjs && node src/client/run-decline-cause-test.mjs && node src/client/run-live-auth-test.mjs && node src/client/run-live-view-principal-test.mjs && node src/client/run-subscription-auth-error-test.mjs && node src/client/run-subscription-confirmation-retry-test.mjs && node src/client/subscription-handoff-grace.source.test.mjs && node src/client/run-onchain-validation-test.mjs && node src/client/run-set-result-test.mjs && node src/client/run-reconcile-set-result-test.mjs && node src/client/run-set-file-result-test.mjs && node src/client/run-set-result-types-test.mjs && node src/utils/evm/run-evm-utils-test.mjs && node src/client/websocket-auth-url.test.mjs && node src/client/run-create-client-http-test.mjs && node src/client/run-create-client-subscribe-test.mjs && node src/client/run-wallet-config-binding-test.mjs && node src/client/run-functions-timeout-test.mjs && node src/run-user-address-nullable-test.mjs",
20
20
  "prepare": "npm run build"
21
21
  },
22
22
  "files": [