@opendatalabs/connect 0.5.0-canary.b691d73 → 0.5.0-canary.d8d3c3d

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 (68) hide show
  1. package/README.md +30 -29
  2. package/dist/core/constants.d.ts +2 -28
  3. package/dist/core/constants.d.ts.map +1 -1
  4. package/dist/core/constants.js +2 -23
  5. package/dist/core/constants.js.map +1 -1
  6. package/dist/core/errors.d.ts +2 -43
  7. package/dist/core/errors.d.ts.map +1 -1
  8. package/dist/core/errors.js +0 -39
  9. package/dist/core/errors.js.map +1 -1
  10. package/dist/core/index.d.ts +2 -3
  11. package/dist/core/index.d.ts.map +1 -1
  12. package/dist/core/index.js +2 -3
  13. package/dist/core/index.js.map +1 -1
  14. package/dist/core/types.d.ts +0 -61
  15. package/dist/core/types.d.ts.map +1 -1
  16. package/dist/react/ConnectButton.d.ts +0 -15
  17. package/dist/react/ConnectButton.d.ts.map +1 -1
  18. package/dist/react/ConnectButton.js +1 -8
  19. package/dist/react/ConnectButton.js.map +1 -1
  20. package/dist/react/index.d.ts +0 -1
  21. package/dist/react/index.d.ts.map +1 -1
  22. package/dist/react/index.js +0 -1
  23. package/dist/react/index.js.map +1 -1
  24. package/dist/react/useVanaConnect.d.ts +0 -33
  25. package/dist/react/useVanaConnect.d.ts.map +1 -1
  26. package/dist/react/useVanaConnect.js +3 -29
  27. package/dist/react/useVanaConnect.js.map +1 -1
  28. package/dist/server/connect.d.ts +1 -40
  29. package/dist/server/connect.d.ts.map +1 -1
  30. package/dist/server/connect.js +5 -46
  31. package/dist/server/connect.js.map +1 -1
  32. package/dist/server/data-client.d.ts +0 -17
  33. package/dist/server/data-client.d.ts.map +1 -1
  34. package/dist/server/data-client.js +7 -24
  35. package/dist/server/data-client.js.map +1 -1
  36. package/dist/server/index.d.ts +0 -2
  37. package/dist/server/index.d.ts.map +1 -1
  38. package/dist/server/index.js +0 -2
  39. package/dist/server/index.js.map +1 -1
  40. package/dist/server/manifest-signer.d.ts +0 -22
  41. package/dist/server/manifest-signer.d.ts.map +1 -1
  42. package/dist/server/manifest-signer.js +0 -22
  43. package/dist/server/manifest-signer.js.map +1 -1
  44. package/dist/server/request-signer.d.ts +0 -18
  45. package/dist/server/request-signer.d.ts.map +1 -1
  46. package/dist/server/request-signer.js +0 -6
  47. package/dist/server/request-signer.js.map +1 -1
  48. package/dist/server/session-relay.d.ts +0 -22
  49. package/dist/server/session-relay.d.ts.map +1 -1
  50. package/dist/server/session-relay.js +4 -12
  51. package/dist/server/session-relay.js.map +1 -1
  52. package/package.json +4 -2
  53. package/dist/core/grants.d.ts +0 -19
  54. package/dist/core/grants.d.ts.map +0 -1
  55. package/dist/core/grants.js +0 -31
  56. package/dist/core/grants.js.map +0 -1
  57. package/dist/react/useVanaData.d.ts +0 -67
  58. package/dist/react/useVanaData.d.ts.map +0 -1
  59. package/dist/react/useVanaData.js +0 -125
  60. package/dist/react/useVanaData.js.map +0 -1
  61. package/dist/server/config.d.ts +0 -36
  62. package/dist/server/config.d.ts.map +0 -1
  63. package/dist/server/config.js +0 -44
  64. package/dist/server/config.js.map +0 -1
  65. package/dist/server/webhook.d.ts +0 -11
  66. package/dist/server/webhook.d.ts.map +0 -1
  67. package/dist/server/webhook.js +0 -18
  68. package/dist/server/webhook.js.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vana Connect SDK
2
2
 
3
- Let your users customize your app with their own data.
3
+ Let your users customize your app with their own data.
4
4
 
