@opendatalabs/vana-sdk 0.1.0-alpha.5f8458e → 0.1.0-alpha.606fa2d

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 (50) hide show
  1. package/README.md +55 -4
  2. package/dist/{browser-cRpdLQ3-.d.ts → browser-Bb8gLWHp.d.ts} +61 -10
  3. package/dist/browser.d.ts +1 -1
  4. package/dist/browser.js +745 -113
  5. package/dist/browser.js.map +1 -1
  6. package/dist/chains.browser.cjs +2 -2
  7. package/dist/chains.browser.cjs.map +1 -1
  8. package/dist/chains.browser.js +2 -2
  9. package/dist/chains.browser.js.map +1 -1
  10. package/dist/chains.cjs +2 -2
  11. package/dist/chains.cjs.map +1 -1
  12. package/dist/chains.js +2 -2
  13. package/dist/chains.js.map +1 -1
  14. package/dist/chains.node.cjs +2 -2
  15. package/dist/chains.node.cjs.map +1 -1
  16. package/dist/chains.node.js +2 -2
  17. package/dist/chains.node.js.map +1 -1
  18. package/dist/index.browser.d.ts +1348 -243
  19. package/dist/index.browser.js +35080 -32770
  20. package/dist/index.browser.js.map +1 -1
  21. package/dist/index.node.cjs +35587 -33174
  22. package/dist/index.node.cjs.map +1 -1
  23. package/dist/index.node.d.cts +1136 -250
  24. package/dist/index.node.d.ts +1136 -250
  25. package/dist/index.node.js +35459 -33037
  26. package/dist/index.node.js.map +1 -1
  27. package/dist/{node-CkdgwBiv.d.cts → node-D9-F9uEP.d.cts} +3 -2
  28. package/dist/{node-CkdgwBiv.d.ts → node-D9-F9uEP.d.ts} +3 -2
  29. package/dist/node.cjs +704 -67
  30. package/dist/node.cjs.map +1 -1
  31. package/dist/node.d.cts +1 -1
  32. package/dist/node.d.ts +1 -1
  33. package/dist/node.js +716 -66
  34. package/dist/node.js.map +1 -1
  35. package/dist/platform.browser.d.ts +2 -2
  36. package/dist/platform.browser.js +808 -121
  37. package/dist/platform.browser.js.map +1 -1
  38. package/dist/platform.cjs +973 -186
  39. package/dist/platform.cjs.map +1 -1
  40. package/dist/platform.d.cts +1 -1
  41. package/dist/platform.d.ts +1 -1
  42. package/dist/platform.js +985 -186
  43. package/dist/platform.js.map +1 -1
  44. package/dist/platform.node.cjs +973 -186
  45. package/dist/platform.node.cjs.map +1 -1
  46. package/dist/platform.node.d.cts +63 -12
  47. package/dist/platform.node.d.ts +63 -12
  48. package/dist/platform.node.js +985 -186
  49. package/dist/platform.node.js.map +1 -1
  50. package/package.json +40 -23
@@ -1,4 +1,4 @@
1
- import { Chain, Address, Hash, WalletClient, Account, Abi, GetContractReturnType, PublicClient } from 'viem';
1
+ import { Chain, Address, Hash, WalletClient, Account, Abi, GetContractReturnType, TransactionReceipt as TransactionReceipt$1, PublicClient } from 'viem';
2
2
  export { Abi, Account, Address, Chain, GetContractReturnType, Hash, PublicClient, WalletClient } from 'viem';
3
3
  import { Abi as Abi$1 } from 'abitype';
4
4
 
