@bounded-sh/core 0.0.114 → 0.0.116
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/dist/client/operations.d.ts +14 -0
- package/dist/client/reconcile.d.ts +18 -0
- package/dist/client/venue-grant-write.d.ts +62 -0
- package/dist/client/write-outcome.d.ts +1 -0
- package/dist/{index--ahzzmm5.js → index-CjiaT9AT.js} +295 -62
- package/dist/index-CjiaT9AT.js.map +1 -0
- package/dist/{index-DTTh5Wt5.mjs → index-Db4lrwO6.mjs} +291 -63
- package/dist/index-Db4lrwO6.mjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{realtime-store-Bcra04TH.mjs → realtime-store-CNs5zURZ.mjs} +2 -2
- package/dist/{realtime-store-Bcra04TH.mjs.map → realtime-store-CNs5zURZ.mjs.map} +1 -1
- package/dist/{realtime-store-CR80Jac5.js → realtime-store-IPPwUhJc.js} +2 -2
- package/dist/{realtime-store-CR80Jac5.js.map → realtime-store-IPPwUhJc.js.map} +1 -1
- package/dist/{solana-message-BwPW9Fst.mjs → solana-message-BO6Dtgbv.mjs} +2 -2
- package/dist/{solana-message-BwPW9Fst.mjs.map → solana-message-BO6Dtgbv.mjs.map} +1 -1
- package/dist/{solana-message-DPR9uw0N.js → solana-message-CXuLc7NX.js} +2 -2
- package/dist/{solana-message-DPR9uw0N.js.map → solana-message-CXuLc7NX.js.map} +1 -1
- package/dist/{solana-operations-BMB6sq_i.js → solana-operations-CghJe0_7.js} +3 -3
- package/dist/{solana-operations-BMB6sq_i.js.map → solana-operations-CghJe0_7.js.map} +1 -1
- package/dist/{solana-operations-BBQllFVm.mjs → solana-operations-DDt4CzRR.mjs} +3 -3
- package/dist/{solana-operations-BBQllFVm.mjs.map → solana-operations-DDt4CzRR.mjs.map} +1 -1
- package/dist/{solana-v1-operations-CCHbLEo-.js → solana-v1-operations-BY2DTfbR.js} +3 -3
- package/dist/{solana-v1-operations-CCHbLEo-.js.map → solana-v1-operations-BY2DTfbR.js.map} +1 -1
- package/dist/{solana-v1-operations-DBuA0PlD.mjs → solana-v1-operations-TH-HUzbT.mjs} +3 -3
- package/dist/{solana-v1-operations-DBuA0PlD.mjs.map → solana-v1-operations-TH-HUzbT.mjs.map} +1 -1
- package/dist/utils/refresh-error.d.ts +4 -0
- package/dist/utils/session-signal.d.ts +7 -0
- package/package.json +2 -2
- package/dist/index--ahzzmm5.js.map +0 -1
- package/dist/index-DTTh5Wt5.mjs.map +0 -1
|
@@ -30,6 +30,20 @@ export type RequestOverrides = {
|
|
|
30
30
|
* deterministically; production builds a `Connection` from `config.rpcUrl`.
|
|
31
31
|
*/
|
|
32
32
|
_solanaRpc?: SolanaWriteRpc;
|
|
33
|
+
/**
|
|
34
|
+
* @internal The venue grant write lane (venue-grant-write.ts). A single-use grant, not the
|
|
35
|
+
* caller's session, authenticates the write, so `setMany` also lets the lane refuse the
|
|
36
|
+
* execution lane a 202 reports, takes the poofnet commit's credential from the lane, and
|
|
37
|
+
* skips the post-confirm mirror read a grant cannot authorize. App code never sets it.
|
|
38
|
+
*/
|
|
39
|
+
_grantLane?: GrantLane;
|
|
40
|
+
};
|
|
41
|
+
/** @internal See {@link RequestOverrides._grantLane}. */
|
|
42
|
+
export type GrantLane = {
|
|
43
|
+
/** Throws to refuse `chain`, the execution lane the 202 reported, before anything is signed. */
|
|
44
|
+
assertLane(chain: string): void;
|
|
45
|
+
/** The credential for the poofnet `PUT items/signed` commit. A grant is single use, so each call mints a fresh one. */
|
|
46
|
+
commitHeaders(): Promise<Record<string, string>>;
|
|
33
47
|
};
|
|
34
48
|
export type SetOptions = {
|
|
35
49
|
shouldSubmitTx?: boolean;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reconciliation for a `submitted` write receipt.
|
|
3
|
+
*
|
|
4
|
+
* A returned object cannot transition itself, and calling `set` again builds a
|
|
5
|
+
* FRESH transaction — which is exactly what must not happen while the first
|
|
6
|
+
* signature may still land. Without this call the `submitted` state is a dead
|
|
7
|
+
* end and its terminal exits are unreachable.
|
|
8
|
+
*
|
|
9
|
+
* Everything here polls the SAME signature. Nothing here ever builds a new
|
|
10
|
+
* transaction or broadcasts anything.
|
|
11
|
+
*/
|
|
12
|
+
import type { ClientConfig } from './config';
|
|
1
13
|
import type { RequestOverrides } from './operations';
|
|
2
14
|
import type { SetResult } from '../types';
|
|
3
15
|
export type ReconcileSetResultOptions = {
|
|
@@ -18,6 +30,12 @@ export type WaitForSetResultOptions = ReconcileSetResultOptions & {
|
|
|
18
30
|
/** Cancels the wait. The latest `submitted` receipt is returned, never discarded. */
|
|
19
31
|
signal?: AbortSignal;
|
|
20
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* The Solana execution lane a client config REQUIRES, or `null` when the config
|
|
35
|
+
* carries no constraint. Only a positive contradiction rejects a receipt — an
|
|
36
|
+
* unmapped or unset `chain` is not evidence of a mismatch.
|
|
37
|
+
*/
|
|
38
|
+
export declare function requiredSolanaChain(config: ClientConfig): string | null;
|
|
21
39
|
/**
|
|
22
40
|
* Poll the SAME signature a `submitted` receipt carries and return the
|
|
23
41
|
* resulting `SetResult`.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The venue grant write lane: create ONE document in another app (an OpenApps venue) as the
|
|
3
|
+
* wallet signed in here, authorized by a single-use grant instead of a venue session
|
|
4
|
+
* (VENUE-GRANT-DESIGN.md). The grant only lets the venue build that one transaction for that
|
|
5
|
+
* wallet; the wallet's own signature, checked by the venue's own rule, is the authority.
|
|
6
|
+
*
|
|
7
|
+
* The grant itself is minted by Bounded Auth at `POST {humanAuthApiUrl}/app-token/venue-grant`
|
|
8
|
+
* (contract: packages/cdk/cloudflare/shared/venue-grant.ts, which this package cannot import
|
|
9
|
+
* because the SDK packages publish separately). This module only spends one.
|
|
10
|
+
*
|
|
11
|
+
* It reuses `setMany`'s request and 202 handling through `_overrides`: the `_config` snapshot is
|
|
12
|
+
* this app's own config re-pointed at the VENUE app id, so the pre-sign validator (OA-0001) binds
|
|
13
|
+
* the venue app id and the full expected intent, and the signer stays this app's own AuthProvider
|
|
14
|
+
* (a Turnkey session or a Wallet Standard wallet). Nothing here is reachable from `createClient()`,
|
|
15
|
+
* which stays read-only.
|
|
16
|
+
*
|
|
17
|
+
* The chain a write runs on is the VENUE's, stated by its 202, never the app's: the app's own
|
|
18
|
+
* `chain` can only agree with it or be refused, and the transaction is broadcast through the app's
|
|
19
|
+
* `rpcUrl` only when the app configured that same chain, otherwise through `resolveRpcUrl(chain)`.
|
|
20
|
+
*/
|
|
21
|
+
import { type ClientConfig } from './config';
|
|
22
|
+
import { type SetOptions } from './operations';
|
|
23
|
+
import type { SetResult, SolanaWriteRpc } from '../types';
|
|
24
|
+
export interface VenueGrantWriteOptions {
|
|
25
|
+
/** The venue app the grant was minted for. The write and its 202 validation bind THIS app id, never the caller's own. */
|
|
26
|
+
venueAppId: string;
|
|
27
|
+
/** The single-use grant that authorizes this one create. */
|
|
28
|
+
grant: string;
|
|
29
|
+
/**
|
|
30
|
+
* Mints a fresh grant for the same kind and id. The `PUT items` that built the approval spent the
|
|
31
|
+
* first, so the poofnet `PUT items/signed` commit needs its own. Called only on poofnet, after the
|
|
32
|
+
* wallet has signed.
|
|
33
|
+
*/
|
|
34
|
+
commitGrant: () => Promise<string>;
|
|
35
|
+
/** As `set`'s `onBroadcast`: persist the signed transaction's receipt before it is broadcast (Solana lanes). */
|
|
36
|
+
onBroadcast?: SetOptions['onBroadcast'];
|
|
37
|
+
/**
|
|
38
|
+
* The RPC for a Solana lane the app did not configure itself: given the chain the venue's 202
|
|
39
|
+
* reported (`solana_devnet` or `solana_mainnet`), its RPC url, or null for none. The client SDK
|
|
40
|
+
* passes its platform default. See {@link resolveVenueRpcUrl} for how it ranks against the app's own.
|
|
41
|
+
*/
|
|
42
|
+
resolveRpcUrl?: (chain: string) => string | null | undefined;
|
|
43
|
+
/** @internal Test seam, as `RequestOverrides._solanaRpc`. */
|
|
44
|
+
_solanaRpc?: SolanaWriteRpc;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The RPC a venue write on Solana lane `chain` is broadcast through, and a saved receipt of it is
|
|
48
|
+
* reconciled through. The app's own `rpcUrl` counts only when the app also configured this chain
|
|
49
|
+
* (an `rpcUrl` alone does not say which chain it speaks); otherwise `resolveRpcUrl(chain)`. Null
|
|
50
|
+
* when neither yields one.
|
|
51
|
+
*
|
|
52
|
+
* @internal Shared by the lane and by the client SDK's reconciliation of a saved receipt.
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveVenueRpcUrl(config: ClientConfig, chain: string, resolveRpcUrl?: (chain: string) => string | null | undefined): string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Write `document` at `path` in the venue `venueAppId` with a single-use grant. Resolves to the
|
|
57
|
+
* same discriminated {@link SetResult} as `set`, and throws exactly as `set` does, so the same
|
|
58
|
+
* `isWriteNotApplied` reading applies.
|
|
59
|
+
*
|
|
60
|
+
* @internal Used by `fundVenueEscrow` and `disputeVenueEscrow` in @bounded-sh/client. Not a stable API.
|
|
61
|
+
*/
|
|
62
|
+
export declare function setWithVenueGrant(path: string, document: Record<string, unknown>, options: VenueGrantWriteOptions): Promise<SetResult>;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* `onBroadcast` hook refusing). Nothing was sent.
|
|
15
15
|
* - `broadcast_rejected`: the RPC definitively refused the signed bytes
|
|
16
16
|
* (preflight simulation, invalid transaction). They never entered the network.
|
|
17
|
+
* On poofnet, the realtime worker answering the signed commit with a 4xx.
|
|
17
18
|
* - `failed_onchain`: the transaction landed and failed, so the write reverted.
|
|
18
19
|
*
|
|
19
20
|
* The tag is plain data on the thrown object (`writeOutcome` + `writePhase`),
|