5
5
  Users connect platforms they already use — ChatGPT, Instagram, Gmail, and more — through the [Vana Desktop App](https://www.vana.com/download), which keeps them in control of what's shared. Your app receives structured, user-consented data through a cryptographically verified grant. No scraping, no OAuth token juggling, no compliance gray areas.
6
6
 
@@ -44,6 +44,7 @@ npm install @opendatalabs/connect
44
44
 
45
45
  Register as a builder through the Vana Desktop App first.
46
46
 
47
+
47
48
  ## Quickstart
48
49
 
49
50
  ### 1. Create a session (server)
@@ -54,8 +55,8 @@ import { connect } from "@opendatalabs/connect/server";
54
55
  const session = await connect({
55
56
  privateKey: process.env.VANA_APP_PRIVATE_KEY as `0x${string}`,
56
57
  scopes: ["chatgpt.conversations"],
57
- webhookUrl: "https://yourapp.com/api/webhook", // optional
58
- appUserId: "user-42", // optional
58
+ webhookUrl: "https://yourapp.com/api/webhook", // optional
59
+ appUserId: "user-42", // optional
59
60
  });
60
61
 
61
62
  // Return to your frontend:
@@ -96,7 +97,7 @@ import { ConnectButton } from "@opendatalabs/connect/react";
96
97
  sessionId={sessionId}
97
98
  onComplete={(grant) => saveGrant(grant)}
98
99
  onError={(err) => console.error(err)}
99
- />;
100
+ />
100
101
  ```
101
102
 
102
103
  ### 3. Fetch user data (server)
@@ -109,8 +110,8 @@ const data = await getData({
109
110
  grant, // GrantPayload from step 2
110
111
  });
111
112
 
112
- // Record<string, unknown> keyed by scope
113
- const conversations = data["chatgpt.conversations"];
113
+ // Map<string, unknown> keyed by scope
114
+ const conversations = data.get("chatgpt.conversations");
114
115
  ```
115
116
 
116
117
  ### Web App Manifest
@@ -145,31 +146,31 @@ Make sure your HTML includes `<link rel="manifest" href="/manifest.json">`.
145
146
 
146
147
  ### Entrypoints
147
148
 
148
- | Import | Environment | Exports |
149
- | ------------------------------ | ----------- | ----------------------------------------------------------------- |
150
- | `@opendatalabs/connect/server` | Node.js | `connect()`, `getData()`, `signVanaManifest()`, low-level clients |
151
- | `@opendatalabs/connect/react` | Browser | `useVanaConnect()`, `useVanaData()`, `ConnectButton` |
152
- | `@opendatalabs/connect/core` | Universal | Types, `ConnectError`, constants |
149
+ | Import | Environment | Exports |
150
+ | ------------------------------- | ----------- | ---------------------------------------------------------------- |
151
+ | `@opendatalabs/connect/server` | Node.js | `connect()`, `getData()`, `signVanaManifest()`, low-level clients |
152
+ | `@opendatalabs/connect/react` | Browser | `useVanaConnect()`, `ConnectButton` |
153
+ | `@opendatalabs/connect/core` | Universal | Types, `ConnectError`, constants |
153
154
 
154
155
  ### `connect(config): Promise<SessionInitResult>`
155
156
 
156
157
  Creates a session on the Session Relay. Returns `sessionId`, `deepLinkUrl`, and `expiresAt`.
157
158
 
158
- | Param | Type | Required | Description |
159
- | ------------ | ------------------- | -------- | ---------------------------------------------------------------------- |
160
- | `privateKey` | `` `0x${string}` `` | Yes | Builder private key |
161
- | `scopes` | `string[]` | Yes | Data scopes to request |
162
- | `webhookUrl` | `string` | No | Public HTTPS URL for grant event notifications (localhost is rejected) |
163
- | `appUserId` | `string` | No | Your app's user ID for correlation |
159
+ | Param | Type | Required | Description |
160
+ | ------------ | -------------- | -------- | ----------------------------------- |
161
+ | `privateKey` | `` `0x${string}` `` | Yes | Builder private key |
162
+ | `scopes` | `string[]` | Yes | Data scopes to request |
163
+ | `webhookUrl` | `string` | No | URL for grant event notifications |
164
+ | `appUserId` | `string` | No | Your app's user ID for correlation |
164
165
 
165
- ### `getData(config): Promise<Record<string, unknown>>`
166
+ ### `getData(config): Promise<Map<string, unknown>>`
166
167
 
167
168
  Fetches user data from their Personal Server using a signed grant.
168
169
 
169
- | Param | Type | Required | Description |
170
- | ------------ | ------------------- | -------- | ---------------------------- |
171
- | `privateKey` | `` `0x${string}` `` | Yes | Builder private key |
172
- | `grant` | `GrantPayload` | Yes | Grant from the approval step |
170
+ | Param | Type | Required | Description |
171
+ | ------------ | -------------- | -------- | ------------------------------- |
172
+ | `privateKey` | `` `0x${string}` `` | Yes | Builder private key |
173
+ | `grant` | `GrantPayload` | Yes | Grant from the approval step |
173
174
 
174
175
  ### `useVanaConnect(config?): UseVanaConnectResult`
175
176
 
@@ -187,12 +188,12 @@ Returned when a user approves access:
187
188
 
188
189
  ```typescript
189
190
  interface GrantPayload {
190
- grantId: string; // on-chain permission ID
191
- userAddress: string; // user's wallet address
191
+ grantId: string; // on-chain permission ID
192
+ userAddress: string; // user's wallet address
192
193
  builderAddress: string; // your registered address
193
- scopes: string[]; // approved data scopes
194
+ scopes: string[]; // approved data scopes
194
195
  serverAddress?: string; // user's Personal Server
195
- appUserId?: string; // your app's user ID (if provided)
196
+ appUserId?: string; // your app's user ID (if provided)
196
197
  }
197
198
  ```
198
199
 
@@ -202,9 +203,9 @@ For full control over individual protocol interactions:
202
203
 
203
204
  ```typescript
204
205
  import {
205
- createRequestSigner, // Web3Signed header generation
206
- createSessionRelay, // Session Relay HTTP client
207
- createDataClient, // Data Gateway HTTP client
206
+ createRequestSigner, // Web3Signed header generation
207
+ createSessionRelay, // Session Relay HTTP client
208
+ createDataClient, // Data Gateway HTTP client
208
209
  } from "@opendatalabs/connect/server";
209
210
  ```
210
211
 
@@ -1,29 +1,3 @@
1
- /** SDK environment selector. */
2
- export type VanaEnvironment = "dev" | "prod";
3
- /** URL configuration for each SDK environment. */
4
- export declare const ENV_CONFIG: {
5
- readonly dev: {
6
- readonly sessionRelayUrl: "https://session-relay-git-dev-opendatalabs.vercel.app";
7
- readonly gatewayUrl: "https://data-gateway-env-dev-opendatalabs.vercel.app";
8
- };
9
- readonly prod: {
10
- readonly sessionRelayUrl: "https://session-relay-git-dev-opendatalabs.vercel.app";
11
- readonly gatewayUrl: "https://data-gateway-env-dev-opendatalabs.vercel.app";
12
- };
13
- };
14
- /** Default environment used when none is specified. */
15
- export declare const DEFAULT_ENVIRONMENT: VanaEnvironment;
16
- /**
17
- * Returns the URL configuration for the given environment.
18
- *
19
- * @param environment - `"dev"` or `"prod"`. Defaults to {@link DEFAULT_ENVIRONMENT}.
20
- * @returns An object with `sessionRelayUrl` and `gatewayUrl`.
21
- */
22
- export declare function getEnvConfig(environment?: VanaEnvironment): {
23
- readonly sessionRelayUrl: "https://session-relay-git-dev-opendatalabs.vercel.app";
24
- readonly gatewayUrl: "https://data-gateway-env-dev-opendatalabs.vercel.app";
25
- } | {
26
- readonly sessionRelayUrl: "https://session-relay-git-dev-opendatalabs.vercel.app";
27
- readonly gatewayUrl: "https://data-gateway-env-dev-opendatalabs.vercel.app";
28
- };
1
+ export declare const SESSION_RELAY_URL = "https://session-relay-git-dev-opendatalabs.vercel.app";
2
+ export declare const GATEWAY_URL = "https://data-gateway-env-dev-opendatalabs.vercel.app";
29
3
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,CAAC;AAE7C,kDAAkD;AAClD,eAAO,MAAM,UAAU;;;;;;;;;CAUb,CAAC;AAEX,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,EAAE,eAAwB,CAAC;AAE3D;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,WAAW,CAAC,EAAE,eAAe;;;;;;EAEzD"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,0DAC2B,CAAC;AAC1D,eAAO,MAAM,WAAW,yDACgC,CAAC"}
@@ -1,24 +1,3 @@
1
- /** URL configuration for each SDK environment. */
2
- export const ENV_CONFIG = {
3
- dev: {
4
- sessionRelayUrl: "https://session-relay-git-dev-opendatalabs.vercel.app",
5
- gatewayUrl: "https://data-gateway-env-dev-opendatalabs.vercel.app",
6
- },
7
- prod: {
8
- // TODO: Replace with actual production URLs
9
- sessionRelayUrl: "https://session-relay-git-dev-opendatalabs.vercel.app",
10
- gatewayUrl: "https://data-gateway-env-dev-opendatalabs.vercel.app",
11
- },
12
- };
13
- /** Default environment used when none is specified. */
14
- export const DEFAULT_ENVIRONMENT = "prod";
15
- /**
16
- * Returns the URL configuration for the given environment.
17
- *
18
- * @param environment - `"dev"` or `"prod"`. Defaults to {@link DEFAULT_ENVIRONMENT}.
19
- * @returns An object with `sessionRelayUrl` and `gatewayUrl`.
20
- */
21
- export function getEnvConfig(environment) {
22
- return ENV_CONFIG[environment ?? DEFAULT_ENVIRONMENT];
23
- }
1
+ export const SESSION_RELAY_URL = "https://session-relay-git-dev-opendatalabs.vercel.app";
2
+ export const GATEWAY_URL = "https://data-gateway-env-dev-opendatalabs.vercel.app";
24
3
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAGA,kDAAkD;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,GAAG,EAAE;QACH,eAAe,EAAE,uDAAuD;QACxE,UAAU,EAAE,sDAAsD;KACnE;IACD,IAAI,EAAE;QACJ,4CAA4C;QAC5C,eAAe,EAAE,uDAAuD;QACxE,UAAU,EAAE,sDAAsD;KACnE;CACO,CAAC;AAEX,uDAAuD;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAoB,MAAM,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,WAA6B;IACxD,OAAO,UAAU,CAAC,WAAW,IAAI,mBAAmB,CAAC,CAAC;AACxD,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAC5B,uDAAuD,CAAC;AAC1D,MAAM,CAAC,MAAM,WAAW,GACtB,sDAAsD,CAAC"}
@@ -1,47 +1,6 @@
1
- /**
2
- * Known error codes thrown by the SDK.
3
- *
4
- * Use these constants for typed `catch` handling instead of comparing raw strings.
5
- *
6
- * @example
7
- * ```typescript
8
- * import { ConnectError, ConnectErrorCode } from "@opendatalabs/connect/core";
9
- *
10
- * try {
11
- * await getData({ privateKey, grant });
12
- * } catch (err) {
13
- * if (err instanceof ConnectError && err.code === ConnectErrorCode.SERVER_NOT_FOUND) {
14
- * // handle missing server
15
- * }
16
- * }
17
- * ```
18
- */
19
- export declare const ConnectErrorCode: {
20
- readonly SESSION_INIT_FAILED: "SESSION_INIT_FAILED";
21
- readonly SESSION_EXPIRED: "SESSION_EXPIRED";
22
- readonly POLL_FAILED: "POLL_FAILED";
23
- readonly POLL_TIMEOUT: "POLL_TIMEOUT";
24
- readonly SERVER_NOT_FOUND: "SERVER_NOT_FOUND";
25
- readonly GATEWAY_ERROR: "GATEWAY_ERROR";
26
- readonly DATA_FETCH_FAILED: "DATA_FETCH_FAILED";
27
- readonly LIST_SCOPES_FAILED: "LIST_SCOPES_FAILED";
28
- readonly LIST_VERSIONS_FAILED: "LIST_VERSIONS_FAILED";
29
- readonly CONFIG_INVALID: "CONFIG_INVALID";
30
- readonly WEBHOOK_INVALID: "WEBHOOK_INVALID";
31
- };
32
- /** Union type of all known error code string values. */
33
- export type ConnectErrorCode = (typeof ConnectErrorCode)[keyof typeof ConnectErrorCode];
34
- /**
35
- * Error class thrown by all SDK operations.
36
- *
37
- * Includes a typed {@link code} for programmatic handling and an optional
38
- * {@link statusCode} from HTTP responses.
39
- */
40
1
  export declare class ConnectError extends Error {
41
- /** Machine-readable error code. One of {@link ConnectErrorCode} or an arbitrary server-returned string. */
42
- readonly code: ConnectErrorCode | (string & {});
43
- /** HTTP status code from the upstream response, if applicable. */
2
+ readonly code: string;
44
3
  readonly statusCode?: number;
45
- constructor(message: string, code: ConnectErrorCode | (string & {}), statusCode?: number);
4
+ constructor(message: string, code: string, statusCode?: number);
46
5
  }