@@ -984,6 +984,8 @@ interface ServerFilesAndPermissionParams {
984
984
  grant: string;
985
985
  /** File URLs */
986
986
  fileUrls: string[];
987
+ /** Schema IDs for each file - use 0 for files without schema validation */
988
+ schemaIds: number[];
987
989
  /** Server address */
988
990
  serverAddress: Address;
989
991
  /** Server URL */
@@ -1009,6 +1011,8 @@ interface ServerFilesAndPermissionTypedData extends GenericTypedData {
1009
1011
  grant: string;
1010
1012
  /** File URLs */
1011
1013
  fileUrls: string[];
1014
+ /** Schema IDs for each file - use 0 for files without schema validation */
1015
+ schemaIds: bigint[];
1012
1016
  /** Server address */
1013
1017
  serverAddress: Address;
1014
1018
  /** Server URL */
@@ -2159,33 +2163,84 @@ interface BatchUploadResult {
2159
2163
  errors?: string[];
2160
2164
  }
2161
2165
  /**
2162
- * Represents a data schema in the refiner registry.
2166
+ * Schema metadata from the blockchain (without fetched definition).
2167
+ *
2168
+ * This represents the on-chain schema registration data before the
2169
+ * definition has been fetched from the storage URL.
2170
+ *
2171
+ * @category Data Management
2172
+ */
2173
+ interface SchemaMetadata {
2174
+ /** Schema ID */
2175
+ id: number;
2176
+ /** Schema name */
2177
+ name: string;
2178
+ /** Schema dialect ('json' or 'sqlite') */
2179
+ dialect: "json" | "sqlite";
2180
+ /** URL containing the schema definition */
2181
+ definitionUrl: string;
2182
+ }
2183
+ /**
2184
+ * Complete schema with all definition fields populated.
2185
+ * This is what schemas.get() returns - a schema with the definition fetched.
2186
+ */
2187
+ interface CompleteSchema extends SchemaMetadata {
2188
+ /** Version of the schema */
2189
+ version: string;
2190
+ /** Optional description of the schema */
2191
+ description?: string;
2192
+ /** Optional version of the dialect */
2193
+ dialectVersion?: string;
2194
+ /** The actual schema - JSON Schema object for 'json' dialect, DDL string for 'sqlite' */
2195
+ schema: object | string;
2196
+ }
2197
+ /**
2198
+ * Schema with optional definition fields.
2163
2199
  *
2164
2200
  * Schemas define the structure and validation rules for user data processed by refiners.
2165
2201
  * They ensure data quality and consistency across the Vana network by specifying how
2166
2202
  * raw user data should be formatted, validated, and processed.
2167
2203
  *
2204
+ * When the definition has been fetched (via schemas.get() or schemas.list() with includeDefinitions),
2205
+ * the version and schema fields will be populated. Otherwise, only the metadata fields are present.
2206
+ *
2168
2207
  * @category Data Management
2169
2208
  * @example
2170
2209
  * ```typescript
2171
- * const socialMediaSchema: Schema = {
2210
+ * // Complete schema from schemas.get()
2211
+ * const completeSchema: Schema = {
2212
+ * id: 5,
2213
+ * name: 'Social Media Profile',
2214
+ * dialect: 'json',
2215
+ * definitionUrl: 'ipfs://QmSchema...',
2216
+ * version: '1.0.0',
2217
+ * description: 'Schema for validating social media profile data',
2218
+ * schema: { // JSON Schema object
2219
+ * type: 'object',
2220
+ * properties: {
2221
+ * username: { type: 'string' }
2222
+ * }
2223
+ * }
2224
+ * };
2225
+ *
2226
+ * // Metadata-only schema from schemas.list() without includeDefinitions
2227
+ * const metadataSchema: Schema = {
2172
2228
  * id: 5,
2173
2229
  * name: 'Social Media Profile',
2174
- * type: 'JSON',
2175
- * url: 'ipfs://QmSchema...', // Schema definition file
2176
- * description: 'Schema for validating social media profile data'
2230
+ * dialect: 'json',
2231
+ * definitionUrl: 'ipfs://QmSchema...'
2177
2232
  * };
2178
2233
  * ```
2179
2234
  */
2180
- interface Schema {
2181
- /** Schema ID */
2182
- id: number;
2183
- /** Schema name */
2184
- name: string;
2185
- /** Schema type */
2186
- type: string;
2187
- /** URL containing the schema definition */
2188
- definitionUrl: string;
2235
+ interface Schema extends SchemaMetadata {
2236
+ /** Version of the schema (present when definition is fetched) */
2237
+ version?: string;
2238
+ /** Optional description of the schema */
2239
+ description?: string;
2240
+ /** Optional version of the dialect */
2241
+ dialectVersion?: string;
2242
+ /** The actual schema - JSON Schema object for 'json' dialect, DDL string for 'sqlite' (present when definition is fetched) */
2243
+ schema?: object | string;
2189
2244
  }
2190
2245
  /**
2191
2246
  * Represents a refiner with schema information
@@ -2214,8 +2269,8 @@ interface Refiner {
2214
2269
  interface AddSchemaParams {
2215
2270
  /** Schema name */
2216
2271
  name: string;
2217
- /** Schema type */
2218
- type: string;
2272
+ /** Schema dialect */
2273
+ dialect: string;
2219
2274
  /** URL containing the schema definition */
2220
2275
  definitionUrl: string;
2221
2276
  }
@@ -2290,13 +2345,7 @@ interface UpdateSchemaIdResult {
2290
2345
  transactionHash: Hash;
2291
2346
  }
2292
2347
  /**
2293
- * Query mode for trusted server retrieval
2294
- *
2295
- * @category Data Management
2296
- */
2297
- type TrustedServerQueryMode = "subgraph" | "rpc" | "auto";
2298
- /**
2299
- * Trusted server data structure (unified format for both subgraph and RPC modes)
2348
+ * Trusted server data structure
2300
2349
  *
2301
2350
  * @category Data Management
2302
2351
  */
@@ -2315,39 +2364,20 @@ interface TrustedServer {
2315
2364
  trustIndex?: number;
2316
2365
  }
2317
2366
  /**
2318
- * Parameters for getUserTrustedServers with dual-mode support
2367
+ * Parameters for getUserTrustedServers method
2319
2368
  *
2320
2369
  * @category Data Management
2321
2370
  */
2322
2371
  interface GetUserTrustedServersParams {
2323
- /** User address to query */
2372
+ /** User address to query trusted servers for */
2324
2373
  user: Address;
2325
- /** Query mode: 'subgraph' (fast, requires subgraph), 'rpc' (direct contract), or 'auto' (tries subgraph first) */
2326
- mode?: TrustedServerQueryMode;
2327
- /** Subgraph URL (required for subgraph mode) */
2374
+ /** Optional subgraph URL to override default */
2328
2375
  subgraphUrl?: string;
2329
- /** Pagination limit (applies to RPC mode) */
2376
+ /** Maximum number of results */
2330
2377
  limit?: number;
2331
- /** Pagination offset (applies to RPC mode) */
2378
+ /** Number of results to skip */
2332
2379
  offset?: number;
2333
2380
  }
2334
- /**
2335
- * Result of getUserTrustedServers query
2336
- *
2337
- * @category Data Management
2338
- */
2339
- interface GetUserTrustedServersResult {
2340
- /** Array of trusted servers */
2341
- servers: TrustedServer[];
2342
- /** Query mode that was actually used */
2343
- usedMode: TrustedServerQueryMode;
2344
- /** Total count (only available in RPC mode) */
2345
- total?: number;
2346
- /** Whether there are more servers (pagination info for RPC mode) */
2347
- hasMore?: boolean;
2348
- /** Any warnings or fallback information */
2349
- warnings?: string[];
2350
- }
2351
2381
 
2352
2382
  declare const contractAbis: {
2353
2383
  readonly DataPortabilityPermissions: readonly [{
@@ -2466,6 +2496,18 @@ declare const contractAbis: {
2466
2496
  }];
2467
2497
  readonly name: "InvalidPermissionsLength";
2468
2498
  readonly type: "error";
2499
+ }, {
2500
+ readonly inputs: readonly [{
2501
+ readonly internalType: "uint256";
2502
+ readonly name: "filesLength";
2503
+ readonly type: "uint256";
2504
+ }, {
2505
+ readonly internalType: "uint256";
2506
+ readonly name: "schemaIdsLength";
2507
+ readonly type: "uint256";
2508
+ }];
2509
+ readonly name: "InvalidSchemaIdsLength";
2510
+ readonly type: "error";
2469
2511
  }, {
2470
2512
  readonly inputs: readonly [];
2471
2513
  readonly name: "InvalidSignature";
@@ -2742,6 +2784,10 @@ declare const contractAbis: {
2742
2784
  readonly internalType: "string[]";
2743
2785
  readonly name: "fileUrls";
2744
2786
  readonly type: "string[]";
2787
+ }, {
2788
+ readonly internalType: "uint256[]";
2789
+ readonly name: "schemaIds";
2790
+ readonly type: "uint256[]";
2745
2791
  }, {
2746
2792
  readonly internalType: "address";
2747
2793
  readonly name: "serverAddress";
@@ -3724,7 +3770,7 @@ declare const contractAbis: {
3724
3770
  readonly name: "addServerInput";
3725
3771
  readonly type: "tuple";
3726
3772
  }];
3727
- readonly name: "addAndTrustServerOnBehalf";
3773
+ readonly name: "addAndTrustServerByManager";
3728
3774
  readonly outputs: readonly [];
3729
3775
  readonly stateMutability: "nonpayable";
3730
3776
  readonly type: "function";
@@ -4112,6 +4158,20 @@ declare const contractAbis: {
4112
4158
  readonly outputs: readonly [];
4113
4159
  readonly stateMutability: "nonpayable";
4114
4160
  readonly type: "function";
4161
+ }, {
4162
+ readonly inputs: readonly [{
4163
+ readonly internalType: "address";
4164
+ readonly name: "userAddress";
4165
+ readonly type: "address";
4166
+ }, {
4167
+ readonly internalType: "uint256";
4168
+ readonly name: "serverId";
4169
+ readonly type: "uint256";
4170
+ }];
4171
+ readonly name: "trustServerByManager";
4172
+ readonly outputs: readonly [];
4173
+ readonly stateMutability: "nonpayable";
4174
+ readonly type: "function";
4115
4175
  }, {
4116
4176
  readonly inputs: readonly [{
4117
4177
  readonly components: readonly [{
@@ -28735,6 +28795,95 @@ type VanaContract = keyof ContractAbis;
28735
28795
  */
28736
28796
  declare function getAbi<T extends VanaContract>(contract: T): ContractAbis[T];
28737
28797
 
28798
+ /**
28799
+ * Comprehensive mapping of SDK transaction operations to blockchain events.
28800
+ * Used by the generic transaction parser to know which contract and event
28801
+ * to look for when parsing transaction results.
28802
+ */
28803
+ declare const EVENT_MAPPINGS: {
28804
+ readonly grant: {
28805
+ readonly contract: "DataPortabilityPermissions";
28806
+ readonly event: "PermissionAdded";
28807
+ };
28808
+ readonly revoke: {
28809
+ readonly contract: "DataPortabilityPermissions";
28810
+ readonly event: "PermissionRevoked";
28811
+ };
28812
+ readonly revokePermission: {
28813
+ readonly contract: "DataPortabilityPermissions";
28814
+ readonly event: "PermissionRevoked";
28815
+ };
28816
+ readonly addServerFilesAndPermissions: {
28817
+ readonly contract: "DataPortabilityPermissions";
28818
+ readonly event: "PermissionAdded";
28819
+ };
28820
+ readonly trustServer: {
28821
+ readonly contract: "DataPortabilityServers";
28822
+ readonly event: "ServerTrusted";
28823
+ };
28824
+ readonly untrustServer: {
28825
+ readonly contract: "DataPortabilityServers";
28826
+ readonly event: "ServerUntrusted";
28827
+ };
28828
+ readonly registerServer: {
28829
+ readonly contract: "DataPortabilityServers";
28830
+ readonly event: "ServerRegistered";
28831
+ };
28832
+ readonly updateServer: {
28833
+ readonly contract: "DataPortabilityServers";
28834
+ readonly event: "ServerUpdated";
28835
+ };
28836
+ readonly addAndTrustServer: {
28837
+ readonly contract: "DataPortabilityServers";
28838
+ readonly event: "ServerTrusted";
28839
+ };
28840
+ readonly addFile: {
28841
+ readonly contract: "DataRegistry";
28842
+ readonly event: "FileAdded";
28843
+ };
28844
+ readonly addFileWithPermissionsAndSchema: {
28845
+ readonly contract: "DataRegistry";
28846
+ readonly event: "FileAdded";
28847
+ };
28848
+ readonly addFileWithSchema: {
28849
+ readonly contract: "DataRegistry";
28850
+ readonly event: "FileAdded";
28851
+ };
28852
+ readonly addFileWithPermissions: {
28853
+ readonly contract: "DataRegistry";
28854
+ readonly event: "FileAdded";
28855
+ };
28856
+ readonly addRefinement: {
28857
+ readonly contract: "DataRegistry";
28858
+ readonly event: "RefinementAdded";
28859
+ };
28860
+ readonly addRefiner: {
28861
+ readonly contract: "DataRefinerRegistry";
28862
+ readonly event: "RefinerAdded";
28863
+ };
28864
+ readonly updateSchemaId: {
28865
+ readonly contract: "DataRefinerRegistry";
28866
+ readonly event: "SchemaAdded";
28867
+ };
28868
+ readonly addSchema: {
28869
+ readonly contract: "DataRefinerRegistry";
28870
+ readonly event: "SchemaAdded";
28871
+ };
28872
+ readonly updateRefinement: {
28873
+ readonly contract: "DataRegistry";
28874
+ readonly event: "RefinementUpdated";
28875
+ };
28876
+ readonly addFilePermission: {
28877
+ readonly contract: "DataRegistry";
28878
+ readonly event: "PermissionGranted";
28879
+ };
28880
+ readonly registerGrantee: {
28881
+ readonly contract: "DataPortabilityGrantees";
28882
+ readonly event: "GranteeRegistered";
28883
+ };
28884
+ };
28885
+ type TransactionOperation = keyof typeof EVENT_MAPPINGS;
28886
+
28738
28887
  /**
28739
28888
  * Base interface for all transaction results.
28740
28889
  * Contains the event data plus transaction metadata.
@@ -28772,6 +28921,50 @@ interface PermissionRevokeResult extends BaseTransactionResult {
28772
28921
  /** ID of the permission that was revoked */
28773
28922
  permissionId: bigint;
28774
28923
  }
28924
+ /**
28925
+ * Result of a successful server trust operation.
28926
+ * Contains data from the ServerTrusted blockchain event.
28927
+ */
28928
+ interface ServerTrustResult extends BaseTransactionResult {
28929
+ /** Address of the user who trusted the server */
28930
+ user: Address;
28931
+ /** Address/ID of the trusted server */
28932
+ serverId: Address;
28933
+ /** URL of the trusted server */
28934
+ serverUrl: string;
28935
+ }
28936
+ /**
28937
+ * Result of a successful server untrust operation.
28938
+ * Contains data from the ServerUntrusted blockchain event.
28939
+ */
28940
+ interface ServerUntrustResult extends BaseTransactionResult {
28941
+ /** Address of the user who untrusted the server */
28942
+ user: Address;
28943
+ /** Address/ID of the untrusted server */
28944
+ serverId: Address;
28945
+ }
28946
+ /**
28947
+ * Result of a successful server update operation.
28948
+ * Contains data from the ServerUpdated blockchain event.
28949
+ */
28950
+ interface ServerUpdateResult extends BaseTransactionResult {
28951
+ /** ID of the server that was updated */
28952
+ serverId: bigint;
28953
+ /** New URL of the server */
28954
+ url: string;
28955
+ }
28956
+ /**
28957
+ * Result of a successful grantee registration operation.
28958
+ * Contains data from the GranteeRegistered blockchain event.
28959
+ */
28960
+ interface GranteeRegisterResult extends BaseTransactionResult {
28961
+ /** Unique grantee ID assigned by the registry */
28962
+ granteeId: bigint;
28963
+ /** Address of the registered grantee */
28964
+ granteeAddress: Address;
28965
+ /** Display name of the grantee */
28966
+ name: string;
28967
+ }
28775
28968
  /**
28776
28969
  * Result of a successful file permission addition operation.
28777
28970
  * Contains data from the FilePermissionAdded blockchain event.
@@ -28785,6 +28978,80 @@ interface FilePermissionResult extends BaseTransactionResult {
28785
28978
  encryptedKey: string;
28786
28979
  }
28787
28980
 
28981
+ /**
28982
+ * Provides a unified interface for blockchain transaction results with lazy-loaded event parsing.
28983
+ *
28984
+ * @remarks
28985
+ * TransactionHandle enables immediate access to transaction hashes while providing optional
28986
+ * lazy-loaded access to receipts and parsed event data. All transaction-submitting methods
28987
+ * in the SDK return this handle, allowing developers to choose between immediate hash access
28988
+ * or waiting for event data. Results are memoized to prevent redundant network calls.
28989
+ *
28990
+ * @category Transactions
28991
+ * @example
28992
+ * ```typescript
28993
+ * // Immediate hash access
28994
+ * const tx = await sdk.permissions.submitSignedGrant(typedData, signature);
28995
+ * console.log(`Transaction submitted: ${tx.hash}`);
28996
+ *
28997
+ * // Wait for and parse events
28998
+ * const eventData = await tx.waitForEvents();
28999
+ * console.log(`Permission ID: ${eventData.permissionId}`);
29000
+ *
29001
+ * // Check receipt for gas usage
29002
+ * const receipt = await tx.waitForReceipt();
29003
+ * console.log(`Gas used: ${receipt.gasUsed}`);
29004
+ * ```
29005
+ */
29006
+ declare class TransactionHandle<TEventData = unknown> {
29007
+ private readonly context;
29008
+ readonly hash: Hash;
29009
+ private readonly operation?;
29010
+ private _receipt?;
29011
+ private _eventData?;
29012
+ private _receiptPromise?;
29013
+ private _eventPromise?;
29014
+ constructor(context: ControllerContext$1, hash: Hash, operation?: TransactionOperation | undefined);
29015
+ /**
29016
+ * Waits for transaction confirmation and returns the receipt.
29017
+ * Results are memoized - multiple calls return the same promise.
29018
+ *
29019
+ * @param options Optional timeout configuration
29020
+ * @param options.timeout Timeout in milliseconds (default: 30000)
29021
+ * @returns Transaction receipt with gas usage, logs, and status
29022
+ */
29023
+ waitForReceipt(options?: {
29024
+ timeout?: number;
29025
+ }): Promise<TransactionReceipt$1>;
29026
+ /**
29027
+ * Waits for transaction confirmation and parses emitted events.
29028
+ * Results are memoized - multiple calls return the same promise.
29029
+ *
29030
+ * @returns Parsed event data with transaction metadata
29031
+ * @throws {Error} If no operation was specified for event parsing
29032
+ */
29033
+ waitForEvents(): Promise<TEventData>;
29034
+ /**
29035
+ * Enables string coercion for backwards compatibility.
29036
+ * Allows TransactionHandle to be used anywhere a Hash is expected.
29037
+ *
29038
+ * @example
29039
+ * ```typescript
29040
+ * const hash: Hash = tx; // Works via toString()
29041
+ * console.log(`Transaction: ${tx}`); // Prints hash
29042
+ * ```
29043
+ * @returns The transaction hash as a string
29044
+ */
29045
+ toString(): string;
29046
+ /**
29047
+ * JSON serialization support.
29048
+ * Returns the hash when serialized to JSON.
29049
+ *
29050
+ * @returns The transaction hash for JSON serialization
29051
+ */
29052
+ toJSON(): string;
29053
+ }
29054
+
28788
29055
  /**
28789
29056
  * Google Drive Storage Provider for Vana SDK
28790
29057
  *
@@ -29823,30 +30090,31 @@ declare class PermissionsController {
29823
30090
  */
29824
30091
  grant(params: GrantPermissionParams$1): Promise<PermissionGrantResult>;
29825
30092
  /**
29826
- * Submits a permission grant transaction and returns the transaction hash immediately.
30093
+ * Submits a permission grant transaction and returns a handle for flexible result access.
29827
30094
  *
29828
- * This is the lower-level method that provides maximum control over transaction timing.
29829
- * Use this when you want to handle transaction confirmation and event parsing separately,
29830
- * or when submitting multiple transactions in batch.
30095
+ * @remarks
30096
+ * This lower-level method provides maximum control over transaction timing.
30097
+ * Returns a TransactionHandle that allows immediate hash access or optional event parsing.
30098
+ * Use this when handling multiple transactions or when you need granular control.
29831
30099
  *
29832
30100
  * @param params - The permission grant configuration object
29833
- * @returns Promise that resolves to the transaction hash when successfully submitted
30101
+ * @returns Promise resolving to TransactionHandle with hash and event parsing capabilities
29834
30102
  * @throws {RelayerError} When gasless transaction submission fails
29835
30103
  * @throws {SignatureError} When user rejects the signature request
29836
30104
  * @throws {SerializationError} When grant data cannot be serialized
29837
30105
  * @throws {BlockchainError} When permission grant preparation fails
29838
30106
  * @example
29839
30107
  * ```typescript
29840
- * // Submit transaction and handle confirmation later
29841
- * const txHash = await vana.permissions.submitPermissionGrant(params);
29842
- * console.log(`Transaction submitted: ${txHash}`);
30108
+ * // Submit transaction and get immediate hash access
30109
+ * const tx = await vana.permissions.submitPermissionGrant(params);
30110
+ * console.log(`Transaction submitted: ${tx.hash}`);
29843
30111
  *
29844
- * // Later, when you need the permission data:
29845
- * const result = await parseTransactionResult(context, txHash, 'grant');
29846
- * console.log(`Permission ID: ${result.permissionId}`);
30112
+ * // Optionally wait for and parse events
30113
+ * const eventData = await tx.waitForEvents();
30114
+ * console.log(`Permission ID: ${eventData.permissionId}`);
29847
30115
  * ```
29848
30116
  */
29849
- submitPermissionGrant(params: GrantPermissionParams$1): Promise<Hash>;
30117
+ submitPermissionGrant(params: GrantPermissionParams$1): Promise<TransactionHandle<PermissionGrantResult>>;
29850
30118
  /**
29851
30119
  * Prepares a permission grant with preview before signing.
29852
30120
  *
@@ -29874,15 +30142,21 @@ declare class PermissionsController {
29874
30142
  */
29875
30143
  prepareGrant(params: GrantPermissionParams$1): Promise<{
29876
30144
  preview: GrantFile;
29877
- confirm: () => Promise<Hash>;
30145
+ confirm: () => Promise<TransactionHandle<PermissionGrantResult>>;
29878
30146
  }>;
29879
30147
  /**
29880
- * Internal method to complete the grant process after user confirmation.
29881
- * This is called by the confirm() function returned from prepareGrant().
30148
+ * Completes the grant process after user confirmation.
30149
+ *
30150
+ * @remarks
30151
+ * This internal method is called by the confirm() function returned from prepareGrant().
30152
+ * It handles IPFS upload, signature creation, and transaction submission.
29882
30153
  *
29883
30154
  * @param params - The permission grant parameters containing user and operation details
29884
30155
  * @param grantFile - The prepared grant file with permissions and metadata
29885
- * @returns Promise resolving to the transaction hash
30156
+ * @returns Promise resolving to TransactionHandle for flexible result access
30157
+ * @throws {BlockchainError} When permission grant confirmation fails
30158
+ * @throws {NetworkError} When IPFS upload fails
30159
+ * @throws {SignatureError} When user rejects the signature
29886
30160
  */
29887
30161
  private confirmGrantInternal;
29888
30162
  /**
@@ -29938,49 +30212,106 @@ declare class PermissionsController {
29938
30212
  * );
29939
30213
  * ```
29940
30214
  */
29941
- submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<Hash>;
30215
+ submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
29942
30216
  /**
29943
30217
  * Submits an already-signed trust server transaction to the blockchain.
30218
+ *
30219
+ * @remarks
29944
30220
  * This method extracts the trust server input from typed data and submits it directly.
30221
+ * Used internally by trust server methods after signature collection.
29945
30222
  *
29946
30223
  * @param typedData - The EIP-712 typed data for TrustServer
29947
- * @param signature - The user's signature
29948
- * @returns Promise resolving to the transaction hash
30224
+ * @param signature - The user's signature obtained via `signTypedData()`
30225
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30226
+ * @throws {BlockchainError} When contract submission fails
30227
+ * @throws {NetworkError} When blockchain communication fails
30228
+ * @example
30229
+ * ```typescript
30230
+ * const txHandle = await vana.permissions.submitSignedTrustServer(
30231
+ * typedData,
30232
+ * "0x1234..."
30233
+ * );
30234
+ * const result = await txHandle.waitForEvents();
30235
+ * ```
29949
30236
  */
29950
- submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<Hash>;
30237
+ submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
29951
30238
  /**
29952
30239
  * Submits an already-signed add and trust server transaction to the blockchain.
30240
+ *
30241
+ * @remarks
29953
30242
  * This method extracts the add and trust server input from typed data and submits it directly.
30243
+ * Combines server registration and trust operations in a single transaction.
29954
30244
  *
29955
30245
  * @param typedData - The EIP-712 typed data for AddAndTrustServer
29956
- * @param signature - The user's signature
29957
- * @returns Promise resolving to the transaction hash
30246
+ * @param signature - The user's signature obtained via `signTypedData()`
30247
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30248
+ * @throws {BlockchainError} When contract submission fails
30249
+ * @throws {NetworkError} When blockchain communication fails
30250
+ * @example
30251
+ * ```typescript
30252
+ * const txHandle = await vana.permissions.submitSignedAddAndTrustServer(
30253
+ * typedData,
30254
+ * "0x1234..."
30255
+ * );
30256
+ * const result = await txHandle.waitForEvents();
30257
+ * ```
29958
30258
  */
29959
- submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<Hash>;
30259
+ submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
29960
30260
  /**
29961
30261
  * Submits an already-signed permission revoke transaction to the blockchain.
30262
+ *
30263
+ * @remarks
29962
30264
  * This method handles the revocation of previously granted permissions.
30265
+ * Used internally by revocation methods after signature collection.
29963
30266
  *
29964
30267
  * @param typedData - The EIP-712 typed data for PermissionRevoke
29965
- * @param signature - The user's signature
29966
- * @returns Promise resolving to the transaction hash
30268
+ * @param signature - The user's signature obtained via `signTypedData()`
30269
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30270
+ * @throws {BlockchainError} When contract submission fails
30271
+ * @throws {NetworkError} When blockchain communication fails
30272
+ * @example
30273
+ * ```typescript
30274
+ * const txHandle = await vana.permissions.submitSignedRevoke(
30275
+ * typedData,
30276
+ * "0x1234..."
30277
+ * );
30278
+ * const result = await txHandle.waitForEvents();
30279
+ * ```
29967
30280
  */
29968
- submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30281
+ submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionRevokeResult>>;
29969
30282
  /**
29970
30283
  * Submits an already-signed untrust server transaction to the blockchain.
30284
+ *
30285
+ * @remarks
29971
30286
  * This method handles the removal of trusted servers.
30287
+ * Used internally by untrust server methods after signature collection.
29972
30288
  *
29973
30289
  * @param typedData - The EIP-712 typed data for UntrustServer
29974
- * @param signature - The user's signature
29975
- * @returns Promise resolving to the transaction hash
30290
+ * @param signature - The user's signature obtained via `signTypedData()`
30291
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30292
+ * @throws {BlockchainError} When contract submission fails
30293
+ * @throws {NetworkError} When blockchain communication fails
30294
+ * @example
30295
+ * ```typescript
30296
+ * const txHandle = await vana.permissions.submitSignedUntrustServer(
30297
+ * typedData,
30298
+ * "0x1234..."
30299
+ * );
30300
+ * const result = await txHandle.waitForEvents();
30301
+ * ```
29976
30302
  */
29977
- submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30303
+ submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<ServerUntrustResult>>;
29978
30304
  /**
29979
30305
  * Submits a signed transaction directly to the blockchain.
29980
30306
  *
30307
+ * @remarks
30308
+ * Internal method used when relayer callbacks are not available. Formats the signature
30309
+ * and submits the permission grant directly to the smart contract.
30310
+ *
29981
30311
  * @param typedData - The typed data structure for the permission grant
29982
30312
  * @param signature - The cryptographic signature authorizing the transaction
29983
30313
  * @returns Promise resolving to the transaction hash
30314
+ * @throws {BlockchainError} When contract submission fails
29984
30315
  */
29985
30316
  private submitDirectTransaction;
29986
30317
  /**
@@ -30027,19 +30358,33 @@ declare class PermissionsController {
30027
30358
  * console.log(`Revocation submitted: ${txHash}`);
30028
30359
  * ```
30029
30360
  */
30030
- submitPermissionRevoke(params: RevokePermissionParams): Promise<Hash>;
30361
+ submitPermissionRevoke(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
30031
30362
  /**
30032
- * Revokes a permission with a signature (gasless transaction).
30363
+ * Revokes a permission with a signature for gasless transactions.
30364
+ *
30365
+ * @remarks
30366
+ * This method creates an EIP-712 signature for permission revocation and submits
30367
+ * it either through relayer callbacks or directly to the blockchain. Provides
30368
+ * gasless revocation when relayer is configured.
30033
30369
  *
30034
30370
  * @param params - Parameters for revoking the permission
30035
- * @returns Promise resolving to transaction hash
30371
+ * @param params.permissionId - Permission identifier to revoke (accepts bigint, number, or string)
30372
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30036
30373
  * @throws {BlockchainError} When chain ID is not available
30037
30374
  * @throws {NonceError} When retrieving user nonce fails
30038
30375
  * @throws {SignatureError} When user rejects the signature request
30039
30376
  * @throws {RelayerError} When gasless submission fails
30040
30377
  * @throws {PermissionError} When revocation fails for any other reason
30378
+ * @example
30379
+ * ```typescript
30380
+ * const txHandle = await vana.permissions.submitRevokeWithSignature({
30381
+ * permissionId: 123n
30382
+ * });
30383
+ * const result = await txHandle.waitForEvents();
30384
+ * console.log(`Permission ${result.permissionId} revoked`);
30385
+ * ```
30041
30386
  */
30042
- submitRevokeWithSignature(params: RevokePermissionParams): Promise<Hash>;
30387
+ submitRevokeWithSignature(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
30043
30388
  /**
30044
30389
  * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30045
30390
  *
@@ -30064,6 +30409,18 @@ declare class PermissionsController {
30064
30409
  * const serversNonce = await this.getServersUserNonce();
30065
30410
  * ```
30066
30411
  */
30412
+ /**
30413
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30414
+ *
30415
+ * Retrieves the user's current nonce from the DataPortabilityServers contract.
30416
+ *
30417
+ * @remarks
30418
+ * This method is deprecated in favor of more specific nonce methods that target
30419
+ * the appropriate contract for the operation being performed.
30420
+ *
30421
+ * @returns Promise resolving to the user's current nonce as a bigint
30422
+ * @throws {NonceError} When retrieving the nonce fails
30423
+ */
30067
30424
  private getUserNonce;
30068
30425
  /**
30069
30426
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
@@ -30079,6 +30436,16 @@ declare class PermissionsController {
30079
30436
  * console.log(`Current servers nonce: ${nonce}`);
30080
30437
  * ```
30081
30438
  */
30439
+ /**
30440
+ * Retrieves the user's current nonce from the DataPortabilityServers contract.
30441
+ *
30442
+ * @remarks
30443
+ * Used for server-related operations (trust/untrust) to prevent replay attacks.
30444
+ * The nonce must be incremented with each server operation.
30445
+ *
30446
+ * @returns Promise resolving to the user's current nonce as a bigint
30447
+ * @throws {NonceError} When retrieving the nonce fails
30448
+ */
30082
30449
  private getServersUserNonce;
30083
30450
  /**
30084
30451
  * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
@@ -30094,6 +30461,16 @@ declare class PermissionsController {
30094
30461
  * console.log(`Current permissions nonce: ${nonce}`);
30095
30462
  * ```
30096
30463
  */
30464
+ /**
30465
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
30466
+ *
30467
+ * @remarks
30468
+ * Used for permission-related operations (grant/revoke) to prevent replay attacks.
30469
+ * The nonce must be incremented with each permission operation.
30470
+ *
30471
+ * @returns Promise resolving to the user's current nonce as a bigint
30472
+ * @throws {NonceError} When retrieving the nonce fails
30473
+ */
30097
30474
  private getPermissionsUserNonce;
30098
30475
  /**
30099
30476
  * Composes the EIP-712 typed data for PermissionGrant (new simplified format).
@@ -30115,6 +30492,7 @@ declare class PermissionsController {
30115
30492
  * @param params.granteeId - Grantee ID
30116
30493
  * @param params.grant - Grant URL or grant data
30117
30494
  * @param params.fileUrls - Array of file URLs
30495
+ * @param params.schemaIds - Schema IDs for each file
30118
30496
  * @param params.serverAddress - Server address
30119
30497
  * @param params.serverUrl - Server URL
30120
30498
  * @param params.serverPublicKey - Server public key
@@ -30220,7 +30598,7 @@ declare class PermissionsController {
30220
30598
  * console.log('Now trusting servers:', trustedServers);
30221
30599
  * ```
30222
30600
  */
30223
- addAndTrustServer(params: AddAndTrustServerParams): Promise<Hash>;
30601
+ addAndTrustServer(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30224
30602
  /**
30225
30603
  * Trusts a server for data processing (legacy method).
30226
30604
  *
@@ -30228,14 +30606,14 @@ declare class PermissionsController {
30228
30606
  * @returns Promise resolving to transaction hash
30229
30607
  * @deprecated Use addAndTrustServer instead
30230
30608
  */
30231
- submitTrustServer(params: TrustServerParams): Promise<Hash>;
30609
+ submitTrustServer(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30232
30610
  /**
30233
30611
  * Adds and trusts a server using a signature (gasless transaction).
30234
30612
  *
30235
30613
  * @param params - Parameters for adding and trusting the server
30236
- * @returns Promise resolving to transaction hash
30614
+ * @returns Promise resolving to TransactionHandle with ServerTrustResult event data
30237
30615
  */
30238
- submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<Hash>;
30616
+ submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30239
30617
  /**
30240
30618
  * Trusts a server using a signature (gasless transaction - legacy method).
30241
30619
  *
@@ -30249,13 +30627,24 @@ declare class PermissionsController {
30249
30627
  * @throws {ServerUrlMismatchError} When server URL doesn't match existing registration
30250
30628
  * @throws {BlockchainError} When trust operation fails for any other reason
30251
30629
  */
30252
- submitTrustServerWithSignature(params: TrustServerParams): Promise<Hash>;
30630
+ submitTrustServerWithSignature(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30253
30631
  /**
30254
30632
  * Submits a direct untrust server transaction (without signature).
30255
30633
  *
30256
30634
  * @param params - The untrust server parameters containing server details
30257
30635
  * @returns Promise resolving to the transaction hash
30258
30636
  */
30637
+ /**
30638
+ * Submits an untrust server transaction directly to the blockchain.
30639
+ *
30640
+ * @remarks
30641
+ * Internal method used for direct blockchain submission of untrust server operations
30642
+ * when relayer callbacks are not available.
30643
+ *
30644
+ * @param params - The untrust server parameters
30645
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30646
+ * @throws {BlockchainError} When contract submission fails
30647
+ */
30259
30648
  private submitDirectUntrustTransaction;
30260
30649
  /**
30261
30650
  * Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
@@ -30285,7 +30674,7 @@ declare class PermissionsController {
30285
30674
  * console.log('Still trusting servers:', trustedServers);
30286
30675
  * ```
30287
30676
  */
30288
- submitUntrustServer(params: UntrustServerParams): Promise<Hash>;
30677
+ submitUntrustServer(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
30289
30678
  /**
30290
30679
  * Untrusts a server using a signature (gasless transaction).
30291
30680
  *
@@ -30298,7 +30687,7 @@ declare class PermissionsController {
30298
30687
  * @throws {RelayerError} When gasless submission fails
30299
30688
  * @throws {BlockchainError} When untrust transaction fails
30300
30689
  */
30301
- submitUntrustServerWithSignature(params: UntrustServerParams): Promise<Hash>;
30690
+ submitUntrustServerWithSignature(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
30302
30691
  /**
30303
30692
  * Retrieves all servers trusted by a user from the DataPortabilityServers contract.
30304
30693
  *
@@ -30349,22 +30738,60 @@ declare class PermissionsController {
30349
30738
  /**
30350
30739
  * Gets server information for multiple servers efficiently.
30351
30740
  *
30352
- * @param serverIds - Array of server IDs to query
30353
- * @returns Promise resolving to batch result with successes and failures
30741
+ * @remarks
30742
+ * This method uses multicall to fetch information for multiple servers in a single
30743
+ * blockchain call, improving performance when querying many servers. Failed lookups
30744
+ * are returned separately for error handling.
30745
+ *
30746
+ * @param serverIds - Array of numeric server IDs to query
30747
+ * @returns Promise resolving to batch result containing successful lookups and failed IDs
30354
30748
  * @throws {BlockchainError} When reading from contract fails or chain is unavailable
30749
+ * @example
30750
+ * ```typescript
30751
+ * const result = await vana.permissions.getServerInfoBatch([1, 2, 3, 999]);
30752
+ *
30753
+ * // Process successful lookups
30754
+ * result.servers.forEach((server, id) => {
30755
+ * console.log(`Server ${id}: ${server.url}`);
30756
+ * });
30757
+ *
30758
+ * // Handle failed lookups
30759
+ * if (result.failed.length > 0) {
30760
+ * console.log(`Failed to fetch: ${result.failed.join(', ')}`);
30761
+ * }
30762
+ * ```
30355
30763
  */
30356
30764
  getServerInfoBatch(serverIds: number[]): Promise<BatchServerInfoResult>;
30357
30765
  /**
30358
30766
  * Checks whether a specific server is trusted by a user.
30359
30767
  *
30360
- * @param serverId - Server ID to check (numeric)
30768
+ * @remarks
30769
+ * This method queries the user's trusted server list and checks if the specified
30770
+ * server is present. Returns both the trust status and the index in the trust list
30771
+ * if trusted.
30772
+ *
30773
+ * @param serverId - Numeric server ID to check
30361
30774
  * @param userAddress - Optional user address (defaults to current user)
30362
- * @returns Promise resolving to server trust status
30775
+ * @returns Promise resolving to server trust status with trust index if applicable
30776
+ * @throws {BlockchainError} When reading from contract fails
30777
+ * @example
30778
+ * ```typescript
30779
+ * const status = await vana.permissions.checkServerTrustStatus(1);
30780
+ * if (status.isTrusted) {
30781
+ * console.log(`Server is trusted at index ${status.trustIndex}`);
30782
+ * } else {
30783
+ * console.log('Server is not trusted');
30784
+ * }
30785
+ * ```
30363
30786
  */
30364
30787
  checkServerTrustStatus(serverId: number, userAddress?: Address): Promise<ServerTrustStatus>;
30365
30788
  /**
30366
30789
  * Composes EIP-712 typed data for AddAndTrustServer.
30367
30790
  *
30791
+ * @remarks
30792
+ * Creates the complete typed data structure required for EIP-712 signature generation
30793
+ * when adding and trusting a new server in a single transaction.
30794
+ *
30368
30795
  * @param input - The add and trust server input data containing server details
30369
30796
  * @returns Promise resolving to the typed data structure for server add and trust
30370
30797
  */
@@ -30446,7 +30873,7 @@ declare class PermissionsController {
30446
30873
  * console.log(`Grantee registered in transaction: ${txHash}`);
30447
30874
  * ```
30448
30875
  */
30449
- submitRegisterGrantee(params: RegisterGranteeParams): Promise<Hash>;
30876
+ submitRegisterGrantee(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
30450
30877
  /**
30451
30878
  * Registers a grantee with a signature (gasless transaction)
30452
30879
  *
@@ -30462,7 +30889,7 @@ declare class PermissionsController {
30462
30889
  * });
30463
30890
  * ```
30464
30891
  */
30465
- submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<Hash>;
30892
+ submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
30466
30893
  /**
30467
30894
  * Submits a signed register grantee transaction via relayer
30468
30895
  *
@@ -30475,7 +30902,7 @@ declare class PermissionsController {
30475
30902
  * const result = await vana.permissions.submitSignedRegisterGrantee(typedData, signature);
30476
30903
  * ```
30477
30904
  */
30478
- submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<Hash>;
30905
+ submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<TransactionHandle<GranteeRegisterResult>>;
30479
30906
  /**
30480
30907
  * Retrieves all registered grantees from the DataPortabilityGrantees contract.
30481
30908
  *
@@ -30762,7 +31189,7 @@ declare class PermissionsController {
30762
31189
  * @param url - New URL for the server
30763
31190
  * @returns Promise resolving to transaction hash
30764
31191
  */
30765
- submitUpdateServer(serverId: bigint, url: string): Promise<Hash>;
31192
+ submitUpdateServer(serverId: bigint, url: string): Promise<TransactionHandle<ServerUpdateResult>>;
30766
31193
  /**
30767
31194
  * Get all permission IDs for a user
30768
31195
  *
@@ -30802,49 +31229,106 @@ declare class PermissionsController {
30802
31229
  * @throws {BlockchainError} When permission addition fails
30803
31230
  * @throws {NetworkError} When network communication fails
30804
31231
  */
30805
- submitAddPermission(params: ServerFilesAndPermissionParams): Promise<Hash>;
31232
+ submitAddPermission(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
30806
31233
  /**
30807
31234
  * Submits an already-signed add permission transaction to the blockchain.
30808
31235
  * This method supports both relayer-based gasless transactions and direct transactions.
30809
31236
  *
30810
31237
  * @param typedData - The EIP-712 typed data for AddPermission
30811
31238
  * @param signature - The user's signature
30812
- * @returns Promise resolving to the transaction hash
31239
+ * @returns Promise resolving to TransactionHandle with PermissionGrantResult event data
30813
31240
  * @throws {RelayerError} When gasless transaction submission fails
30814
31241
  * @throws {BlockchainError} When permission addition fails
30815
31242
  * @throws {NetworkError} When network communication fails
30816
31243
  */
30817
- submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
31244
+ submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
30818
31245
  /**
30819
- * Submit server files and permissions with signature to the blockchain (supports gasless transactions)
31246
+ * Submits server files and permissions with signature to the blockchain, supporting schema validation and gasless transactions.
31247
+ *
31248
+ * @remarks
31249
+ * This method validates files against their specified schemas before submission.
31250
+ * Schema validation ensures data conforms to expected formats before on-chain registration.
31251
+ * Files with schemaId = 0 bypass validation. The method supports atomic batch operations
31252
+ * where all files and permissions are registered in a single transaction.
30820
31253
  *
30821
31254
  * @param params - Parameters for adding server files and permissions
30822
- * @returns Promise resolving to transaction hash
30823
- * @throws {RelayerError} When gasless transaction submission fails
31255
+ * @param params.granteeId - The ID of the permission grantee
31256
+ * @param params.grant - Grant URL containing permission parameters (typically IPFS)
31257
+ * @param params.fileUrls - Array of file URLs to register
31258
+ * @param params.schemaIds - Schema IDs for each file. Use 0 for files without schema validation.
31259
+ * Array length must match fileUrls length.
31260
+ * @param params.serverAddress - Server wallet address for decryption permissions
31261
+ * @param params.serverUrl - Server endpoint URL
31262
+ * @param params.serverPublicKey - Server's public key for encryption.
31263
+ * Obtain via `vana.server.getIdentity(userAddress).public_key`.
31264
+ * @param params.filePermissions - Nested array of permissions for each file
31265
+ * @returns TransactionHandle with immediate hash access and event parsing capability
31266
+ * @throws {Error} When schemaIds array length doesn't match fileUrls array length
31267
+ * @throws {SchemaValidationError} When file data doesn't match the specified schema.
31268
+ * Verify data structure matches schema definition from `vana.schemas.get(schemaId)`.
31269
+ * @throws {RelayerError} When gasless transaction submission fails.
31270
+ * Retry without relayer configuration to submit direct transaction.
30824
31271
  * @throws {SignatureError} When user rejects the signature request
30825
31272
  * @throws {BlockchainError} When server files and permissions addition fails
30826
- * @throws {NetworkError} When network communication fails
31273
+ * @throws {NetworkError} When network communication fails.
31274
+ * Check network connection or configure alternative gateways.
31275
+ *
31276
+ * @example
31277
+ * ```typescript
31278
+ * const result = await vana.permissions.submitAddServerFilesAndPermissions({
31279
+ * granteeId: BigInt(1),
31280
+ * grant: "ipfs://QmXxx...",
31281
+ * fileUrls: ["https://storage.example.com/data.json"],
31282
+ * schemaIds: [123], // LinkedIn profile schema ID
31283
+ * serverAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
31284
+ * serverUrl: "https://server.example.com",
31285
+ * serverPublicKey: serverInfo.public_key,
31286
+ * filePermissions: [[{
31287
+ * account: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
31288
+ * key: encryptedKey
31289
+ * }]]
31290
+ * });
31291
+ * const events = await result.waitForEvents();
31292
+ * console.log(`Permission ID: ${events.permissionId}`);
31293
+ * ```
30827
31294
  */
30828
- submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<Hash>;
31295
+ submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
30829
31296
  /**
30830
31297
  * Submits an already-signed add server files and permissions transaction to the blockchain.
30831
- * This method supports both relayer-based gasless transactions and direct transactions.
31298
+ *
31299
+ * @remarks
31300
+ * This method returns a TransactionHandle that provides immediate access to the transaction hash
31301
+ * while allowing lazy-loaded access to parsed event data. Use `waitForEvents()` to retrieve
31302
+ * the permission ID and other event details after transaction confirmation.
30832
31303
  *
30833
31304
  * @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
30834
31305
  * @param signature - The user's signature
30835
- * @returns Promise resolving to the transaction hash
31306
+ * @returns TransactionHandle with immediate hash access and optional event parsing
30836
31307
  * @throws {RelayerError} When gasless transaction submission fails
30837
31308
  * @throws {BlockchainError} When server files and permissions addition fails
30838
31309
  * @throws {NetworkError} When network communication fails
31310
+ *
31311
+ * @example
31312
+ * ```typescript
31313
+ * const tx = await vana.permissions.submitSignedAddServerFilesAndPermissions(
31314
+ * typedData,
31315
+ * signature
31316
+ * );
31317
+ * console.log(`Transaction submitted: ${tx.hash}`);
31318
+ *
31319
+ * // Wait for confirmation and get the permission ID
31320
+ * const { permissionId } = await tx.waitForEvents();
31321
+ * console.log(`Permission created with ID: ${permissionId}`);
31322
+ * ```
30839
31323
  */
30840
- submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<Hash>;
31324
+ submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
30841
31325
  /**
30842
31326
  * Submit permission revocation with signature to the blockchain
30843
31327
  *
30844
31328
  * @param permissionId - Permission ID to revoke
30845
31329
  * @returns Promise resolving to transaction hash
30846
31330
  */
30847
- submitRevokePermission(permissionId: bigint): Promise<Hash>;
31331
+ submitRevokePermission(permissionId: bigint): Promise<TransactionHandle<PermissionRevokeResult>>;
30848
31332
  /**
30849
31333
  * Submits a signed add permission transaction directly to the blockchain.
30850
31334
  *
@@ -30874,10 +31358,10 @@ declare class PermissionsController {
30874
31358
  interface CreateSchemaParams {
30875
31359
  /** The name of the schema */
30876
31360
  name: string;
30877
- /** The type/category of the schema */
30878
- type: string;
31361
+ /** The dialect of the schema (e.g., 'json' or 'sqlite') */
31362
+ dialect: "json" | "sqlite";
30879
31363
  /** The schema definition object or JSON string */
30880
- definition: object | string;
31364
+ schema: object | string;
30881
31365
  }
30882
31366
  /**
30883
31367
  * Result of creating a new schema.
@@ -30922,8 +31406,8 @@ interface CreateSchemaResult {
30922
31406
  * // Create a new schema with automatic IPFS upload
30923
31407
  * const result = await vana.schemas.create({
30924
31408
  * name: "User Profile",
30925
- * type: "personal",
30926
- * definition: {
31409
+ * dialect: "json",
31410
+ * schema: {
30927
31411
  * type: "object",
30928
31412
  * properties: {
30929
31413
  * name: { type: "string" },
@@ -30958,7 +31442,7 @@ declare class SchemaController {
30958
31442
  * - Uploads the definition to IPFS to generate a permanent URL
30959
31443
  * - Registers the schema on the blockchain with the generated URL
30960
31444
  *
30961
- * @param params - Schema creation parameters including name, type, and definition
31445
+ * @param params - Schema creation parameters including name, dialect, and definition
30962
31446
  * @returns Promise resolving to creation results with schema ID and transaction hash
30963
31447
  * @throws {SchemaValidationError} When the schema definition is invalid
30964
31448
  * @throws {Error} When IPFS upload or blockchain registration fails
@@ -30967,8 +31451,8 @@ declare class SchemaController {
30967
31451
  * // Create a JSON schema for user profiles
30968
31452
  * const result = await vana.schemas.create({
30969
31453
  * name: "User Profile",
30970
- * type: "personal",
30971
- * definition: {
31454
+ * dialect: "json",
31455
+ * schema: {
30972
31456
  * type: "object",
30973
31457
  * properties: {
30974
31458
  * name: { type: "string" },
@@ -30983,42 +31467,66 @@ declare class SchemaController {
30983
31467
  */
30984
31468
  create(params: CreateSchemaParams): Promise<CreateSchemaResult>;
30985
31469
  /**
30986
- * Retrieves a schema by its ID.
31470
+ * Retrieves a complete schema by its ID with definition fetched and flattened.
30987
31471
  *
30988
31472
  * @param schemaId - The ID of the schema to retrieve
30989
- * @returns Promise resolving to the schema object
30990
- * @throws {Error} When the schema is not found or chain is unavailable
31473
+ * @param options - Optional parameters
31474
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
31475
+ * @returns Promise resolving to the complete schema object with all fields populated
31476
+ * @throws {Error} When the schema is not found, definition cannot be fetched, or chain is unavailable
30991
31477
  * @example
30992
31478
  * ```typescript
30993
31479
  * const schema = await vana.schemas.get(1);
30994
- * console.log(`Schema: ${schema.name} (${schema.type})`);
31480
+ * console.log(`Schema: ${schema.name} (${schema.dialect})`);
31481
+ * console.log(`Version: ${schema.version}`);
31482
+ * console.log(`Description: ${schema.description}`);
31483
+ * console.log('Schema:', schema.schema);
31484
+ *
31485
+ * // Use directly with validator (schema has all required fields)
31486
+ * validator.validateDataAgainstSchema(data, schema);
30995
31487
  * ```
30996
31488
  */
30997
- get(schemaId: number): Promise<Schema>;
31489
+ get(schemaId: number, options?: {
31490
+ subgraphUrl?: string;
31491
+ }): Promise<CompleteSchema>;
30998
31492
  /**
30999
31493
  * Gets the total number of schemas registered on the network.
31000
31494
  *
31495
+ * @param options - Optional parameters
31496
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
31001
31497
  * @returns Promise resolving to the total schema count
31002
31498
  * @throws {Error} When the count cannot be retrieved
31003
31499
  * @example
31004
31500
  * ```typescript
31005
31501
  * const count = await vana.schemas.count();
31006
31502
  * console.log(`Total schemas: ${count}`);
31503
+ *
31504
+ * // With custom subgraph
31505
+ * const count = await vana.schemas.count({
31506
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
31507
+ * });
31007
31508
  * ```
31008
31509
  */
31009
- count(): Promise<number>;
31510
+ count(options?: {
31511
+ subgraphUrl?: string;
31512
+ }): Promise<number>;
31010
31513
  /**
31011
31514
  * Lists all schemas with pagination.
31012
31515
  *
31013
31516
  * @param options - Optional parameters for listing schemas
31014
31517
  * @param options.limit - Maximum number of schemas to return
31015
31518
  * @param options.offset - Number of schemas to skip
31519
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
31520
+ * @param options.includeDefinitions - Whether to fetch and include schema definitions (default: false for performance)
31016
31521
  * @returns Promise resolving to an array of schemas
31017
31522
  * @example
31018
31523
  * ```typescript
31019
- * // Get all schemas
31524
+ * // Get all schemas (without definitions for performance)
31020
31525
  * const schemas = await vana.schemas.list();
31021
31526
  *
31527
+ * // Get schemas with definitions
31528
+ * const schemas = await vana.schemas.list({ includeDefinitions: true });
31529
+ *
31022
31530
  * // Get schemas with pagination
31023
31531
  * const schemas = await vana.schemas.list({ limit: 10, offset: 0 });
31024
31532
  * ```
@@ -31026,6 +31534,8 @@ declare class SchemaController {
31026
31534
  list(options?: {
31027
31535
  limit?: number;
31028
31536
  offset?: number;
31537
+ subgraphUrl?: string;
31538
+ includeDefinitions?: boolean;
31029
31539
  }): Promise<Schema[]>;
31030
31540
  /**
31031
31541
  * Adds a schema using the legacy method (low-level API).
@@ -31035,6 +31545,36 @@ declare class SchemaController {
31035
31545
  * @returns Promise resolving to the add schema result
31036
31546
  */
31037
31547
  addSchema(params: AddSchemaParams): Promise<AddSchemaResult>;
31548
+ /**
31549
+ * Internal method: Query schema via subgraph
31550
+ *
31551
+ * @param params - Query parameters
31552
+ * @param params.schemaId - The ID of the schema to retrieve
31553
+ * @param params.subgraphUrl - The subgraph URL to query
31554
+ * @returns Promise resolving to the schema object
31555
+ * @private
31556
+ */
31557
+ private _getSchemaViaSubgraph;
31558
+ /**
31559
+ * Internal method: List schemas via subgraph
31560
+ *
31561
+ * @param params - Query parameters
31562
+ * @param params.limit - Maximum number of schemas to return
31563
+ * @param params.offset - Number of schemas to skip
31564
+ * @param params.subgraphUrl - The subgraph URL to query
31565
+ * @returns Promise resolving to an array of schemas
31566
+ * @private
31567
+ */
31568
+ private _listSchemasViaSubgraph;
31569
+ /**
31570
+ * Internal method: Count schemas via subgraph
31571
+ *
31572
+ * @param params - Query parameters
31573
+ * @param params.subgraphUrl - The subgraph URL to query
31574
+ * @returns Promise resolving to the total schema count
31575
+ * @private
31576
+ */
31577
+ private _countSchemasViaSubgraph;
31038
31578
  /**
31039
31579
  * Gets the user's wallet address.
31040
31580
  *
@@ -31042,6 +31582,13 @@ declare class SchemaController {
31042
31582
  * @returns Promise resolving to the user's address
31043
31583
  */
31044
31584
  private getUserAddress;
31585
+ /**
31586
+ * Fetches and attaches definitions to an array of schemas.
31587
+ *
31588
+ * @param schemas - Array of schemas to fetch definitions for
31589
+ * @private
31590
+ */
31591
+ private _fetchDefinitionsForSchemas;
31045
31592
  }
31046
31593
 
31047
31594
  /**
@@ -31116,34 +31663,30 @@ declare class SchemaValidator {
31116
31663
  */
31117
31664
  validateDataSchema(schema: unknown): asserts schema is DataSchema;
31118
31665
  /**
31119
- * Validates data against a JSON Schema from a data schema
31666
+ * Validates data against a JSON Schema from a schema
31120
31667
  *
31121
31668
  * @param data - The data to validate
31122
- * @param schema - The data schema containing the schema
31669
+ * @param schema - The schema containing the validation rules (DataSchema or Schema)
31123
31670
  * @throws SchemaValidationError if invalid
31124
31671
  * @example
31125
31672
  * ```typescript
31126
31673
  * const validator = new SchemaValidator();
31127
31674
  *
31128
- * const schema = {
31675
+ * // Works with Schema from schemas.get()
31676
+ * const schema = await vana.schemas.get(1);
31677
+ * validator.validateDataAgainstSchema(userData, schema);
31678
+ *
31679
+ * // Also works with DataSchema object
31680
+ * const dataSchema: DataSchema = {
31129
31681
  * name: "User Profile",
31130
31682
  * version: "1.0.0",
31131
31683
  * dialect: "json",
31132
- * schema: {
31133
- * type: "object",
31134
- * properties: {
31135
- * name: { type: "string" },
31136
- * age: { type: "number" }
31137
- * },
31138
- * required: ["name"]
31139
- * }
31684
+ * schema: { type: "object", properties: { name: { type: "string" } } }
31140
31685
  * };
31141
- *
31142
- * const userData = { name: "Alice", age: 30 };
31143
- * validator.validateDataAgainstSchema(userData, schema);
31686
+ * validator.validateDataAgainstSchema(userData, dataSchema);
31144
31687
  * ```
31145
31688
  */
31146
- validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
31689
+ validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
31147
31690
  /**
31148
31691
  * Validates a SQLite DDL string for basic syntax
31149
31692
  * Note: This is a basic validation, full SQL parsing would require a proper SQL parser
@@ -31187,7 +31730,7 @@ declare function validateDataSchema(schema: unknown): asserts schema is DataSche
31187
31730
  * @returns void - Function doesn't return a value
31188
31731
  * @throws SchemaValidationError if invalid
31189
31732
  */
31190
- declare function validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
31733
+ declare function validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
31191
31734
  /**
31192
31735
  * Convenience function to fetch and validate a schema from a URL
31193
31736
  *
@@ -33683,19 +34226,18 @@ declare class DataController {
33683
34226
  subgraphUrl?: string;
33684
34227
  }): Promise<UserFile$1[]>;
33685
34228
  /**
33686
- * Retrieves a list of permissions granted by a user using the new subgraph entities.
34229
+ * Retrieves a list of permissions granted by a user.
33687
34230
  *
33688
- * This method queries the Vana subgraph to find permissions directly granted by the user
33689
- * using the new Permission entity. It efficiently handles millions of permissions by:
33690
- * 1. Querying the subgraph for user's directly granted permissions
33691
- * 2. Returning complete permission information from subgraph
33692
- * 3. No need for additional contract calls as all data comes from subgraph
34231
+ * This method supports automatic fallback between subgraph and RPC modes:
34232
+ * - If subgraph URL is available, tries subgraph query first
34233
+ * - Falls back to direct contract queries via RPC if subgraph fails
34234
+ * - RPC mode uses gasAwareMulticall for efficient batch queries
33693
34235
  *
33694
34236
  * @param params - Object containing the user address and optional subgraph URL
33695
34237
  * @param params.user - The wallet address of the user to query permissions for
33696
34238
  * @param params.subgraphUrl - Optional subgraph URL to override the default
33697
34239
  * @returns Promise resolving to an array of permission objects
33698
- * @throws Error if subgraph is unavailable or returns invalid data
34240
+ * @throws Error if both subgraph and RPC queries fail
33699
34241
  */
33700
34242
  getUserPermissions(params: {
33701
34243
  user: Address;
@@ -33711,43 +34253,59 @@ declare class DataController {
33711
34253
  user: Address;
33712
34254
  }>>;
33713
34255
  /**
33714
- * Retrieves a list of trusted servers for a user using the new subgraph entities.
34256
+ * Internal method: Query user permissions via subgraph
34257
+ *
34258
+ * @param params - Query parameters object
34259
+ * @param params.user - The user address to query permissions for
34260
+ * @param params.subgraphUrl - The subgraph URL endpoint to query
34261
+ * @returns Promise resolving to an array of permission objects
34262
+ */
34263
+ private _getUserPermissionsViaSubgraph;
34264
+ /**
34265
+ * Internal method: Query user permissions via direct RPC
33715
34266
  *
33716
- * This method queries the Vana subgraph to find trusted servers directly associated with the user
33717
- * with support for both subgraph and direct RPC queries.
34267
+ * @param params - Query parameters object
34268
+ * @param params.user - The user address to query permissions for
34269
+ * @returns Promise resolving to an array of permission objects
34270
+ */
34271
+ private _getUserPermissionsViaRpc;
34272
+ /**
34273
+ * Retrieves a list of trusted servers for a user.
33718
34274
  *
33719
- * This method supports multiple query modes:
33720
- * - 'subgraph': Fast query via subgraph (requires subgraphUrl)
33721
- * - 'rpc': Direct contract queries (slower but no external dependencies)
33722
- * - 'auto': Try subgraph first, fallback to RPC if unavailable
34275
+ * This method supports automatic fallback between subgraph and RPC modes:
34276
+ * - If subgraph URL is available, tries subgraph query first for fast results
34277
+ * - Falls back to direct contract queries via RPC if subgraph fails
34278
+ * - RPC mode uses gasAwareMulticall for efficient batch queries
33723
34279
  *
33724
- * @param params - Query parameters including user address and mode selection
33725
- * @returns Promise resolving to trusted servers with metadata about the query
33726
- * @throws Error if query fails in both modes (when using 'auto')
34280
+ * @param params - Query parameters including user address and optional pagination
34281
+ * @param params.user - The wallet address of the user to query trusted servers for
34282
+ * @param params.subgraphUrl - Optional subgraph URL to override the default
34283
+ * @param params.limit - Maximum number of results to return (default: 50)
34284
+ * @param params.offset - Number of results to skip for pagination (default: 0)
34285
+ * @returns Promise resolving to an array of trusted server objects
34286
+ * @throws Error if both subgraph and RPC queries fail
33727
34287
  * @example
33728
34288
  * ```typescript
33729
- * // Use subgraph for fast queries
33730
- * const result = await vana.data.getUserTrustedServers({
33731
- * user: '0x...',
33732
- * mode: 'subgraph',
33733
- * subgraphUrl: 'https://...'
34289
+ * // Basic usage with automatic fallback
34290
+ * const servers = await vana.data.getUserTrustedServers({
34291
+ * user: '0x...'
33734
34292
  * });
33735
34293
  *
33736
- * // Use direct RPC (no external dependencies)
33737
- * const result = await vana.data.getUserTrustedServers({
34294
+ * // With pagination
34295
+ * const servers = await vana.data.getUserTrustedServers({
33738
34296
  * user: '0x...',
33739
- * mode: 'rpc',
33740
- * limit: 10
34297
+ * limit: 10,
34298
+ * offset: 20
33741
34299
  * });
33742
34300
  *
33743
- * // Auto-fallback mode
33744
- * const result = await vana.data.getUserTrustedServers({
34301
+ * // With custom subgraph URL
34302
+ * const servers = await vana.data.getUserTrustedServers({
33745
34303
  * user: '0x...',
33746
- * mode: 'auto' // tries subgraph first, falls back to RPC
34304
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
33747
34305
  * });
33748
34306
  * ```
33749
34307
  */
33750
- getUserTrustedServers(params: GetUserTrustedServersParams): Promise<GetUserTrustedServersResult>;
34308
+ getUserTrustedServers(params: GetUserTrustedServersParams): Promise<TrustedServer[]>;
33751
34309
  /**
33752
34310
  * Internal method: Query trusted servers via subgraph
33753
34311
  *
@@ -33815,12 +34373,25 @@ declare class DataController {
33815
34373
  /**
33816
34374
  * Registers a file URL directly on the blockchain with a schema ID.
33817
34375
  *
33818
- * @param url - The URL of the file to register
34376
+ * @remarks
34377
+ * This method registers an existing file URL on the DataRegistry contract
34378
+ * with a schema ID, without uploading any data. Useful when you have already
34379
+ * uploaded content to storage and just need to register it on-chain.
34380
+ *
34381
+ * @param url - The URL of the file to register (IPFS or HTTP/HTTPS)
33819
34382
  * @param schemaId - The schema ID to associate with the file
33820
34383
  * @returns Promise resolving to the file ID and transaction hash
33821
- *
33822
- * This method registers an existing file URL on the DataRegistry
33823
- * contract with a schema ID, without uploading any data.
34384
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34385
+ * @throws {Error} When wallet address is unavailable - "No addresses available"
34386
+ * @throws {Error} When transaction fails - "Failed to register file with schema"
34387
+ * @example
34388
+ * ```typescript
34389
+ * const { fileId, transactionHash } = await vana.data.registerFileWithSchema(
34390
+ * "ipfs://QmXxx...",
34391
+ * 1
34392
+ * );
34393
+ * console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
34394
+ * ```
33824
34395
  */
33825
34396
  registerFileWithSchema(url: string, schemaId: number): Promise<{
33826
34397
  fileId: number;
@@ -33880,35 +34451,112 @@ declare class DataController {
33880
34451
  /**
33881
34452
  * Adds a new refiner to the DataRefinerRegistry.
33882
34453
  *
33883
- * @param params - Refiner parameters including DLP ID, name, schema ID, and instruction URL
34454
+ * @remarks
34455
+ * Refiners are data processing templates that define how raw data should be
34456
+ * transformed into structured formats. Each refiner is associated with a DLP
34457
+ * (Data Liquidity Pool), has a specific schema for output, and includes
34458
+ * instructions for the refinement process.
34459
+ *
34460
+ * @param params - Refiner configuration parameters
34461
+ * @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
34462
+ * @param params.name - Human-readable name for the refiner
34463
+ * @param params.schemaId - Schema ID that defines the output format
34464
+ * @param params.refinementInstructionUrl - URL containing processing instructions
33884
34465
  * @returns Promise resolving to the new refiner ID and transaction hash
34466
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34467
+ * @throws {Error} When transaction fails - "Failed to add refiner: {error}"
34468
+ * @example
34469
+ * ```typescript
34470
+ * const result = await vana.data.addRefiner({
34471
+ * dlpId: 1,
34472
+ * name: "Social Media Sentiment Analyzer",
34473
+ * schemaId: 42,
34474
+ * refinementInstructionUrl: "ipfs://QmXxx..."
34475
+ * });
34476
+ * console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
34477
+ * ```
33885
34478
  */
33886
34479
  addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
33887
34480
  /**
33888
34481
  * Retrieves a refiner by its ID.
33889
34482
  *
33890
- * @param refinerId - The refiner ID to retrieve
33891
- * @returns Promise resolving to the refiner information
34483
+ * @remarks
34484
+ * Queries the DataRefinerRegistry contract to get complete information about
34485
+ * a specific refiner including its DLP association, schema, and instructions.
34486
+ *
34487
+ * @param refinerId - The numeric refiner ID to retrieve
34488
+ * @returns Promise resolving to the refiner information object
34489
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34490
+ * @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
34491
+ * @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
34492
+ * @example
34493
+ * ```typescript
34494
+ * const refiner = await vana.data.getRefiner(1);
34495
+ * console.log({
34496
+ * name: refiner.name,
34497
+ * dlp: refiner.dlpId,
34498
+ * schema: refiner.schemaId,
34499
+ * instructions: refiner.refinementInstructionUrl
34500
+ * });
34501
+ * ```
33892
34502
  */
33893
34503
  getRefiner(refinerId: number): Promise<Refiner>;
33894
34504
  /**
33895
34505
  * Validates if a schema ID exists in the registry.
33896
34506
  *
33897
- * @param schemaId - The schema ID to validate
33898
- * @returns Promise resolving to boolean indicating if the schema ID is valid
34507
+ * @remarks
34508
+ * Checks the DataRefinerRegistry contract to determine if a given schema ID
34509
+ * has been registered and is available for use.
34510
+ *
34511
+ * @param schemaId - The numeric schema ID to validate
34512
+ * @returns Promise resolving to true if schema exists, false otherwise
34513
+ * @example
34514
+ * ```typescript
34515
+ * const isValid = await vana.data.isValidSchemaId(42);
34516
+ * if (isValid) {
34517
+ * console.log('Schema 42 is available for use');
34518
+ * } else {
34519
+ * console.log('Schema 42 does not exist');
34520
+ * }
34521
+ * ```
33899
34522
  */
33900
34523
  isValidSchemaId(schemaId: number): Promise<boolean>;
33901
34524
  /**
33902
34525
  * Gets the total number of refiners in the registry.
33903
34526
  *
34527
+ * @remarks
34528
+ * Queries the DataRefinerRegistry contract to get the total count of all
34529
+ * registered refiners across all DLPs.
34530
+ *
33904
34531
  * @returns Promise resolving to the total refiner count
34532
+ * @example
34533
+ * ```typescript
34534
+ * const count = await vana.data.getRefinersCount();
34535
+ * console.log(`Total refiners registered: ${count}`);
34536
+ * ```
33905
34537
  */
33906
34538
  getRefinersCount(): Promise<number>;
33907
34539
  /**
33908
34540
  * Updates the schema ID for an existing refiner.
33909
34541
  *
33910
- * @param params - Parameters including refiner ID and new schema ID
34542
+ * @remarks
34543
+ * Allows the owner of a refiner to update its associated schema ID.
34544
+ * This is useful when refiner output format needs to change.
34545
+ *
34546
+ * @param params - Update parameters
34547
+ * @param params.refinerId - The refiner ID to update
34548
+ * @param params.newSchemaId - The new schema ID to set
33911
34549
  * @returns Promise resolving to the transaction hash
34550
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34551
+ * @throws {Error} When transaction fails - "Failed to update schema ID: {error}"
34552
+ * @example
34553
+ * ```typescript
34554
+ * const result = await vana.data.updateSchemaId({
34555
+ * refinerId: 1,
34556
+ * newSchemaId: 55
34557
+ * });
34558
+ * console.log(`Schema updated in tx ${result.transactionHash}`);
34559
+ * ```
33912
34560
  */
33913
34561
  updateSchemaId(params: UpdateSchemaIdParams): Promise<UpdateSchemaIdResult>;
33914
34562
  /**
@@ -33967,7 +34615,7 @@ declare class DataController {
33967
34615
  * console.log(`Transaction: ${result.transactionHash}`);
33968
34616
  * ```
33969
34617
  */
33970
- addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<FilePermissionResult>;
34618
+ addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
33971
34619
  /**
33972
34620
  * Submits a file permission transaction and returns the transaction hash immediately.
33973
34621
  *
@@ -33984,7 +34632,7 @@ declare class DataController {
33984
34632
  * console.log(`Transaction submitted: ${txHash}`);
33985
34633
  * ```
33986
34634
  */
33987
- submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<Hash>;
34635
+ submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
33988
34636
  /**
33989
34637
  * Gets the encrypted key for a specific account's permission to access a file.
33990
34638
  *
@@ -34151,24 +34799,6 @@ declare class DataController {
34151
34799
  * ```
34152
34800
  */
34153
34801
  fetchAndValidateSchema(url: string): Promise<DataSchema>;
34154
- /**
34155
- * Retrieves a schema by ID and fetches its definition URL to get the full data schema.
34156
- *
34157
- * @param schemaId - The schema ID to retrieve and validate
34158
- * @returns The validated data schema
34159
- * @throws SchemaValidationError if schema is invalid
34160
- * @example
34161
- * ```typescript
34162
- * // Get schema from registry and validate its schema
34163
- * const schema = await vana.data.getValidatedSchema(123);
34164
- *
34165
- * // Use it to validate user data
34166
- * if (schema.dialect === "json") {
34167
- * vana.data.validateDataAgainstSchema(userData, schema);
34168
- * }
34169
- * ```
34170
- */
34171
- getValidatedSchema(schemaId: number): Promise<DataSchema>;
34172
34802
  }
34173
34803
 
34174
34804
  /**
@@ -34371,6 +35001,31 @@ interface Chains {
34371
35001
  }
34372
35002
  declare const chains: Chains;
34373
35003
 
35004
+ /**
35005
+ * Creates or retrieves a cached public client for blockchain read operations.
35006
+ *
35007
+ * @remarks
35008
+ * This function provides an optimized way to access blockchain data by maintaining
35009
+ * a cached client instance per chain. The client is used for reading contract state,
35010
+ * querying events, and other read-only blockchain operations. It automatically
35011
+ * handles HTTP transport configuration and chain switching.
35012
+ *
35013
+ * @param chainId - The chain ID to connect to (defaults to Moksha testnet)
35014
+ * @returns A public client configured for the specified chain with caching optimization
35015
+ * @throws {Error} When the specified chain ID is not supported by the SDK
35016
+ * @example
35017
+ * ```typescript
35018
+ * // Get client for default chain (Moksha testnet)
35019
+ * const client = createClient();
35020
+ *
35021
+ * // Get client for specific chain
35022
+ * const mainnetClient = createClient(14800);
35023
+ *
35024
+ * // Use client for blockchain reads
35025
+ * const blockNumber = await client.getBlockNumber();
35026
+ * ```
35027
+ * @category Blockchain
35028
+ */
34374
35029
  declare const createClient: (chainId?: keyof typeof chains) => PublicClient & {
34375
35030
  chain: Chain;
34376
35031
  };
@@ -35089,51 +35744,157 @@ declare class SerializationError extends VanaError {
35089
35744
  constructor(message: string);
35090
35745
  }
35091
35746
  /**
35092
- * Error thrown when a signature operation fails.
35747
+ * Thrown when a signature operation fails or cannot be completed.
35093
35748
  *
35094
35749
  * @remarks
35095
- * Recovery strategies: Check wallet connection and account unlock status,
35096
- * retry operation with explicit user interaction, or for gasless operations
35097
- * consider switching to direct transactions.
35750
+ * This error occurs when wallet signature operations fail due to disconnection,
35751
+ * locked accounts, or other wallet-related issues. It preserves the original
35752
+ * error for debugging while providing consistent error handling across the SDK.
35753
+ *
35754
+ * Recovery strategies:
35755
+ * - Check wallet connection and account unlock status
35756
+ * - Retry operation with explicit user interaction
35757
+ * - For gasless operations, consider switching to direct transactions
35758
+ *
35759
+ * @example
35760
+ * ```typescript
35761
+ * try {
35762
+ * await vana.permissions.grant({ grantee: '0x...' });
35763
+ * } catch (error) {
35764
+ * if (error instanceof SignatureError) {
35765
+ * // Prompt user to unlock wallet
35766
+ * await promptWalletUnlock();
35767
+ * // Retry operation
35768
+ * }
35769
+ * }
35770
+ * ```
35771
+ * @category Error Handling
35098
35772
  */
35099
35773
  declare class SignatureError extends VanaError {
35100
35774
  readonly originalError?: Error | undefined;
35101
35775
  constructor(message: string, originalError?: Error | undefined);
35102
35776
  }
35103
35777
  /**
35104
- * Error thrown when a network operation fails.
35778
+ * Thrown when network communication fails during API calls or blockchain interactions.
35105
35779
  *
35106
35780
  * @remarks
35107
- * Recovery strategies: Check network connectivity, retry with exponential backoff,
35108
- * verify API endpoints are accessible, or switch to alternative network providers.
35781
+ * This error encompasses network connectivity issues, API unavailability,
35782
+ * timeout errors, and CORS restrictions. It's commonly encountered during
35783
+ * IPFS operations, subgraph queries, or RPC calls.
35784
+ *
35785
+ * Recovery strategies:
35786
+ * - Check network connectivity
35787
+ * - Retry with exponential backoff
35788
+ * - Verify API endpoints are accessible
35789
+ * - Switch to alternative network providers or gateways
35790
+ *
35791
+ * @example
35792
+ * ```typescript
35793
+ * try {
35794
+ * const files = await vana.data.getUserFiles({ owner: '0x...' });
35795
+ * } catch (error) {
35796
+ * if (error instanceof NetworkError) {
35797
+ * // Implement retry with exponential backoff
35798
+ * await retryWithBackoff(() => vana.data.getUserFiles({ owner: '0x...' }));
35799
+ * }
35800
+ * }
35801
+ * ```
35802
+ * @category Error Handling
35109
35803
  */
35110
35804
  declare class NetworkError extends VanaError {
35111
35805
  readonly originalError?: Error | undefined;
35112
35806
  constructor(message: string, originalError?: Error | undefined);
35113
35807
  }
35114
35808
  /**
35115
- * Error thrown when the nonce retrieval fails.
35809
+ * Thrown when transaction nonce retrieval fails during gasless operations.
35116
35810
  *
35117
35811
  * @remarks
35118
- * Recovery strategies: Retry nonce retrieval after brief delay, check wallet connection
35119
- * and account status, or use manual nonce specification if supported by the operation.
35812
+ * This error occurs when the SDK cannot retrieve the user's current nonce from
35813
+ * smart contracts, preventing gasless transaction submission. Nonces are critical
35814
+ * for preventing replay attacks in signed transactions.
35815
+ *
35816
+ * Recovery strategies:
35817
+ * - Retry nonce retrieval after brief delay
35818
+ * - Check wallet connection and account status
35819
+ * - Use manual nonce specification if supported by the operation
35820
+ * - Switch to direct transactions as fallback
35821
+ *
35822
+ * @example
35823
+ * ```typescript
35824
+ * try {
35825
+ * await vana.permissions.grant({ grantee: '0x...' });
35826
+ * } catch (error) {
35827
+ * if (error instanceof NonceError) {
35828
+ * // Wait and retry
35829
+ * await delay(1000);
35830
+ * await vana.permissions.grant({ grantee: '0x...' });
35831
+ * }
35832
+ * }
35833
+ * ```
35834
+ * @category Error Handling
35120
35835
  */
35121
35836
  declare class NonceError extends VanaError {
35122
35837
  constructor(message: string);
35123
35838
  }
35124
35839
  /**
35125
- * Error thrown when a personal server operation fails.
35840
+ * Thrown when personal server operations fail or cannot be completed.
35126
35841
  *
35127
35842
  * @remarks
35128
- * Recovery strategies: Verify server URL accessibility, check server trust status via
35129
- * `vana.permissions.getUserTrustedServers()`, or retry after server becomes available.
35843
+ * This error occurs during interactions with personal servers for computation
35844
+ * requests, identity retrieval, or operation status checks. Common causes include
35845
+ * server unavailability, untrusted server status, or invalid permission grants.
35846
+ *
35847
+ * Recovery strategies:
35848
+ * - Verify server URL accessibility
35849
+ * - Check server trust status via `vana.permissions.getTrustedServers()`
35850
+ * - Ensure valid permissions exist for the operation
35851
+ * - Retry after server becomes available
35852
+ *
35853
+ * @example
35854
+ * ```typescript
35855
+ * try {
35856
+ * const result = await vana.server.createOperation({ permissionId: 123 });
35857
+ * } catch (error) {
35858
+ * if (error instanceof PersonalServerError) {
35859
+ * // Check if server is trusted
35860
+ * const trustedServers = await vana.permissions.getTrustedServers();
35861
+ * if (!trustedServers.includes(serverId)) {
35862
+ * await vana.permissions.trustServer({ serverId });
35863
+ * }
35864
+ * }
35865
+ * }
35866
+ * ```
35867
+ * @category Error Handling
35130
35868
  */
35131
35869
  declare class PersonalServerError extends VanaError {
35132
35870
  readonly originalError?: Error | undefined;
35133
35871
  constructor(message: string, originalError?: Error | undefined);
35134
35872
  }
35135
35873
  /**
35136
- * Error thrown when trying to register a server with a URL that doesn't match the existing registration.
35874
+ * Thrown when attempting to register a server with a URL different from its existing registration.
35875
+ *
35876
+ * @remarks
35877
+ * This error occurs when trying to add or trust a server that's already registered
35878
+ * on-chain with a different URL. Server URLs are immutable once registered to
35879
+ * maintain consistency and security. Applications should use the existing URL
35880
+ * or register a new server with a different ID.
35881
+ *
35882
+ * @example
35883
+ * ```typescript
35884
+ * try {
35885
+ * await vana.permissions.addAndTrustServer({
35886
+ * serverId: 1,
35887
+ * serverUrl: 'https://new-url.com',
35888
+ * publicKey: '0x...'
35889
+ * });
35890
+ * } catch (error) {
35891
+ * if (error instanceof ServerUrlMismatchError) {
35892
+ * console.log(`Server already registered with: ${error.existingUrl}`);
35893
+ * // Use existing URL or register new server
35894
+ * }
35895
+ * }
35896
+ * ```
35897
+ * @category Error Handling
35137
35898
  */
35138
35899
  declare class ServerUrlMismatchError extends VanaError {
35139
35900
  constructor(existingUrl: string, providedUrl: string, serverId: string);
@@ -35142,7 +35903,25 @@ declare class ServerUrlMismatchError extends VanaError {
35142
35903
  readonly serverId: string;
35143
35904
  }
35144
35905
  /**
35145
- * Error thrown when a permission operation fails.
35906
+ * Thrown when permission grant, revoke, or validation operations fail.
35907
+ *
35908
+ * @remarks
35909
+ * This error occurs during permission management operations including grants,
35910
+ * revocations, and permission validation checks. Common causes include invalid
35911
+ * grantee addresses, expired permissions, or insufficient privileges.
35912
+ *
35913
+ * @example
35914
+ * ```typescript
35915
+ * try {
35916
+ * await vana.permissions.revoke({ permissionId: 999999 });
35917
+ * } catch (error) {
35918
+ * if (error instanceof PermissionError) {
35919
+ * console.error('Permission operation failed:', error.message);
35920
+ * // Permission may not exist or user may not be owner
35921
+ * }
35922
+ * }
35923
+ * ```
35924
+ * @category Error Handling
35146
35925
  */
35147
35926
  declare class PermissionError extends VanaError {
35148
35927
  readonly originalError?: Error | undefined;
@@ -36108,12 +36887,12 @@ declare class SignatureCache {
36108
36887
  * Generate a deterministic hash of a message object for cache key generation
36109
36888
  *
36110
36889
  * @remarks
36111
- * Creates a consistent hash from complex objects including EIP-712 typed data.
36112
- * Handles BigInt serialization and produces a 32-character hash that balances
36113
- * uniqueness with key length constraints.
36890
+ * Creates a cryptographically secure hash from complex objects including EIP-712 typed data.
36891
+ * Uses SHA-256 for collision resistance and deterministic key generation.
36892
+ * Handles BigInt serialization and sorts object keys for consistency.
36114
36893
  *
36115
36894
  * @param message - The message object to hash (typically EIP-712 typed data)
36116
- * @returns A 32-character hash string suitable for cache keys
36895
+ * @returns A hex string hash (SHA-256) suitable for cache keys
36117
36896
  * @example
36118
36897
  * ```typescript
36119
36898
  * const typedData = {
@@ -36122,19 +36901,19 @@ declare class SignatureCache {
36122
36901
  * };
36123
36902
  *
36124
36903
  * const hash = SignatureCache.hashMessage(typedData);
36125
- * // Returns something like: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
36904
+ * // Returns SHA-256 hash like: "a1b2c3d4e5f6..."
36126
36905
  * ```
36127
36906
  */
36128
36907
  static hashMessage(message: object): string;
36129
36908
  /**
36130
- * Custom JSON replacer that converts BigInt values to strings for serialization
36131
- * This ensures deterministic cache key generation for EIP-712 typed data
36909
+ * Deterministic JSON replacer that handles BigInt values and sorts object keys
36910
+ * This ensures consistent cache key generation for EIP-712 typed data
36132
36911
  *
36133
36912
  * @param _key - The object key being serialized (unused)
36134
36913
  * @param value - The value to serialize
36135
- * @returns The serialized value
36914
+ * @returns The serialized value with sorted keys for objects
36136
36915
  */
36137
- private static bigIntReplacer;
36916
+ private static deterministicReplacer;
36138
36917
  }
36139
36918
  /**
36140
36919
  * Wrapper function to cache signature operations
@@ -36150,21 +36929,53 @@ declare function withSignatureCache(cache: VanaCacheAdapter, walletAddress: stri
36150
36929
 
36151
36930
  declare const CONTRACT_ADDRESSES: Record<number, Record<string, string>>;
36152
36931
  /**
36153
- * Retrieves the deployed contract address for a specific contract on a given chain.
36932
+ * Retrieves the deployed contract address for a specific Vana protocol contract on a given chain.
36154
36933
  *
36155
- * @param chainId - The chain ID to look up the contract on
36156
- * @param contract - The contract name to get the address for
36157
- * @returns The contract address as a hex string
36158
- * @throws {Error} When contract address not found for the specified contract and chain
36934
+ * @remarks
36935
+ * This function provides type-safe access to contract addresses across all supported Vana networks.
36936
+ * It automatically searches both current and legacy contract registries to ensure backwards
36937
+ * compatibility while providing clear error messages for unsupported combinations.
36938
+ *
36939
+ * The function validates that both the chain ID and contract name are supported before
36940
+ * attempting address lookup, helping developers identify deployment or configuration issues
36941
+ * early in the development process.
36942
+ *
36943
+ * **Supported Chains:**
36944
+ * - 14800: Vana Mainnet
36945
+ * - 1480: Moksha Testnet
36946
+ *
36947
+ * **Contract Categories:**
36948
+ * - Data Management: DataRegistry, DataRefinerRegistry
36949
+ * - Permissions: DataPortabilityPermissions, DataPortabilityServers, DataPortabilityGrantees
36950
+ * - Computing: TeePoolPhala, TeePoolDedicatedGpu, etc.
36951
+ * - Token & Governance: DATImplementation, VanaPoolStaking, etc.
36952
+ *
36953
+ * @param chainId - The chain ID to look up the contract on (14800 for mainnet, 1480 for testnet)
36954
+ * @param contract - The contract name to get the address for (use TypeScript autocomplete for available options)
36955
+ * @returns The contract address as a checksummed hex string (0x...)
36956
+ * @throws {Error} When contract address not found for the specified contract and chain combination.
36957
+ * This typically indicates the contract is not deployed on the requested network.
36159
36958
  * @example
36160
36959
  * ```typescript
36960
+ * // Get core protocol contract addresses
36961
+ * const dataRegistry = getContractAddress(14800, 'DataRegistry');
36962
+ * const permissions = getContractAddress(14800, 'DataPortabilityPermissions');
36963
+ * const trustedServers = getContractAddress(14800, 'DataPortabilityServers');
36964
+ *
36965
+ * // Handle unsupported combinations gracefully
36161
36966
  * try {
36162
- * const dataRegistryAddress = getContractAddress(1480, 'DataRegistry');
36163
- * console.log('DataRegistry address:', dataRegistryAddress);
36967
+ * const address = getContractAddress(1480, 'DataRegistry');
36968
+ * console.log('DataRegistry testnet address:', address);
36164
36969
  * } catch (error) {
36165
- * console.error('Contract not deployed on this chain:', error.message);
36970
+ * console.error('Contract not available on testnet:', error.message);
36971
+ * // Fallback to mainnet or show user-friendly error
36166
36972
  * }
36973
+ *
36974
+ * // TypeScript provides autocomplete for contract names
36975
+ * const poolAddress = getContractAddress(14800, 'TeePoolPhala'); // ✅ Valid
36976
+ * // const invalid = getContractAddress(14800, 'InvalidContract'); // ❌ TypeScript error
36167
36977
  * ```
36978
+ * @category Configuration
36168
36979
  */
36169
36980
  declare const getContractAddress: (chainId: keyof typeof CONTRACT_ADDRESSES, contract: VanaContract) => `0x${string}`;
36170
36981
 
@@ -36335,22 +37146,316 @@ declare class CircuitBreaker {
36335
37146
  }
36336
37147
 
36337
37148
  /**
36338
- * Browser implementation of the Vana Platform Adapter
37149
+ * Browser implementation of the Vana Platform Adapter using Uint8Array
36339
37150
  *
36340
- * This implementation uses browser-compatible libraries and configurations
36341
- * to provide crypto, PGP, and HTTP functionality without Node.js dependencies.
37151
+ * This implementation uses browser-compatible libraries and native APIs
37152
+ * without requiring Buffer or other Node.js polyfills.
36342
37153
  */
36343
37154
 
36344
37155
  /**
36345
- * Complete browser platform adapter implementation
37156
+ * Browser implementation of crypto operations using Uint8Array
37157
+ */
37158
+ declare class BrowserCryptoAdapter implements VanaCryptoAdapter {
37159
+ private eciesProvider;
37160
+ private walletKeyEncryptionService;
37161
+ encryptWithPublicKey(data: string, publicKeyHex: string): Promise<string>;
37162
+ decryptWithPrivateKey(encryptedData: string, privateKeyHex: string): Promise<string>;
37163
+ encryptWithWalletPublicKey(data: string, publicKey: string): Promise<string>;
37164
+ decryptWithWalletPrivateKey(encryptedData: string, privateKey: string): Promise<string>;
37165
+ generateKeyPair(): Promise<{
37166
+ privateKey: string;
37167
+ publicKey: string;
37168
+ }>;
37169
+ encryptWithPassword(data: Uint8Array, password: string): Promise<Uint8Array>;
37170
+ decryptWithPassword(encryptedData: Uint8Array, password: string): Promise<Uint8Array>;
37171
+ }
37172
+ /**
37173
+ * Browser implementation of PGP operations
37174
+ */
37175
+ declare class BrowserPGPAdapter implements VanaPGPAdapter {
37176
+ encrypt(data: string, publicKeyArmored: string): Promise<string>;
37177
+ decrypt(encryptedData: string, privateKeyArmored: string): Promise<string>;
37178
+ generateKeyPair(options?: {
37179
+ name?: string;
37180
+ email?: string;
37181
+ passphrase?: string;
37182
+ }): Promise<{
37183
+ publicKey: string;
37184
+ privateKey: string;
37185
+ }>;
37186
+ }
37187
+ /**
37188
+ * Browser implementation of HTTP operations using Fetch API
37189
+ */
37190
+ declare class BrowserHttpAdapter implements VanaHttpAdapter {
37191
+ fetch(url: string, options?: RequestInit): Promise<Response>;
37192
+ }
37193
+ /**
37194
+ * Browser implementation of caching using sessionStorage for security
37195
+ * SessionStorage is cleared when the tab closes, making it more secure for signature caching
37196
+ */
37197
+ declare class BrowserCacheAdapter implements VanaCacheAdapter {
37198
+ private readonly prefix;
37199
+ get(key: string): string | null;
37200
+ set(key: string, value: string): void;
37201
+ delete(key: string): void;
37202
+ clear(): void;
37203
+ }
37204
+ /**
37205
+ * Browser implementation of the Vana Platform Adapter
37206
+ *
37207
+ * This adapter provides all platform-specific functionality for browser environments
37208
+ * without requiring any Node.js polyfills.
36346
37209
  */
36347
37210
  declare class BrowserPlatformAdapter implements VanaPlatformAdapter {
36348
- crypto: VanaCryptoAdapter;
36349
- pgp: VanaPGPAdapter;
36350
- http: VanaHttpAdapter;
36351
- cache: VanaCacheAdapter;
36352
- platform: "browser";
36353
- constructor();
37211
+ readonly crypto: BrowserCryptoAdapter;
37212
+ readonly pgp: BrowserPGPAdapter;
37213
+ readonly http: BrowserHttpAdapter;
37214
+ readonly cache: BrowserCacheAdapter;
37215
+ readonly platform: "browser";
37216
+ }
37217
+
37218
+ /**
37219
+ * ECIES (Elliptic Curve Integrated Encryption Scheme) Interface
37220
+ *
37221
+ * @remarks
37222
+ * Defines the contract for platform-specific ECIES implementations.
37223
+ * All implementations maintain compatibility with the eccrypto format to ensure
37224
+ * backward compatibility with existing encrypted data.
37225
+ *
37226
+ * **Format specification:**
37227
+ * `[iv (16 bytes)][ephemPublicKey (65 bytes)][ciphertext (variable)][mac (32 bytes)]`
37228
+ *
37229
+ * @category Cryptography
37230
+ */
37231
+ /**
37232
+ * Represents ECIES encrypted data in eccrypto-compatible format.
37233
+ *
37234
+ * @remarks
37235
+ * This structure maintains backward compatibility with data encrypted using
37236
+ * the legacy eccrypto library.
37237
+ */
37238
+ interface ECIESEncrypted {
37239
+ /** Initialization vector (16 bytes) */
37240
+ iv: Uint8Array;
37241
+ /** Ephemeral public key (65 bytes uncompressed) */
37242
+ ephemPublicKey: Uint8Array;
37243
+ /** Encrypted data */
37244
+ ciphertext: Uint8Array;
37245
+ /** Message authentication code (32 bytes) */
37246
+ mac: Uint8Array;
37247
+ }
37248
+ /**
37249
+ * Provides ECIES encryption and decryption operations.
37250
+ *
37251
+ * @remarks
37252
+ * Platform-specific implementations handle the underlying cryptographic primitives
37253
+ * while maintaining consistent data format across environments.
37254
+ *
37255
+ * @category Cryptography
37256
+ */
37257
+ interface ECIESProvider {
37258
+ /**
37259
+ * Encrypts data using ECIES with secp256k1.
37260
+ *
37261
+ * @param publicKey - Recipient's public key (65 bytes uncompressed or 33 bytes compressed).
37262
+ * Obtain via `vana.server.getIdentity(userAddress).public_key`.
37263
+ * @param message - Data to encrypt.
37264
+ * @returns Encrypted data structure compatible with eccrypto format.
37265
+ * @throws {ECIESError} When public key is invalid.
37266
+ * Verify key format matches secp256k1 requirements.
37267
+ *
37268
+ * @example
37269
+ * ```typescript
37270
+ * const encrypted = await provider.encrypt(
37271
+ * hexToBytes(publicKey),
37272
+ * new TextEncoder().encode('sensitive data')
37273
+ * );
37274
+ * ```
37275
+ */
37276
+ encrypt(publicKey: Uint8Array, message: Uint8Array): Promise<ECIESEncrypted>;
37277
+ /**
37278
+ * Decrypts ECIES encrypted data.
37279
+ *
37280
+ * @param privateKey - Recipient's private key (32 bytes).
37281
+ * @param encrypted - Encrypted data structure from `encrypt()` or legacy eccrypto.
37282
+ * @returns Decrypted message as Uint8Array.
37283
+ * @throws {ECIESError} When MAC verification fails.
37284
+ * Ensure the private key matches the public key used for encryption.
37285
+ *
37286
+ * @example
37287
+ * ```typescript
37288
+ * const decrypted = await provider.decrypt(
37289
+ * hexToBytes(privateKey),
37290
+ * encrypted
37291
+ * );
37292
+ * const message = new TextDecoder().decode(decrypted);
37293
+ * ```
37294
+ */
37295
+ decrypt(privateKey: Uint8Array, encrypted: ECIESEncrypted): Promise<Uint8Array>;
37296
+ }
37297
+
37298
+ /**
37299
+ * Provides shared ECIES encryption logic across platforms using Uint8Array.
37300
+ *
37301
+ * @remarks
37302
+ * Platform implementations extend this class and provide crypto primitives.
37303
+ * The base class handles the ECIES protocol flow while maintaining
37304
+ * compatibility with the eccrypto data format.
37305
+ *
37306
+ * **Implementation details:**
37307
+ * - KDF: SHA-512(shared_secret) → encKey (32B) || macKey (32B)
37308
+ * - Cipher: AES-256-CBC with random 16-byte IV
37309
+ * - MAC: HMAC-SHA256(macKey, iv || ephemPublicKey || ciphertext)
37310
+ *
37311
+ * @category Cryptography
37312
+ */
37313
+ declare abstract class BaseECIESUint8 implements ECIESProvider {
37314
+ private static readonly validatedKeys;
37315
+ /**
37316
+ * Generates cryptographically secure random bytes.
37317
+ *
37318
+ * @param length - Number of random bytes to generate.
37319
+ * @returns Random bytes array.
37320
+ */
37321
+ protected abstract generateRandomBytes(length: number): Uint8Array;
37322
+ /**
37323
+ * Verifies a private key is valid for secp256k1.
37324
+ *
37325
+ * @param privateKey - Private key to verify (32 bytes).
37326
+ * @returns `true` if valid private key.
37327
+ */
37328
+ protected abstract verifyPrivateKey(privateKey: Uint8Array): boolean;
37329
+ /**
37330
+ * Creates a public key from a private key.
37331
+ *
37332
+ * @param privateKey - Source private key (32 bytes).
37333
+ * @param compressed - Generate compressed (33B) or uncompressed (65B) format.
37334
+ * @returns Public key or `null` if creation failed.
37335
+ */
37336
+ protected abstract createPublicKey(privateKey: Uint8Array, compressed: boolean): Uint8Array | null;
37337
+ /**
37338
+ * Validates a public key on the secp256k1 curve.
37339
+ *
37340
+ * @param publicKey - Public key to validate.
37341
+ * @returns `true` if valid public key.
37342
+ */
37343
+ protected abstract validatePublicKey(publicKey: Uint8Array): boolean;
37344
+ /**
37345
+ * Decompresses a compressed public key.
37346
+ *
37347
+ * @param publicKey - Compressed public key (33 bytes).
37348
+ * @returns Uncompressed public key (65 bytes) or `null` if decompression failed.
37349
+ */
37350
+ protected abstract decompressPublicKey(publicKey: Uint8Array): Uint8Array | null;
37351
+ /**
37352
+ * Performs ECDH key agreement.
37353
+ *
37354
+ * @param publicKey - Other party's public key.
37355
+ * @param privateKey - Your private key.
37356
+ * @returns Raw X coordinate of shared point (32 bytes).
37357
+ */
37358
+ protected abstract performECDH(publicKey: Uint8Array, privateKey: Uint8Array): Uint8Array;
37359
+ /**
37360
+ * Computes SHA-512 hash.
37361
+ *
37362
+ * @param data - Data to hash.
37363
+ * @returns SHA-512 hash (64 bytes).
37364
+ */
37365
+ protected abstract sha512(data: Uint8Array): Uint8Array;
37366
+ /**
37367
+ * Computes HMAC-SHA256 authentication tag.
37368
+ *
37369
+ * @param key - HMAC key.
37370
+ * @param data - Data to authenticate.
37371
+ * @returns HMAC-SHA256 (32 bytes).
37372
+ */
37373
+ protected abstract hmacSha256(key: Uint8Array, data: Uint8Array): Uint8Array;
37374
+ /**
37375
+ * Encrypts data using AES-256-CBC.
37376
+ *
37377
+ * @param key - Encryption key (32 bytes).
37378
+ * @param iv - Initialization vector (16 bytes).
37379
+ * @param plaintext - Data to encrypt.
37380
+ * @returns Ciphertext with PKCS#7 padding.
37381
+ */
37382
+ protected abstract aesEncrypt(key: Uint8Array, iv: Uint8Array, plaintext: Uint8Array): Promise<Uint8Array>;
37383
+ /**
37384
+ * Decrypts data using AES-256-CBC.
37385
+ *
37386
+ * @param key - Decryption key (32 bytes).
37387
+ * @param iv - Initialization vector (16 bytes).
37388
+ * @param ciphertext - Data to decrypt.
37389
+ * @returns Plaintext with padding removed.
37390
+ */
37391
+ protected abstract aesDecrypt(key: Uint8Array, iv: Uint8Array, ciphertext: Uint8Array): Promise<Uint8Array>;
37392
+ /**
37393
+ * Normalizes a public key to uncompressed format.
37394
+ *
37395
+ * @param publicKey - Public key in any format.
37396
+ * @returns Uncompressed public key (65 bytes).
37397
+ * @throws {ECIESError} If key format is invalid.
37398
+ */
37399
+ protected normalizePublicKey(publicKey: Uint8Array): Uint8Array;
37400
+ /**
37401
+ * Encrypts data using ECIES.
37402
+ *
37403
+ * @param publicKey - The recipient's public key (compressed or uncompressed)
37404
+ * @param message - The data to encrypt
37405
+ * @returns Promise resolving to encrypted data structure
37406
+ */
37407
+ encrypt(publicKey: Uint8Array, message: Uint8Array): Promise<ECIESEncrypted>;
37408
+ /**
37409
+ * Decrypts ECIES encrypted data.
37410
+ *
37411
+ * @param privateKey - The recipient's private key (32 bytes)
37412
+ * @param encrypted - The encrypted data structure from encrypt()
37413
+ * @returns Promise resolving to the original plaintext
37414
+ */
37415
+ decrypt(privateKey: Uint8Array, encrypted: ECIESEncrypted): Promise<Uint8Array>;
37416
+ /**
37417
+ * Clears sensitive data from memory using multi-pass overwrite.
37418
+ *
37419
+ * @remarks
37420
+ * Uses multiple passes with different patterns to make it harder
37421
+ * for JIT compilers to optimize away the operation. While not
37422
+ * guaranteed in JavaScript, this is a best-effort approach to
37423
+ * clear sensitive data from memory.
37424
+ *
37425
+ * @param buffer - The buffer to clear
37426
+ */
37427
+ protected clearBuffer(buffer: Uint8Array): void;
37428
+ }
37429
+
37430
+ /**
37431
+ * Browser implementation of ECIES using @noble/secp256k1 with Uint8Array
37432
+ *
37433
+ * @remarks
37434
+ * Uses native browser crypto APIs and @noble/secp256k1 for elliptic curve operations.
37435
+ * This implementation is polyfill-free and works in all modern browsers.
37436
+ */
37437
+
37438
+ /**
37439
+ * Browser-specific ECIES provider using @noble/secp256k1
37440
+ *
37441
+ * @remarks
37442
+ * This implementation uses:
37443
+ * - Web Crypto API for AES operations
37444
+ * - @noble/secp256k1 for elliptic curve operations
37445
+ * - @noble/hashes for SHA and HMAC operations
37446
+ * - No Buffer or Node.js dependencies
37447
+ */
37448
+ declare class BrowserECIESUint8Provider extends BaseECIESUint8 {
37449
+ protected generateRandomBytes(length: number): Uint8Array;
37450
+ protected verifyPrivateKey(privateKey: Uint8Array): boolean;
37451
+ protected createPublicKey(privateKey: Uint8Array, compressed: boolean): Uint8Array | null;
37452
+ protected validatePublicKey(publicKey: Uint8Array): boolean;
37453
+ protected decompressPublicKey(publicKey: Uint8Array): Uint8Array | null;
37454
+ protected performECDH(publicKey: Uint8Array, privateKey: Uint8Array): Uint8Array;
37455
+ protected sha512(data: Uint8Array): Uint8Array;
37456
+ protected hmacSha256(key: Uint8Array, data: Uint8Array): Uint8Array;
37457
+ protected aesEncrypt(key: Uint8Array, iv: Uint8Array, plaintext: Uint8Array): Promise<Uint8Array>;
37458
+ protected aesDecrypt(key: Uint8Array, iv: Uint8Array, ciphertext: Uint8Array): Promise<Uint8Array>;
36354
37459
  }
36355
37460
 
36356
37461
  /**
@@ -36678,4 +37783,4 @@ declare function Vana(config: VanaConfig): VanaBrowserImpl;
36678
37783
  */
36679
37784
  type VanaInstance = VanaBrowserImpl;
36680
37785
 
36681
- export { type $defs, type APIResponse, type AddAndTrustServerInput, type AddAndTrustServerParams, type AddAndTrustServerTypedData, type AddRefinerParams, type AddRefinerResult, type AddSchemaParams, type AddSchemaResult, type AllKeys, ApiClient, type ApiClientConfig, type ApiResponse, AsyncQueue, type AsyncResult, type AuthenticationErrorResponse, type Awaited, type BaseConfig, type BaseConfigWithStorage, BaseController, type BatchServerInfoResult, type BatchUploadParams, type BatchUploadResult, type BlockRange, BlockchainError, type BlockchainErrorResponse, type Brand, BrowserPlatformAdapter, type Cache, type CacheConfig, CallbackStorage, type ChainConfig, type ChainConfigWithStorage, type CheckPermissionParams, CircuitBreaker, type ComputeErrorResponse, type ConditionalOptional, type ConfigValidationOptions, type ConfigValidationResult, type ContractAddresses, type ContractCall, type ContractDeployment, ContractFactory, type ContractInfo, type ContractMethodParams, type ContractMethodReturnType, ContractNotFoundError, type Controller, type ControllerContext, type CreateOperationParams, type CreateOperationRequest, type CreateOperationResponse, type CreateSchemaParams, type CreateSchemaResult, DEFAULT_ENCRYPTION_SEED, DEFAULT_IPFS_GATEWAY, DataController, type DataSchema, type DecryptionErrorResponse, type DeepPartial, type DeepReadonly, type DeleteFileParams, type DeleteFileResult, type DownloadFileParams, type DownloadFileResult, type EncryptedUploadParams, type EncryptionInfo, type ErrorResponse, EventEmitter, type EventFilter, type EventLog, type Factory, type FileAccessErrorResponse, type FileAccessPermissions, type FileMetadata, type FilePermissionParams, type FileSharingConfig, type GasEstimate, type GenericRequest, type GenericResponse, type GenericTypedData, type GetFileParams, type GetOperationResponse, type GetUserFilesParams, type GetUserPermissionsOptions, type GetUserTrustedServersParams, type GetUserTrustedServersResult, GoogleDriveStorage, GrantExpiredError, type GrantFile, type GrantPermissionParams, GrantSchemaError, GrantValidationError, type GrantValidationErrorResponse, type GrantValidationOptions, type GrantValidationResult, type GrantedPermission, type Grantee, type GranteeInfo, GranteeMismatchError, type GranteeQueryOptions, type HttpMethod, IPFS_GATEWAYS, type IdentityResponseModel, type InitPersonalServerParams, type InternalServerErrorResponse, InvalidConfigurationError, IpfsStorage, type LegacyPermissionParams, type MaybeArray, type MaybePromise, MemoryCache, type Middleware, MiddlewarePipeline, NetworkError, type NetworkInfo, type Nominal, type NonNullable, NonceError, type NotFoundErrorResponse, type Observable, type Observer, type OmitByType, type OnChainPermissionGrant, type OperationErrorResponse, OperationNotAllowedError, type OptionalKeys, type PaginatedGrantees, type PaginatedTrustedServers, type PaginationParams, type PaginationResult, type PartialExcept, type Permission, type PermissionAnalytics, type PermissionCheckResult, PermissionError, type PermissionEvent, type PermissionGrantDomain, type PermissionGrantMessage, type PermissionGrantTypedData, type PermissionInfo, type PermissionInputMessage, type PermissionOperation, type PermissionQueryResult, type PermissionStatus, PermissionsController, PersonalServerError, type PersonalServerIdentity, type PersonalServerModel, type PickByType, type PinataListResponse, type PinataPin, PinataStorage, type PinataUploadResponse, type Plugin, type PostRequestParams, type PromiseResult, ProtocolController, type QueryPermissionsParams, type RateLimitInfo, RateLimiter, type RateLimiterConfig, type Refiner, type RegisterGranteeInput, type RegisterGranteeParams, type RegisterGranteeTypedData, type RelayerCallbacks, type RelayerConfig, RelayerError, type RelayerErrorResponse, type RelayerMetrics, type RelayerQueueInfo, type RelayerRequestOptions, type RelayerStatus, type RelayerStorageResponse, type RelayerStoreParams, type RelayerSubmitParams, type RelayerTransactionResponse, type RelayerTransactionStatus, type RelayerWebhookConfig, type RelayerWebhookPayload, type ReplicateAPIResponse, type ReplicateStatus, type Repository, type RequestOptions, type RequireKeys, type RequiredExcept, type RetryConfig, RetryUtility, type RevokePermissionInput, type RevokePermissionParams, type RuntimeConfig, type Schema, SchemaValidationError, SchemaValidator, SerializationError, type Server, type components as ServerComponents, ServerController, type $defs as ServerDefs, type ServerFilesAndPermissionParams, type ServerFilesAndPermissionTypedData, type ServerInfo, type operations as ServerOperations, type paths as ServerPaths, type ServerTrustStatus, ServerUrlMismatchError, type webhooks as ServerWebhooks, type Service, SignatureCache, SignatureError, type SimplifiedPermissionMessage, type StateMachine, type StatusInfo, type StorageCallbacks, type StorageConfig, type StorageDownloadOptions, StorageError, type StorageFile, type StorageListOptions, type StorageListResult, StorageManager, type StorageProvider, type StorageProviderConfig, type StorageRequiredMarker, type StorageUploadResult, type TimeRange, type TransactionOptions, type TransactionReceipt, type Transformer, type TrustServerInput, type TrustServerParams, type TrustServerTypedData, type TrustedServer, type TrustedServerInfo, type TrustedServerQueryMode, type TrustedServerQueryOptions, type UnencryptedUploadParams, type UntrustServerInput, type UntrustServerParams, type UntrustServerTypedData, type UpdateSchemaIdParams, type UpdateSchemaIdResult, type UploadEncryptedFileResult, type UploadFileParams, type UploadFileResult, type UploadParams, type UploadProgress, type UploadResult, type UserFile, UserRejectedRequestError, type ValidationErrorResponse, type ValidationResult, type Validator, Vana, VanaBrowserImpl, type VanaChain, type VanaChainConfig, type VanaChainId, type VanaConfig, type VanaConfigWithStorage, type VanaContract, type VanaContract as VanaContractAbi, type VanaContractInstance, type VanaContractName, VanaCore, VanaCoreFactory, VanaError, type VanaInstance, type VanaPlatformAdapter, type WalletConfig, type WalletConfigWithStorage, __contractCache, chains, checkGrantAccess, clearContractCache, type components, convertIpfsUrl, convertIpfsUrlWithFallbacks, createAndStoreGrant, createBrowserPlatformAdapter, createGrantFile, createPlatformAdapterSafe, createValidatedGrant, decryptBlobWithSignedKey, decryptWithPrivateKey, decryptWithWalletPrivateKey, Vana as default, detectPlatform, encryptBlobWithSignedKey, encryptFileKey, encryptWithWalletPublicKey, extractIpfsHash, fetchAndValidateSchema, fetchWithFallbacks, formatEth, formatNumber, formatToken, generateEncryptionKey, generateEncryptionKeyPair, generatePGPKeyPair, getAbi, getAllChains, getChainConfig, getContractAddress, getContractController, getContractInfo, getEncryptionParameters, getGatewayUrls, getGrantFileHash, getGrantTimeRemaining, getPlatformCapabilities, hasStorageConfig, isAPIResponse, isChainConfig, isGrantExpired, isIpfsUrl, isPlatformSupported, isReplicateAPIResponse, isVanaChain, isVanaChainId, isWalletConfig, moksha, mokshaTestnet, type operations, parseReplicateOutput, type paths, retrieveAndValidateGrant, retrieveGrantFile, safeParseJSON, schemaValidator, shortenAddress, storeGrantFile, summarizeGrant, validateDataAgainstSchema, validateDataSchema, validateGrant, validateGrantExpiry, validateGrantFile, validateGranteeAccess, validateOperationAccess, vanaMainnet, type webhooks, withSignatureCache };
37786
+ export { type $defs, type APIResponse, type AddAndTrustServerInput, type AddAndTrustServerParams, type AddAndTrustServerTypedData, type AddRefinerParams, type AddRefinerResult, type AddSchemaParams, type AddSchemaResult, type AllKeys, ApiClient, type ApiClientConfig, type ApiResponse, AsyncQueue, type AsyncResult, type AuthenticationErrorResponse, type Awaited, type BaseConfig, type BaseConfigWithStorage, BaseController, type BatchServerInfoResult, type BatchUploadParams, type BatchUploadResult, type BlockRange, BlockchainError, type BlockchainErrorResponse, type Brand, BrowserECIESUint8Provider as BrowserECIESProvider, BrowserPlatformAdapter, type Cache, type CacheConfig, CallbackStorage, type ChainConfig, type ChainConfigWithStorage, type CheckPermissionParams, CircuitBreaker, type CompleteSchema, type ComputeErrorResponse, type ConditionalOptional, type ConfigValidationOptions, type ConfigValidationResult, type ContractAddresses, type ContractCall, type ContractDeployment, ContractFactory, type ContractInfo, type ContractMethodParams, type ContractMethodReturnType, ContractNotFoundError, type Controller, type ControllerContext, type CreateOperationParams, type CreateOperationRequest, type CreateOperationResponse, type CreateSchemaParams, type CreateSchemaResult, DEFAULT_ENCRYPTION_SEED, DEFAULT_IPFS_GATEWAY, DataController, type DataSchema, type DecryptionErrorResponse, type DeepPartial, type DeepReadonly, type DeleteFileParams, type DeleteFileResult, type DownloadFileParams, type DownloadFileResult, type EncryptedUploadParams, type EncryptionInfo, type ErrorResponse, EventEmitter, type EventFilter, type EventLog, type Factory, type FileAccessErrorResponse, type FileAccessPermissions, type FileMetadata, type FilePermissionParams, type FileSharingConfig, type GasEstimate, type GenericRequest, type GenericResponse, type GenericTypedData, type GetFileParams, type GetOperationResponse, type GetUserFilesParams, type GetUserPermissionsOptions, type GetUserTrustedServersParams, GoogleDriveStorage, GrantExpiredError, type GrantFile, type GrantPermissionParams, GrantSchemaError, GrantValidationError, type GrantValidationErrorResponse, type GrantValidationOptions, type GrantValidationResult, type GrantedPermission, type Grantee, type GranteeInfo, GranteeMismatchError, type GranteeQueryOptions, type HttpMethod, IPFS_GATEWAYS, type IdentityResponseModel, type InitPersonalServerParams, type InternalServerErrorResponse, InvalidConfigurationError, IpfsStorage, type LegacyPermissionParams, type MaybeArray, type MaybePromise, MemoryCache, type Middleware, MiddlewarePipeline, NetworkError, type NetworkInfo, type Nominal, type NonNullable, NonceError, type NotFoundErrorResponse, type Observable, type Observer, type OmitByType, type OnChainPermissionGrant, type OperationErrorResponse, OperationNotAllowedError, type OptionalKeys, type PaginatedGrantees, type PaginatedTrustedServers, type PaginationParams, type PaginationResult, type PartialExcept, type Permission, type PermissionAnalytics, type PermissionCheckResult, PermissionError, type PermissionEvent, type PermissionGrantDomain, type PermissionGrantMessage, type PermissionGrantTypedData, type PermissionInfo, type PermissionInputMessage, type PermissionOperation, type PermissionQueryResult, type PermissionStatus, PermissionsController, PersonalServerError, type PersonalServerIdentity, type PersonalServerModel, type PickByType, type PinataListResponse, type PinataPin, PinataStorage, type PinataUploadResponse, type Plugin, type PostRequestParams, type PromiseResult, ProtocolController, type QueryPermissionsParams, type RateLimitInfo, RateLimiter, type RateLimiterConfig, type Refiner, type RegisterGranteeInput, type RegisterGranteeParams, type RegisterGranteeTypedData, type RelayerCallbacks, type RelayerConfig, RelayerError, type RelayerErrorResponse, type RelayerMetrics, type RelayerQueueInfo, type RelayerRequestOptions, type RelayerStatus, type RelayerStorageResponse, type RelayerStoreParams, type RelayerSubmitParams, type RelayerTransactionResponse, type RelayerTransactionStatus, type RelayerWebhookConfig, type RelayerWebhookPayload, type ReplicateAPIResponse, type ReplicateStatus, type Repository, type RequestOptions, type RequireKeys, type RequiredExcept, type RetryConfig, RetryUtility, type RevokePermissionInput, type RevokePermissionParams, type RuntimeConfig, type Schema, type SchemaMetadata, SchemaValidationError, SchemaValidator, SerializationError, type Server, type components as ServerComponents, ServerController, type $defs as ServerDefs, type ServerFilesAndPermissionParams, type ServerFilesAndPermissionTypedData, type ServerInfo, type operations as ServerOperations, type paths as ServerPaths, type ServerTrustStatus, ServerUrlMismatchError, type webhooks as ServerWebhooks, type Service, SignatureCache, SignatureError, type SimplifiedPermissionMessage, type StateMachine, type StatusInfo, type StorageCallbacks, type StorageConfig, type StorageDownloadOptions, StorageError, type StorageFile, type StorageListOptions, type StorageListResult, StorageManager, type StorageProvider, type StorageProviderConfig, type StorageRequiredMarker, type StorageUploadResult, type TimeRange, TransactionHandle, type TransactionOptions, type TransactionReceipt, type Transformer, type TrustServerInput, type TrustServerParams, type TrustServerTypedData, type TrustedServer, type TrustedServerInfo, type TrustedServerQueryOptions, type UnencryptedUploadParams, type UntrustServerInput, type UntrustServerParams, type UntrustServerTypedData, type UpdateSchemaIdParams, type UpdateSchemaIdResult, type UploadEncryptedFileResult, type UploadFileParams, type UploadFileResult, type UploadParams, type UploadProgress, type UploadResult, type UserFile, UserRejectedRequestError, type ValidationErrorResponse, type ValidationResult, type Validator, Vana, VanaBrowserImpl, type VanaChain, type VanaChainConfig, type VanaChainId, type VanaConfig, type VanaConfigWithStorage, type VanaContract, type VanaContract as VanaContractAbi, type VanaContractInstance, type VanaContractName, VanaCore, VanaCoreFactory, VanaError, type VanaInstance, type VanaPlatformAdapter, type WalletConfig, type WalletConfigWithStorage, __contractCache, chains, checkGrantAccess, clearContractCache, type components, convertIpfsUrl, convertIpfsUrlWithFallbacks, createAndStoreGrant, createBrowserPlatformAdapter, createGrantFile, createPlatformAdapterSafe, createValidatedGrant, decryptBlobWithSignedKey, decryptWithPrivateKey, decryptWithWalletPrivateKey, Vana as default, detectPlatform, encryptBlobWithSignedKey, encryptFileKey, encryptWithWalletPublicKey, extractIpfsHash, fetchAndValidateSchema, fetchWithFallbacks, formatEth, formatNumber, formatToken, generateEncryptionKey, generateEncryptionKeyPair, generatePGPKeyPair, getAbi, getAllChains, getChainConfig, getContractAddress, getContractController, getContractInfo, getEncryptionParameters, getGatewayUrls, getGrantFileHash, getGrantTimeRemaining, getPlatformCapabilities, hasStorageConfig, isAPIResponse, isChainConfig, isGrantExpired, isIpfsUrl, isPlatformSupported, isReplicateAPIResponse, isVanaChain, isVanaChainId, isWalletConfig, moksha, mokshaTestnet, type operations, parseReplicateOutput, type paths, retrieveAndValidateGrant, retrieveGrantFile, safeParseJSON, schemaValidator, shortenAddress, storeGrantFile, summarizeGrant, validateDataAgainstSchema, validateDataSchema, validateGrant, validateGrantExpiry, validateGrantFile, validateGranteeAccess, validateOperationAccess, vanaMainnet, type webhooks, withSignatureCache };