@bounded-sh/client 0.0.114 → 0.0.115

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 (58) hide show
  1. package/dist/auth/providers/injected-wallet-types.d.ts +11 -2
  2. package/dist/auth/providers/wallet-standard-discovery.d.ts +2 -0
  3. package/dist/auth/turnkey-signer-window.d.ts +19 -0
  4. package/dist/auth/turnkey-signing-capability.d.ts +5 -1
  5. package/dist/{email-auth-provider-nDZjRDpj.mjs → email-auth-provider-ByNBWdfi.mjs} +2 -2
  6. package/dist/{email-auth-provider-Bk5GSpYT.mjs.map → email-auth-provider-ByNBWdfi.mjs.map} +1 -1
  7. package/dist/{email-auth-provider-Bk5GSpYT.mjs → email-auth-provider-CODHCC3h.mjs} +2 -2
  8. package/dist/{email-auth-provider-nDZjRDpj.mjs.map → email-auth-provider-CODHCC3h.mjs.map} +1 -1
  9. package/dist/{email-auth-provider-DeORQbTK.js → email-auth-provider-CPHrcy_b.js} +2 -2
  10. package/dist/{email-auth-provider-DeORQbTK.js.map → email-auth-provider-CPHrcy_b.js.map} +1 -1
  11. package/dist/{email-auth-provider-Cr66GaKw.js → email-auth-provider-CwG04f4u.js} +2 -2
  12. package/dist/{email-auth-provider-Cr66GaKw.js.map → email-auth-provider-CwG04f4u.js.map} +1 -1
  13. package/dist/{guest-auth-provider-CUNkZVFK.js → guest-auth-provider-3rfSwq3f.js} +2 -2
  14. package/dist/{guest-auth-provider-CUNkZVFK.js.map → guest-auth-provider-3rfSwq3f.js.map} +1 -1
  15. package/dist/{guest-auth-provider-ejUTbjCC.mjs → guest-auth-provider-CGN4k_LG.mjs} +2 -2
  16. package/dist/{guest-auth-provider-DDudqqxY.mjs.map → guest-auth-provider-CGN4k_LG.mjs.map} +1 -1
  17. package/dist/{guest-auth-provider-DDudqqxY.mjs → guest-auth-provider-PfOp_Yzj.mjs} +2 -2
  18. package/dist/{guest-auth-provider-ejUTbjCC.mjs.map → guest-auth-provider-PfOp_Yzj.mjs.map} +1 -1
  19. package/dist/{guest-auth-provider-5bX-xt6K.js → guest-auth-provider-d6dk97x6.js} +2 -2
  20. package/dist/{guest-auth-provider-5bX-xt6K.js.map → guest-auth-provider-d6dk97x6.js.map} +1 -1
  21. package/dist/{index-BAiLpNEQ.mjs → index-C63ceG_z.mjs} +789 -73
  22. package/dist/index-C63ceG_z.mjs.map +1 -0
  23. package/dist/{index-BZ0X1Z9X.js → index-nU0ZSfWs.js} +793 -71
  24. package/dist/index-nU0ZSfWs.js.map +1 -0
  25. package/dist/index.d.ts +3 -1
  26. package/dist/index.js +6 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +1 -1
  29. package/dist/{index.native-DJSOqyKQ.js → index.native-BBLBnqal.js} +75 -22
  30. package/dist/index.native-BBLBnqal.js.map +1 -0
  31. package/dist/{index.native-DcW2klyn.mjs → index.native-DLAEWwuZ.mjs} +76 -23
  32. package/dist/index.native-DLAEWwuZ.mjs.map +1 -0
  33. package/dist/index.native.js +1 -1
  34. package/dist/index.native.mjs +1 -1
  35. package/dist/{injected-evm-wallet-provider-C4aKa2v1.mjs → injected-evm-wallet-provider-C4vNOS4P.mjs} +2 -2
  36. package/dist/{injected-evm-wallet-provider-C4aKa2v1.mjs.map → injected-evm-wallet-provider-C4vNOS4P.mjs.map} +1 -1
  37. package/dist/{injected-evm-wallet-provider-BDYWjIOQ.js → injected-evm-wallet-provider-C6KC7pJ6.js} +2 -2
  38. package/dist/{injected-evm-wallet-provider-BDYWjIOQ.js.map → injected-evm-wallet-provider-C6KC7pJ6.js.map} +1 -1
  39. package/dist/{injected-evm-wallet-provider-D06arDQD.js → injected-evm-wallet-provider-D1JA3cL4.js} +2 -2
  40. package/dist/{injected-evm-wallet-provider-D06arDQD.js.map → injected-evm-wallet-provider-D1JA3cL4.js.map} +1 -1
  41. package/dist/{injected-evm-wallet-provider-BQ_kG1vI.mjs → injected-evm-wallet-provider-D7rOyYdr.mjs} +2 -2
  42. package/dist/{injected-evm-wallet-provider-BQ_kG1vI.mjs.map → injected-evm-wallet-provider-D7rOyYdr.mjs.map} +1 -1
  43. package/dist/{injected-wallet-provider-Dj-F69gb.mjs → injected-wallet-provider-BLRrB2rb.mjs} +11 -5
  44. package/dist/{injected-wallet-provider-Dj-F69gb.mjs.map → injected-wallet-provider-BLRrB2rb.mjs.map} +1 -1
  45. package/dist/{injected-wallet-provider-B9jvzDM5.js → injected-wallet-provider-BXFicWTx.js} +11 -5
  46. package/dist/{injected-wallet-provider-B9jvzDM5.js.map → injected-wallet-provider-BXFicWTx.js.map} +1 -1
  47. package/dist/{injected-wallet-provider-Dqmk-m4V.js → injected-wallet-provider-BvlKZoVJ.js} +59 -34
  48. package/dist/injected-wallet-provider-BvlKZoVJ.js.map +1 -0
  49. package/dist/{injected-wallet-provider-DxPcYxP-.mjs → injected-wallet-provider-DruiX7GK.mjs} +59 -34
  50. package/dist/injected-wallet-provider-DruiX7GK.mjs.map +1 -0
  51. package/dist/venue-escrow.d.ts +113 -0
  52. package/package.json +2 -2
  53. package/dist/index-BAiLpNEQ.mjs.map +0 -1
  54. package/dist/index-BZ0X1Z9X.js.map +0 -1
  55. package/dist/index.native-DJSOqyKQ.js.map +0 -1
  56. package/dist/index.native-DcW2klyn.mjs.map +0 -1
  57. package/dist/injected-wallet-provider-Dqmk-m4V.js.map +0 -1
  58. package/dist/injected-wallet-provider-DxPcYxP-.mjs.map +0 -1