47
6
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;CAYnB,CAAC;AAEX,wDAAwD;AACxD,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC,2GAA2G;IAC3G,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAChD,kEAAkE;IAClE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;gBAG3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,gBAAgB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EACtC,UAAU,CAAC,EAAE,MAAM;CAOtB"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;gBAEjB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAM/D"}
@@ -1,44 +1,5 @@
1
- /**
2
- * Known error codes thrown by the SDK.
3
- *
4
- * Use these constants for typed `catch` handling instead of comparing raw strings.
5
- *
6
- * @example
7
- * ```typescript
8
- * import { ConnectError, ConnectErrorCode } from "@opendatalabs/connect/core";
9
- *
10
- * try {
11
- * await getData({ privateKey, grant });
12
- * } catch (err) {
13
- * if (err instanceof ConnectError && err.code === ConnectErrorCode.SERVER_NOT_FOUND) {
14
- * // handle missing server
15
- * }
16
- * }
17
- * ```
18
- */
19
- export const ConnectErrorCode = {
20
- SESSION_INIT_FAILED: "SESSION_INIT_FAILED",
21
- SESSION_EXPIRED: "SESSION_EXPIRED",
22
- POLL_FAILED: "POLL_FAILED",
23
- POLL_TIMEOUT: "POLL_TIMEOUT",
24
- SERVER_NOT_FOUND: "SERVER_NOT_FOUND",
25
- GATEWAY_ERROR: "GATEWAY_ERROR",
26
- DATA_FETCH_FAILED: "DATA_FETCH_FAILED",
27
- LIST_SCOPES_FAILED: "LIST_SCOPES_FAILED",
28
- LIST_VERSIONS_FAILED: "LIST_VERSIONS_FAILED",
29
- CONFIG_INVALID: "CONFIG_INVALID",
30
- WEBHOOK_INVALID: "WEBHOOK_INVALID",
31
- };
32
- /**
33
- * Error class thrown by all SDK operations.
34
- *
35
- * Includes a typed {@link code} for programmatic handling and an optional
36
- * {@link statusCode} from HTTP responses.
37
- */
38
1
  export class ConnectError extends Error {
39
- /** Machine-readable error code. One of {@link ConnectErrorCode} or an arbitrary server-returned string. */
40
2
  code;
41
- /** HTTP status code from the upstream response, if applicable. */
42
3
  statusCode;
43
4
  constructor(message, code, statusCode) {
44
5
  super(message);
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,gBAAgB,EAAE,kBAAkB;IACpC,aAAa,EAAE,eAAe;IAC9B,iBAAiB,EAAE,mBAAmB;IACtC,kBAAkB,EAAE,oBAAoB;IACxC,oBAAoB,EAAE,sBAAsB;IAC5C,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;CAC1B,CAAC;AAMX;;;;;GAKG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,2GAA2G;IAClG,IAAI,CAAmC;IAChD,kEAAkE;IACzD,UAAU,CAAU;IAE7B,YACE,OAAe,EACf,IAAsC,EACtC,UAAmB;QAEnB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,CAAS;IACb,UAAU,CAAU;IAE7B,YAAY,OAAe,EAAE,IAAY,EAAE,UAAmB;QAC5D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF"}
@@ -1,5 +1,4 @@
1
- export { ConnectError, ConnectErrorCode } from "./errors.js";
2
- export { isValidGrant } from "./grants.js";
3
- export { getEnvConfig, ENV_CONFIG, DEFAULT_ENVIRONMENT, type VanaEnvironment, } from "./constants.js";
1
+ export { ConnectError } from "./errors.js";
2
+ export { SESSION_RELAY_URL, GATEWAY_URL } from "./constants.js";
4
3
  export type { ConnectionStatus, SessionInitParams, SessionInitResult, SessionPollResult, GrantPayload, DataFetchParams, RequestSignerConfig, SessionRelayConfig, DataClientConfig, ConnectConfig, GetDataConfig, VanaManifestConfig, VanaManifestBlock, } from "./types.js";
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAChE,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
@@ -1,4 +1,3 @@
1
- export { ConnectError, ConnectErrorCode } from "./errors.js";
2
- export { isValidGrant } from "./grants.js";
3
- export { getEnvConfig, ENV_CONFIG, DEFAULT_ENVIRONMENT, } from "./constants.js";
1
+ export { ConnectError } from "./errors.js";
2
+ export { SESSION_RELAY_URL, GATEWAY_URL } from "./constants.js";
4
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,UAAU,EACV,mBAAmB,GAEpB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,131 +1,70 @@
1
- /** Possible states of a Vana Connect session from the client's perspective. */
2
1
  export type ConnectionStatus = "idle" | "connecting" | "waiting" | "approved" | "denied" | "expired" | "error";
3
- /** Parameters for creating a new session on the Session Relay. */
4
2
  export interface SessionInitParams {
5
- /** Data scopes to request (e.g. `["chatgpt.conversations"]`). */
6
3
  scopes: string[];
7
- /** Public HTTPS URL for grant event notifications. Localhost is rejected. */
8
4
  webhookUrl?: string;
9
- /** Your app's user ID for correlation. */
10
5
  appUserId?: string;
11
6
  }
12
- /** Result returned by {@link SessionRelay.initSession}. */
13
7
  export interface SessionInitResult {
14
- /** Unique session identifier used for polling. */
15
8
  sessionId: string;
16
- /** Deep link URL that opens the Vana Desktop App. */
17
9
  deepLinkUrl: string;
18
- /** ISO 8601 expiration timestamp for the session. */
19
10
  expiresAt: string;
20
11
  }
21
- /** Result returned by {@link SessionRelay.pollSession}. */
22
12
  export interface SessionPollResult {
23
- /** Current session status. */
24
13
  status: "pending" | "claimed" | "approved" | "denied" | "expired";
25
- /** Grant payload, present when status is `"approved"`. */
26
14
  grant?: GrantPayload;
27
- /** Reason for denial, present when status is `"denied"`. */
28
15
  reason?: string;
29
16
  }
30
- /** Payload describing a user's approved data grant. */
31
17
  export interface GrantPayload {
32
- /** On-chain permission ID. */
33
18
  grantId: string;
34
- /** User's wallet address. */
35
19
  userAddress: string;
36
- /** Builder's registered wallet address. */
37
20
  builderAddress: string;
38
- /** Approved data scopes. */
39
21
  scopes: string[];
40
- /** User's Personal Server address, if known. */
41
22
  serverAddress?: string;
42
- /** Your app's user ID, if provided during session init. */
43
23
  appUserId?: string;
44
24
  }
45
- /** Parameters for fetching data from a Personal Server. */
46
25
  export interface DataFetchParams {
47
- /** Base URL of the user's Personal Server. */
48
26
  serverUrl: string;
49
- /** Data scope to fetch (e.g. `"instagram.profile"`). */
50
27
  scope: string;
51
- /** Grant ID authorizing the data access. */
52
28
  grantId: string;
53
- /** Optional file ID for a specific file within the scope. */
54
29
  fileId?: string;
55
- /** Optional ISO 8601 timestamp to fetch data at a specific point in time. */
56
30
  at?: string;
57
31
  }
58
- /** Configuration for {@link createRequestSigner}. */
59
32
  export interface RequestSignerConfig {
60
- /** Builder private key in hex format. */
61
33
  privateKey: `0x${string}`;
62
34
  }
63
- /** Configuration for {@link createSessionRelay}. */
64
35
  export interface SessionRelayConfig {
65
- /** Builder private key in hex format. */
66
36
  privateKey: `0x${string}`;
67
- /** Builder's wallet address derived from the private key. */
68
37
  granteeAddress: `0x${string}`;
69
- /** Base URL of the Session Relay service. */
70
38
  sessionRelayUrl: string;
71
39
  }
72
- /** Configuration for {@link createDataClient}. */
73
40
  export interface DataClientConfig {
74
- /** Builder private key in hex format. */
75
41
  privateKey: `0x${string}`;
76
- /** Base URL of the Data Portability Gateway. */
77
42
  gatewayUrl: string;
78
43
  }
79
- /** Configuration for the high-level {@link connect} function. */
80
44
  export interface ConnectConfig {
81
- /** Builder private key in hex format. */
82
45
  privateKey: `0x${string}`;
83
- /** Data scopes to request. */
84
46
  scopes: string[];
85
- /** Public HTTPS URL for grant event notifications. */
86
47
  webhookUrl?: string;
87
- /** Your app's user ID for correlation. */
88
48
  appUserId?: string;
89
- /** SDK environment (`"dev"` or `"prod"`). Defaults to `"prod"`. */
90
- environment?: "dev" | "prod";
91
49
  }
92
- /** Configuration for the high-level {@link getData} function. */
93
50
  export interface GetDataConfig {
94
- /** Builder private key in hex format. */
95
51
  privateKey: `0x${string}`;
96
- /** Grant from the approval step. */
97
52
  grant: GrantPayload;
98
- /** SDK environment (`"dev"` or `"prod"`). Defaults to `"prod"`. */
99
- environment?: "dev" | "prod";
100
53
  }
101
- /** Configuration for {@link signVanaManifest}. */
102
54
  export interface VanaManifestConfig {
103
- /** Builder private key in hex format. */
104
55
  privateKey: `0x${string}`;
105
- /** Canonical URL of your application. */
106
56
  appUrl: string;
107
- /** URL to your privacy policy. */
108
57
  privacyPolicyUrl: string;
109
- /** URL to your terms of service. */
110
58
  termsUrl: string;
111
- /** URL for user support. */
112
59
  supportUrl: string;
113
- /** Public webhook URL for grant notifications. */
114
60
  webhookUrl: string;
115
61
  }
116
- /** Signed manifest block included in your web app manifest under the `vana` key. */
117
62
  export interface VanaManifestBlock {
118
- /** Canonical URL of your application. */
119
63
  appUrl: string;
120
- /** URL to your privacy policy. */
121
64
  privacyPolicyUrl: string;
122
- /** URL to your terms of service. */
123
65
  termsUrl: string;
124
- /** URL for user support. */
125
66
  supportUrl: string;
126
- /** Public webhook URL for grant notifications. */
127
67
  webhookUrl: string;
128
- /** Cryptographic signature of the manifest block. */
129
68
  signature: string;
130
69
  }
131
70
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,YAAY,GACZ,SAAS,GACT,UAAU,GACV,QAAQ,GACR,SAAS,GACT,OAAO,CAAC;AAEZ,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IAChC,8BAA8B;IAC9B,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;IAClE,0DAA0D;IAC1D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,4BAA4B;IAC5B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM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MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -1,27 +1,12 @@
1
1
  import type { GrantPayload } from "../core/types.js";
2
- /** Props for the {@link ConnectButton} component. */
3
2
  export interface ConnectButtonProps {
4
- /** Session ID from the server-side `connect()` call. */
5
3
  sessionId: string;
6
- /** Optional deep link URL override. */
7
4
  deepLinkUrl?: string;
8
- /** Called when the user approves the grant. */
9
5
  onComplete?: (grant: GrantPayload) => void;
10
- /** Called on polling errors. */
11
6
  onError?: (error: string) => void;
12
- /** Called when the user denies the request. */
13
7
  onDenied?: (reason: string) => void;
14
- /** CSS class name for the wrapper element. */
15
8
  className?: string;
16
- /** Label for the deep link anchor (default: `"Open Vana Desktop App"`). */
17
9
  label?: string;
18
10
  }
19
- /**
20
- * Pre-built React component that displays connection status and a deep link.
21
- *
22
- * For full control over the UI, use {@link useVanaConnect} or {@link useVanaData} directly.
23
- *
24
- * @param props - Component props.
25
- */
26
11
  export declare function ConnectButton(props: ConnectButtonProps): import("react/jsx-runtime").JSX.Element;
27
12
  //# sourceMappingURL=ConnectButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectButton.d.ts","sourceRoot":"","sources":["../../src/react/ConnectButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,qDAAqD;AACrD,MAAM,WAAW,kBAAkB;IACjC,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,gCAAgC;IAChC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CA+CtD"}
1
+ {"version":3,"file":"ConnectButton.d.ts","sourceRoot":"","sources":["../../src/react/ConnectButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CA+CtD"}
@@ -1,13 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect } from "react";
3
3
  import { useVanaConnect } from "./useVanaConnect.js";
4
- /**
5
- * Pre-built React component that displays connection status and a deep link.
6
- *
7
- * For full control over the UI, use {@link useVanaConnect} or {@link useVanaData} directly.
8
- *
9
- * @param props - Component props.
10
- */
11
4
  export function ConnectButton(props) {
12
5
  const { sessionId, deepLinkUrl: deepLinkUrlProp, onComplete, onError, onDenied, className, label, } = props;
13
6
  const { connect, status, grant, error, deepLinkUrl } = useVanaConnect();
@@ -34,6 +27,6 @@ export function ConnectButton(props) {
34
27
  expired: "Session expired",
35
28
  error: "Connection error",
36
29
  };
37
- return (_jsxs("div", { className: className, children: [_jsx("p", { children: statusText[status] ?? status }), deepLinkUrl && status === "waiting" && (_jsx("a", { href: deepLinkUrl, children: label ?? "Open dataConnect Desktop App" }))] }));
30
+ return (_jsxs("div", { className: className, children: [_jsx("p", { children: statusText[status] ?? status }), deepLinkUrl && status === "waiting" && (_jsx("a", { href: deepLinkUrl, children: label ?? "Open Vana Desktop App" }))] }));
38
31
  }
39
32
  //# sourceMappingURL=ConnectButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectButton.js","sourceRoot":"","sources":["../../src/react/ConnectButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAoBrD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EACJ,SAAS,EACT,WAAW,EAAE,eAAe,EAC5B,UAAU,EACV,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,GACN,GAAG,KAAK,CAAC;IAEV,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,cAAc,EAAE,CAAC;IAExE,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC,CAAC;IACvD,CAAC,EAAE,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,CAAC,CA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AK,IAAI,uBAAuB,GAAK,CAC7D,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -1,4 +1,3 @@
1
1
  export { useVanaConnect, type UseVanaConnectConfig, type UseVanaConnectResult, } from "./useVanaConnect.js";
2
2
  export { ConnectButton, type ConnectButtonProps } from "./ConnectButton.js";
3
- export { useVanaData, type UseVanaDataConfig, type UseVanaDataResult, } from "./useVanaData.js";
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EACL,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,4 +1,3 @@
1
1
  export { useVanaConnect, } from "./useVanaConnect.js";
2
2
  export { ConnectButton } from "./ConnectButton.js";
3
- export { useVanaData, } from "./useVanaData.js";
4
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAGf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAA2B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EACL,WAAW,GAGZ,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAGf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAA2B,MAAM,oBAAoB,CAAC"}
@@ -1,50 +1,17 @@
1
1
  import type { ConnectionStatus, GrantPayload } from "../core/types.js";
2
- /** Configuration for the {@link useVanaConnect} hook. */
3
2
  export interface UseVanaConnectConfig {
4
- /** Polling interval in milliseconds (default: 2000). */
5
3
  pollingInterval?: number;
6
- /** SDK environment (`"dev"` or `"prod"`). Defaults to `"prod"`. */
7
- environment?: "dev" | "prod";
8
4
  }
9
- /** Return value of the {@link useVanaConnect} hook. */
10
5
  export interface UseVanaConnectResult {
11
- /** Starts polling the Session Relay for the given session. */
12
6
  connect: (params: {
13
7
  sessionId: string;
14
8
  deepLinkUrl?: string;
15
9
  }) => void;
16
- /** Current connection status. */
17
10
  status: ConnectionStatus;
18
- /** Grant payload after user approval, or `null`. */
19
11
  grant: GrantPayload | null;
20
- /** Error message, or `null`. */
21
12
  error: string | null;
22
- /** Deep link URL to open the Vana Desktop App, or `null`. */
23
13
  deepLinkUrl: string | null;
24
- /** Resets all state back to idle and stops polling. */
25
14
  reset: () => void;
26
15
  }
27
- /**
28
- * React hook that polls the Session Relay and manages connection state.
29
- *
30
- * Call `connect()` with a session ID (from your server's `/api/connect` route)
31
- * to begin polling. The hook will update `status` through the lifecycle:
32
- * `idle` -> `connecting` -> `waiting` -> `approved` | `denied` | `expired` | `error`.
33
- *
34
- * @param config - Optional configuration for polling interval and environment.
35
- * @returns A {@link UseVanaConnectResult} with state and actions.
36
- *
37
- * @example
38
- * ```tsx
39
- * const { connect, status, grant, deepLinkUrl } = useVanaConnect();
40
- *
41
- * useEffect(() => {
42
- * connect({ sessionId: "sess-123" });
43
- * }, []);
44
- *
45
- * if (status === "waiting") return <a href={deepLinkUrl!}>Open Vana</a>;
46
- * if (status === "approved") return <p>Connected! Grant: {grant!.grantId}</p>;
47
- * ```
48
- */
49
16
  export declare function useVanaConnect(config?: UseVanaConnectConfig): UseVanaConnectResult;
50
17
  //# sourceMappingURL=useVanaConnect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useVanaConnect.d.ts","sourceRoot":"","sources":["../../src/react/useVanaConnect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EAEb,MAAM,kBAAkB,CAAC;AAE1B,yDAAyD;AACzD,MAAM,WAAW,oBAAoB;IACnC,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,WAAW,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC9B;AAED,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,8DAA8D;IAC9D,OAAO,EAAE,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACvE,iCAAiC;IACjC,MAAM,EAAE,gBAAgB,CAAC;IACzB,oDAAoD;IACpD,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAC3B,gCAAgC;IAChC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,6DAA6D;IAC7D,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,uDAAuD;IACvD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,cAAc,CAC5B,MAAM,CAAC,EAAE,oBAAoB,GAC5B,oBAAoB,CAwGtB"}
1
+ {"version":3,"file":"useVanaConnect.d.ts","sourceRoot":"","sources":["../../src/react/useVanaConnect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EAEb,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC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