@@ -0,0 +1,113 @@
1
+ /** The terms the funder signs. Amounts are USDC base units; `expiresAt` is a unix second. */
2
+ export interface VenueEscrowTerms {
3
+ payee: string;
4
+ amountUsdc: number;
5
+ challengeSeconds: number;
6
+ expiresAt: number;
7
+ ref: string;
8
+ }
9
+ export interface VenueEscrowFunded {
10
+ escrowId: string;
11
+ rootAppId: string;
12
+ venueAppId: string;
13
+ /** The funding transaction, when the lane reports one (a poofnet commit can come back without). */
14
+ transactionId: string | null;
15
+ }
16
+ export interface VenueEscrowDisputed {
17
+ disputeId: string;
18
+ rootAppId: string;
19
+ venueAppId: string;
20
+ transactionId: string | null;
21
+ }
22
+ export type VenueEscrowState = 'failed' | 'pending' | 'released' | 'refunded' | 'disputed' | 'approved' | 'funded';
23
+ /** One escrow as the public read reports it (mirrors `projectAgentEscrow` in bounded-platform's agent-escrow-public-routes.ts). */
24
+ export interface VenueEscrow {
25
+ schemaVersion: string | null;
26
+ rootAppId: string;
27
+ escrowId: string;
28
+ funder: string | null;
29
+ payee: string | null;
30
+ amountUsdc: number | null;
31
+ challengeSeconds: number | null;
32
+ expiresAt: number | null;
33
+ ref: string | null;
34
+ at: number | null;
35
+ approvedAt: number | null;
36
+ approvedKind: string | null;
37
+ disputedAt: number | null;
38
+ disputedBy: string | null;
39
+ settledAt: number | null;
40
+ settledKind: string | null;
41
+ settledBy: string | null;
42
+ state: VenueEscrowState;
43
+ }
44
+ /**
45
+ * Why a call failed. `pending` means the outcome is not known yet: call `fundVenueEscrow` again
46
+ * with the SAME terms to settle it, never with new ones. `funded_other_terms` means an earlier,
47
+ * interrupted funding with different terms landed (see `escrowId`). Every other code is final for
48
+ * that attempt, and the next call starts fresh.
49
+ *
50
+ * - Before anything is sent: `invalid_input`, `sign_in_required`, `wallet_required`, `wallet_changed`,
51
+ * `popup_blocked`, `storage_unavailable`, `lock_unavailable`, `in_progress`.
52
+ * - The grant mint (Bounded Auth, passed through): `invalid_request`, `invalid_token`, `origin_not_allowed`,
53
+ * `not_an_openapps_app`, `agent_wallet_refused`, `rate_limited`, `venue_grant_unavailable`, plus
54
+ * `venue_grant_refused` for any other refusal.
55
+ * - The venue write: `grant_rejected`, `rule_refused` (the venue's own rule, in its words; also an
56
+ * approval slower than the two minutes a write stays valid), `sponsorship_refused`,
57
+ * `sponsorship_unavailable`, `insufficient_balance`, `chain_mismatch` (the app configured another
58
+ * chain than the venue's), `chain_not_configured` (no RPC could be resolved for the venue's chain;
59
+ * not expected with the SDK's defaults), `top_level_required`, `declined` (the wallet or its window
60
+ * said no), `write_failed`.
61
+ * - Settling a funding: `not_applied` (it never landed; nothing moved), `failed` (the venue's hook
62
+ * failed; nothing moved), `taken` (another record holds the id), `pending`, `funded_other_terms`
63
+ * (an interrupted funding with different terms landed; see `escrowId`).
64
+ * - Reading: `read_unavailable`.
65
+ */
66
+ export type VenueEscrowErrorCode = 'invalid_input' | 'sign_in_required' | 'wallet_required' | 'wallet_changed' | 'popup_blocked' | 'storage_unavailable' | 'lock_unavailable' | 'in_progress' | 'invalid_request' | 'invalid_token' | 'origin_not_allowed' | 'not_an_openapps_app' | 'agent_wallet_refused' | 'rate_limited' | 'venue_grant_unavailable' | 'venue_grant_refused' | 'grant_rejected' | 'rule_refused' | 'sponsorship_refused' | 'sponsorship_unavailable' | 'insufficient_balance' | 'chain_mismatch' | 'chain_not_configured' | 'top_level_required' | 'declined' | 'write_failed' | 'not_applied' | 'failed' | 'taken' | 'pending' | 'funded_other_terms' | 'read_unavailable';
67
+ /** Thrown by every venue escrow call. Branch on `code`; `error.name === 'VenueEscrowError'` also holds across bundled SDK copies. */
68
+ export declare class VenueEscrowError extends Error {
69
+ readonly code: VenueEscrowErrorCode;
70
+ /** The escrow this concerns, when one exists: a pending, failed, taken or conflicting funding. */
71
+ readonly escrowId?: string;
72
+ constructor(code: VenueEscrowErrorCode, message: string, details?: {
73
+ escrowId?: string;
74
+ cause?: unknown;
75
+ });
76
+ }
77
+ /**
78
+ * Read one venue escrow from the public record: its terms and its state (`pending` until the
79
+ * venue's hook completes, `failed` when it did not). Resolves null when no such escrow exists.
80
+ * No sign-in is needed.
81
+ */
82
+ export declare function getVenueEscrow(input: {
83
+ rootAppId: string;
84
+ escrowId: string;
85
+ }): Promise<VenueEscrow | null>;
86
+ /**
87
+ * Lock USDC in the venue escrow for `terms.payee`, signed by the wallet signed in here.
88
+ * MUST be called from a user click: an email (Turnkey) wallet's approval opens in its own Bounded
89
+ * window, which a browser only allows inside the click (it is opened here, before anything is
90
+ * awaited), and the approval shows the decoded terms. A Phantom or Wallet Standard wallet keeps
91
+ * its own prompt. On a real-chain venue the transaction is broadcast on the VENUE's chain: through
92
+ * the app's own `rpcUrl` when the app configured that same `chain` too (an `rpcUrl` alone does not
93
+ * say which chain it speaks), otherwise through the platform's default RPC for the venue's chain, so
94
+ * an app that never configured a chain just works. An app that configured a different `chain` is
95
+ * refused (`chain_mismatch`) before anything is signed.
96
+ *
97
+ * Funding is made safe to retry: a funding that was interrupted (page closed, answer lost) is
98
+ * saved before anything is sent, and the next call checks it instead of funding again, so pass
99
+ * the same terms and it resolves to the same `escrowId`. Store `escrowId` on your own record.
100
+ * See {@link VenueEscrowErrorCode} for the failures, and `pending` in particular.
101
+ */
102
+ export declare function fundVenueEscrow(terms: VenueEscrowTerms): Promise<VenueEscrowFunded>;
103
+ /**
104
+ * Dispute a funded venue escrow as its funder (or payee), signed by the wallet signed in here.
105
+ * MUST be called from a user click, for the same reason as {@link fundVenueEscrow}. `reason` is
106
+ * 1 to 400 bytes of UTF-8: the venue allows 1000 characters, but a longer reason does not fit one
107
+ * legacy-format transaction. Nothing is saved: a dispute that already landed makes the venue refuse
108
+ * a second one (`rule_refused`).
109
+ */
110
+ export declare function disputeVenueEscrow(input: {
111
+ escrowId: string;
112
+ reason: string;
113
+ }): Promise<VenueEscrowDisputed>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bounded-sh/client",
3
- "version": "0.0.114",
3
+ "version": "0.0.115",
4
4
  "description": "Web and React Native client SDK for Bounded, the full-stack app builder and runtime for AI-built apps: hosted auth, policy-enforced data, files and search, functions, realtime subscriptions, and atomic writes.",
5
5
  "homepage": "https://bounded.sh/docs/sdk",
6
6
  "main": "./dist/index.js",
@@ -115,7 +115,7 @@
115
115
  "vite": "7.3.5"
116
116
  },
117
117
  "dependencies": {
118
- "@bounded-sh/core": "0.0.114",
118
+ "@bounded-sh/core": "0.0.115",
119
119
  "@coral-xyz/anchor": "0.31.1",
120
120
  "@noble/curves": "^1.9.7",
121
121
  "@solana/kit": "8.2.0",