@opendatalabs/vana-sdk 0.1.0-alpha.670b7a5 → 0.1.0-alpha.69b0c8d

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 +42 -0
  2. package/dist/{browser-cRpdLQ3-.d.ts → browser-DY8XDblx.d.ts} +4 -0
  3. package/dist/browser.d.ts +1 -1
  4. package/dist/browser.js +24 -9
  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 +1355 -422
  19. package/dist/index.browser.js +35201 -33361
  20. package/dist/index.browser.js.map +1 -1
  21. package/dist/index.node.cjs +35684 -33852
  22. package/dist/index.node.cjs.map +1 -1
  23. package/dist/index.node.d.cts +1388 -429
  24. package/dist/index.node.d.ts +1388 -429
  25. package/dist/index.node.js +35412 -33583
  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 +31 -33
  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 +31 -33
  34. package/dist/node.js.map +1 -1
  35. package/dist/platform.browser.d.ts +2 -2
  36. package/dist/platform.browser.js +31 -8
  37. package/dist/platform.browser.js.map +1 -1
  38. package/dist/platform.cjs +72 -62
  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 +72 -62
  43. package/dist/platform.js.map +1 -1
  44. package/dist/platform.node.cjs +72 -62
  45. package/dist/platform.node.cjs.map +1 -1
  46. package/dist/platform.node.d.cts +6 -2
  47. package/dist/platform.node.d.ts +6 -2
  48. package/dist/platform.node.js +72 -62
  49. package/dist/platform.node.js.map +1 -1
  50. package/package.json +16 -11
@@ -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
 
@@ -157,6 +157,14 @@ declare class StorageError extends Error {
157
157
  });
158
158
  }
159
159
 
160
+ /**
161
+ * Base interface for types that need to be compatible with Record<string, unknown>
162
+ *
163
+ * @category Permissions
164
+ */
165
+ interface RecordCompatible {
166
+ [key: string]: unknown;
167
+ }
160
168
  /**
161
169
  * Represents on-chain permission grant data without expensive off-chain resolution.
162
170
  *
@@ -355,7 +363,7 @@ interface PermissionGrantMessage {
355
363
  *
356
364
  * @category Permissions
357
365
  */
358
- interface PermissionInputMessage {
366
+ interface PermissionInputMessage extends RecordCompatible {
359
367
  /** Nonce */
360
368
  nonce: bigint;
361
369
  /** Grantee ID */
@@ -370,7 +378,7 @@ interface PermissionInputMessage {
370
378
  *
371
379
  * @category Permissions
372
380
  */
373
- interface RevokePermissionInput {
381
+ interface RevokePermissionInput extends RecordCompatible {
374
382
  /** Nonce */
375
383
  nonce: bigint;
376
384
  /** Permission ID to revoke */
@@ -451,9 +459,7 @@ interface GrantFile {
451
459
  *
452
460
  * @category Permissions
453
461
  */
454
- interface PermissionGrantTypedData {
455
- /** EIP-712 domain */
456
- domain: PermissionGrantDomain;
462
+ interface PermissionGrantTypedData extends GenericTypedData {
457
463
  /** EIP-712 types */
458
464
  types: {
459
465
  Permission: Array<{
@@ -471,7 +477,7 @@ interface PermissionGrantTypedData {
471
477
  *
472
478
  * @category Permissions
473
479
  */
474
- interface GenericTypedData {
480
+ interface GenericTypedData extends RecordCompatible {
475
481
  /** EIP-712 domain */
476
482
  domain: PermissionGrantDomain;
477
483
  /** EIP-712 types */
@@ -665,7 +671,7 @@ interface UntrustServerParams {
665
671
  *
666
672
  * @category Permissions
667
673
  */
668
- interface AddAndTrustServerInput {
674
+ interface AddAndTrustServerInput extends RecordCompatible {
669
675
  /** User nonce */
670
676
  nonce: bigint;
671
677
  /** Server address */
@@ -681,7 +687,7 @@ interface AddAndTrustServerInput {
681
687
  * @category Permissions
682
688
  * @deprecated Use AddAndTrustServerInput instead
683
689
  */
684
- interface TrustServerInput {
690
+ interface TrustServerInput extends RecordCompatible {
685
691
  /** User nonce */
686
692
  nonce: bigint;
687
693
  /** Server ID (numeric) */
@@ -692,7 +698,7 @@ interface TrustServerInput {
692
698
  *
693
699
  * @category Permissions
694
700
  */
695
- interface UntrustServerInput {
701
+ interface UntrustServerInput extends RecordCompatible {
696
702
  /** User nonce */
697
703
  nonce: bigint;
698
704
  /** Server ID (numeric) */
@@ -703,9 +709,7 @@ interface UntrustServerInput {
703
709
  *
704
710
  * @category Permissions
705
711
  */
706
- interface AddAndTrustServerTypedData {
707
- /** EIP-712 domain */
708
- domain: PermissionGrantDomain;
712
+ interface AddAndTrustServerTypedData extends GenericTypedData {
709
713
  /** EIP-712 types */
710
714
  types: {
711
715
  AddServer: Array<{
@@ -724,9 +728,7 @@ interface AddAndTrustServerTypedData {
724
728
  * @category Permissions
725
729
  * @deprecated Use AddAndTrustServerTypedData instead
726
730
  */
727
- interface TrustServerTypedData {
728
- /** EIP-712 domain */
729
- domain: PermissionGrantDomain;
731
+ interface TrustServerTypedData extends GenericTypedData {
730
732
  /** EIP-712 types */
731
733
  types: {
732
734
  TrustServer: Array<{
@@ -744,9 +746,7 @@ interface TrustServerTypedData {
744
746
  *
745
747
  * @category Permissions
746
748
  */
747
- interface UntrustServerTypedData {
748
- /** EIP-712 domain */
749
- domain: PermissionGrantDomain;
749
+ interface UntrustServerTypedData extends GenericTypedData {
750
750
  /** EIP-712 types */
751
751
  types: {
752
752
  UntrustServer: Array<{
@@ -903,7 +903,7 @@ interface RegisterGranteeParams {
903
903
  *
904
904
  * @category Permissions
905
905
  */
906
- interface RegisterGranteeInput extends Record<string, unknown> {
906
+ interface RegisterGranteeInput extends RecordCompatible {
907
907
  /** User nonce */
908
908
  nonce: bigint;
909
909
  /** Grantee owner address */
@@ -918,9 +918,7 @@ interface RegisterGranteeInput extends Record<string, unknown> {
918
918
  *
919
919
  * @category Permissions
920
920
  */
921
- interface RegisterGranteeTypedData {
922
- /** EIP-712 domain */
923
- domain: PermissionGrantDomain;
921
+ interface RegisterGranteeTypedData extends GenericTypedData {
924
922
  /** EIP-712 types */
925
923
  types: {
926
924
  RegisterGrantee: Array<{
@@ -986,6 +984,8 @@ interface ServerFilesAndPermissionParams {
986
984
  grant: string;
987
985
  /** File URLs */
988
986
  fileUrls: string[];
987
+ /** Schema IDs for each file - use 0 for files without schema validation */
988
+ schemaIds: number[];
989
989
  /** Server address */
990
990
  serverAddress: Address;
991
991
  /** Server URL */
@@ -1011,6 +1011,8 @@ interface ServerFilesAndPermissionTypedData extends GenericTypedData {
1011
1011
  grant: string;
1012
1012
  /** File URLs */
1013
1013
  fileUrls: string[];
1014
+ /** Schema IDs for each file - use 0 for files without schema validation */
1015
+ schemaIds: bigint[];
1014
1016
  /** Server address */
1015
1017
  serverAddress: Address;
1016
1018
  /** Server URL */
@@ -1750,6 +1752,12 @@ interface UserFile$1 {
1750
1752
  transactionHash?: Address;
1751
1753
  /** Additional file properties and custom application data. */
1752
1754
  metadata?: FileMetadata;
1755
+ /**
1756
+ * Array of DLP IDs that have submitted proofs for this file.
1757
+ * Each proof represents verification or processing by a Data Liquidity Pool.
1758
+ * Obtain DLP details via `vana.data.getDLP(dlpId)`.
1759
+ */
1760
+ dlpIds?: number[];
1753
1761
  }
1754
1762
  /**
1755
1763
  * Provides optional metadata for uploaded files and content description.
@@ -2161,33 +2169,84 @@ interface BatchUploadResult {
2161
2169
  errors?: string[];
2162
2170
  }
2163
2171
  /**
2164
- * Represents a data schema in the refiner registry.
2172
+ * Schema metadata from the blockchain (without fetched definition).
2173
+ *
2174
+ * This represents the on-chain schema registration data before the
2175
+ * definition has been fetched from the storage URL.
2176
+ *
2177
+ * @category Data Management
2178
+ */
2179
+ interface SchemaMetadata {
2180
+ /** Schema ID */
2181
+ id: number;
2182
+ /** Schema name */
2183
+ name: string;
2184
+ /** Schema dialect ('json' or 'sqlite') */
2185
+ dialect: "json" | "sqlite";
2186
+ /** URL containing the schema definition */
2187
+ definitionUrl: string;
2188
+ }
2189
+ /**
2190
+ * Complete schema with all definition fields populated.
2191
+ * This is what schemas.get() returns - a schema with the definition fetched.
2192
+ */
2193
+ interface CompleteSchema extends SchemaMetadata {
2194
+ /** Version of the schema */
2195
+ version: string;
2196
+ /** Optional description of the schema */
2197
+ description?: string;
2198
+ /** Optional version of the dialect */
2199
+ dialectVersion?: string;
2200
+ /** The actual schema - JSON Schema object for 'json' dialect, DDL string for 'sqlite' */
2201
+ schema: object | string;
2202
+ }
2203
+ /**
2204
+ * Schema with optional definition fields.
2165
2205
  *
2166
2206
  * Schemas define the structure and validation rules for user data processed by refiners.
2167
2207
  * They ensure data quality and consistency across the Vana network by specifying how
2168
2208
  * raw user data should be formatted, validated, and processed.
2169
2209
  *
2210
+ * When the definition has been fetched (via schemas.get() or schemas.list() with includeDefinitions),
2211
+ * the version and schema fields will be populated. Otherwise, only the metadata fields are present.
2212
+ *
2170
2213
  * @category Data Management
2171
2214
  * @example
2172
2215
  * ```typescript
2173
- * const socialMediaSchema: Schema = {
2216
+ * // Complete schema from schemas.get()
2217
+ * const completeSchema: Schema = {
2218
+ * id: 5,
2219
+ * name: 'Social Media Profile',
2220
+ * dialect: 'json',
2221
+ * definitionUrl: 'ipfs://QmSchema...',
2222
+ * version: '1.0.0',
2223
+ * description: 'Schema for validating social media profile data',
2224
+ * schema: { // JSON Schema object
2225
+ * type: 'object',
2226
+ * properties: {
2227
+ * username: { type: 'string' }
2228
+ * }
2229
+ * }
2230
+ * };
2231
+ *
2232
+ * // Metadata-only schema from schemas.list() without includeDefinitions
2233
+ * const metadataSchema: Schema = {
2174
2234
  * id: 5,
2175
2235
  * name: 'Social Media Profile',
2176
- * type: 'JSON',
2177
- * url: 'ipfs://QmSchema...', // Schema definition file
2178
- * description: 'Schema for validating social media profile data'
2236
+ * dialect: 'json',
2237
+ * definitionUrl: 'ipfs://QmSchema...'
2179
2238
  * };
2180
2239
  * ```
2181
2240
  */
2182
- interface Schema {
2183
- /** Schema ID */
2184
- id: number;
2185
- /** Schema name */
2186
- name: string;
2187
- /** Schema type */
2188
- type: string;
2189
- /** URL containing the schema definition */
2190
- definitionUrl: string;
2241
+ interface Schema extends SchemaMetadata {
2242
+ /** Version of the schema (present when definition is fetched) */
2243
+ version?: string;
2244
+ /** Optional description of the schema */
2245
+ description?: string;
2246
+ /** Optional version of the dialect */
2247
+ dialectVersion?: string;
2248
+ /** The actual schema - JSON Schema object for 'json' dialect, DDL string for 'sqlite' (present when definition is fetched) */
2249
+ schema?: object | string;
2191
2250
  }
2192
2251
  /**
2193
2252
  * Represents a refiner with schema information
@@ -2216,8 +2275,8 @@ interface Refiner {
2216
2275
  interface AddSchemaParams {
2217
2276
  /** Schema name */
2218
2277
  name: string;
2219
- /** Schema type */
2220
- type: string;
2278
+ /** Schema dialect */
2279
+ dialect: string;
2221
2280
  /** URL containing the schema definition */
2222
2281
  definitionUrl: string;
2223
2282
  }
@@ -2292,13 +2351,7 @@ interface UpdateSchemaIdResult {
2292
2351
  transactionHash: Hash;
2293
2352
  }
2294
2353
  /**
2295
- * Query mode for trusted server retrieval
2296
- *
2297
- * @category Data Management
2298
- */
2299
- type TrustedServerQueryMode = "subgraph" | "rpc" | "auto";
2300
- /**
2301
- * Trusted server data structure (unified format for both subgraph and RPC modes)
2354
+ * Trusted server data structure
2302
2355
  *
2303
2356
  * @category Data Management
2304
2357
  */
@@ -2317,39 +2370,20 @@ interface TrustedServer {
2317
2370
  trustIndex?: number;
2318
2371
  }
2319
2372
  /**
2320
- * Parameters for getUserTrustedServers with dual-mode support
2373
+ * Parameters for getUserTrustedServers method
2321
2374
  *
2322
2375
  * @category Data Management
2323
2376
  */
2324
2377
  interface GetUserTrustedServersParams {
2325
- /** User address to query */
2378
+ /** User address to query trusted servers for */
2326
2379
  user: Address;
2327
- /** Query mode: 'subgraph' (fast, requires subgraph), 'rpc' (direct contract), or 'auto' (tries subgraph first) */
2328
- mode?: TrustedServerQueryMode;
2329
- /** Subgraph URL (required for subgraph mode) */
2380
+ /** Optional subgraph URL to override default */
2330
2381
  subgraphUrl?: string;
2331
- /** Pagination limit (applies to RPC mode) */
2382
+ /** Maximum number of results */
2332
2383
  limit?: number;
2333
- /** Pagination offset (applies to RPC mode) */
2384
+ /** Number of results to skip */
2334
2385
  offset?: number;
2335
2386
  }
2336
- /**
2337
- * Result of getUserTrustedServers query
2338
- *
2339
- * @category Data Management
2340
- */
2341
- interface GetUserTrustedServersResult {
2342
- /** Array of trusted servers */
2343
- servers: TrustedServer[];
2344
- /** Query mode that was actually used */
2345
- usedMode: TrustedServerQueryMode;
2346
- /** Total count (only available in RPC mode) */
2347
- total?: number;
2348
- /** Whether there are more servers (pagination info for RPC mode) */
2349
- hasMore?: boolean;
2350
- /** Any warnings or fallback information */
2351
- warnings?: string[];
2352
- }
2353
2387
 
2354
2388
  declare const contractAbis: {
2355
2389
  readonly DataPortabilityPermissions: readonly [{
@@ -2468,6 +2502,18 @@ declare const contractAbis: {
2468
2502
  }];
2469
2503
  readonly name: "InvalidPermissionsLength";
2470
2504
  readonly type: "error";
2505
+ }, {
2506
+ readonly inputs: readonly [{
2507
+ readonly internalType: "uint256";
2508
+ readonly name: "filesLength";
2509
+ readonly type: "uint256";
2510
+ }, {
2511
+ readonly internalType: "uint256";
2512
+ readonly name: "schemaIdsLength";
2513
+ readonly type: "uint256";
2514
+ }];
2515
+ readonly name: "InvalidSchemaIdsLength";
2516
+ readonly type: "error";
2471
2517
  }, {
2472
2518
  readonly inputs: readonly [];
2473
2519
  readonly name: "InvalidSignature";
@@ -2744,6 +2790,10 @@ declare const contractAbis: {
2744
2790
  readonly internalType: "string[]";
2745
2791
  readonly name: "fileUrls";
2746
2792
  readonly type: "string[]";
2793
+ }, {
2794
+ readonly internalType: "uint256[]";
2795
+ readonly name: "schemaIds";
2796
+ readonly type: "uint256[]";
2747
2797
  }, {
2748
2798
  readonly internalType: "address";
2749
2799
  readonly name: "serverAddress";
@@ -3726,7 +3776,7 @@ declare const contractAbis: {
3726
3776
  readonly name: "addServerInput";
3727
3777
  readonly type: "tuple";
3728
3778
  }];
3729
- readonly name: "addAndTrustServerOnBehalf";
3779
+ readonly name: "addAndTrustServerByManager";
3730
3780
  readonly outputs: readonly [];
3731
3781
  readonly stateMutability: "nonpayable";
3732
3782
  readonly type: "function";
@@ -4114,6 +4164,20 @@ declare const contractAbis: {
4114
4164
  readonly outputs: readonly [];
4115
4165
  readonly stateMutability: "nonpayable";
4116
4166
  readonly type: "function";
4167
+ }, {
4168
+ readonly inputs: readonly [{
4169
+ readonly internalType: "address";
4170
+ readonly name: "userAddress";
4171
+ readonly type: "address";
4172
+ }, {
4173
+ readonly internalType: "uint256";
4174
+ readonly name: "serverId";
4175
+ readonly type: "uint256";
4176
+ }];
4177
+ readonly name: "trustServerByManager";
4178
+ readonly outputs: readonly [];
4179
+ readonly stateMutability: "nonpayable";
4180
+ readonly type: "function";
4117
4181
  }, {
4118
4182
  readonly inputs: readonly [{
4119
4183
  readonly components: readonly [{
@@ -5172,6 +5236,31 @@ declare const contractAbis: {
5172
5236
  }];
5173
5237
  readonly name: "FileAdded";
5174
5238
  readonly type: "event";
5239
+ }, {
5240
+ readonly anonymous: false;
5241
+ readonly inputs: readonly [{
5242
+ readonly indexed: true;
5243
+ readonly internalType: "uint256";
5244
+ readonly name: "fileId";
5245
+ readonly type: "uint256";
5246
+ }, {
5247
+ readonly indexed: true;
5248
+ readonly internalType: "address";
5249
+ readonly name: "ownerAddress";
5250
+ readonly type: "address";
5251
+ }, {
5252
+ readonly indexed: false;
5253
+ readonly internalType: "string";
5254
+ readonly name: "url";
5255
+ readonly type: "string";
5256
+ }, {
5257
+ readonly indexed: false;
5258
+ readonly internalType: "uint256";
5259
+ readonly name: "schemaId";
5260
+ readonly type: "uint256";
5261
+ }];
5262
+ readonly name: "FileAddedV2";
5263
+ readonly type: "event";
5175
5264
  }, {
5176
5265
  readonly anonymous: false;
5177
5266
  readonly inputs: readonly [{
@@ -5362,6 +5451,16 @@ declare const contractAbis: {
5362
5451
  }];
5363
5452
  readonly name: "Upgraded";
5364
5453
  readonly type: "event";
5454
+ }, {
5455
+ readonly inputs: readonly [];
5456
+ readonly name: "DATA_PORTABILITY_ROLE";
5457
+ readonly outputs: readonly [{
5458
+ readonly internalType: "bytes32";
5459
+ readonly name: "";
5460
+ readonly type: "bytes32";
5461
+ }];
5462
+ readonly stateMutability: "view";
5463
+ readonly type: "function";
5365
5464
  }, {
5366
5465
  readonly inputs: readonly [];
5367
5466
  readonly name: "DEFAULT_ADMIN_ROLE";
@@ -5434,6 +5533,33 @@ declare const contractAbis: {
5434
5533
  readonly outputs: readonly [];
5435
5534
  readonly stateMutability: "nonpayable";
5436
5535
  readonly type: "function";
5536
+ }, {
5537
+ readonly inputs: readonly [{
5538
+ readonly internalType: "uint256";
5539
+ readonly name: "fileId";
5540
+ readonly type: "uint256";
5541
+ }, {
5542
+ readonly components: readonly [{
5543
+ readonly internalType: "address";
5544
+ readonly name: "account";
5545
+ readonly type: "address";
5546
+ }, {
5547
+ readonly internalType: "string";
5548
+ readonly name: "key";
5549
+ readonly type: "string";
5550
+ }];
5551
+ readonly internalType: "struct IDataRegistry.Permission[]";
5552
+ readonly name: "permissions";
5553
+ readonly type: "tuple[]";
5554
+ }, {
5555
+ readonly internalType: "uint256";
5556
+ readonly name: "schemaId";
5557
+ readonly type: "uint256";
5558
+ }];
5559
+ readonly name: "addFilePermissionsAndSchema";
5560
+ readonly outputs: readonly [];
5561
+ readonly stateMutability: "nonpayable";
5562
+ readonly type: "function";
5437
5563
  }, {
5438
5564
  readonly inputs: readonly [{
5439
5565
  readonly internalType: "string";
@@ -5598,6 +5724,16 @@ declare const contractAbis: {
5598
5724
  }];
5599
5725
  readonly stateMutability: "view";
5600
5726
  readonly type: "function";
5727
+ }, {
5728
+ readonly inputs: readonly [];
5729
+ readonly name: "emitLegacyEvents";
5730
+ readonly outputs: readonly [{
5731
+ readonly internalType: "bool";
5732
+ readonly name: "";
5733
+ readonly type: "bool";
5734
+ }];
5735
+ readonly stateMutability: "view";
5736
+ readonly type: "function";
5601
5737
  }, {
5602
5738
  readonly inputs: readonly [{
5603
5739
  readonly internalType: "string";
@@ -5716,6 +5852,10 @@ declare const contractAbis: {
5716
5852
  readonly internalType: "string";
5717
5853
  readonly name: "url";
5718
5854
  readonly type: "string";
5855
+ }, {
5856
+ readonly internalType: "uint256";
5857
+ readonly name: "schemaId";
5858
+ readonly type: "uint256";
5719
5859
  }, {
5720
5860
  readonly internalType: "uint256";
5721
5861
  readonly name: "addedAtBlock";
@@ -5933,6 +6073,16 @@ declare const contractAbis: {
5933
6073
  readonly outputs: readonly [];
5934
6074
  readonly stateMutability: "nonpayable";
5935
6075
  readonly type: "function";
6076
+ }, {
6077
+ readonly inputs: readonly [{
6078
+ readonly internalType: "bool";
6079
+ readonly name: "newEmitLegacyEvents";
6080
+ readonly type: "bool";
6081
+ }];
6082
+ readonly name: "updateEmitLegacyEvents";
6083
+ readonly outputs: readonly [];
6084
+ readonly stateMutability: "nonpayable";
6085
+ readonly type: "function";
5936
6086
  }, {
5937
6087
  readonly inputs: readonly [{
5938
6088
  readonly internalType: "address";
@@ -28737,6 +28887,95 @@ type VanaContract = keyof ContractAbis;
28737
28887
  */
28738
28888
  declare function getAbi<T extends VanaContract>(contract: T): ContractAbis[T];
28739
28889
 
28890
+ /**
28891
+ * Comprehensive mapping of SDK transaction operations to blockchain events.
28892
+ * Used by the generic transaction parser to know which contract and event
28893
+ * to look for when parsing transaction results.
28894
+ */
28895
+ declare const EVENT_MAPPINGS: {
28896
+ readonly grant: {
28897
+ readonly contract: "DataPortabilityPermissions";
28898
+ readonly event: "PermissionAdded";
28899
+ };
28900
+ readonly revoke: {
28901
+ readonly contract: "DataPortabilityPermissions";
28902
+ readonly event: "PermissionRevoked";
28903
+ };
28904
+ readonly revokePermission: {
28905
+ readonly contract: "DataPortabilityPermissions";
28906
+ readonly event: "PermissionRevoked";
28907
+ };
28908
+ readonly addServerFilesAndPermissions: {
28909
+ readonly contract: "DataPortabilityPermissions";
28910
+ readonly event: "PermissionAdded";
28911
+ };
28912
+ readonly trustServer: {
28913
+ readonly contract: "DataPortabilityServers";
28914
+ readonly event: "ServerTrusted";
28915
+ };
28916
+ readonly untrustServer: {
28917
+ readonly contract: "DataPortabilityServers";
28918
+ readonly event: "ServerUntrusted";
28919
+ };
28920
+ readonly registerServer: {
28921
+ readonly contract: "DataPortabilityServers";
28922
+ readonly event: "ServerRegistered";
28923
+ };
28924
+ readonly updateServer: {
28925
+ readonly contract: "DataPortabilityServers";
28926
+ readonly event: "ServerUpdated";
28927
+ };
28928
+ readonly addAndTrustServer: {
28929
+ readonly contract: "DataPortabilityServers";
28930
+ readonly event: "ServerTrusted";
28931
+ };
28932
+ readonly addFile: {
28933
+ readonly contract: "DataRegistry";
28934
+ readonly event: "FileAddedV2";
28935
+ };
28936
+ readonly addFileWithPermissionsAndSchema: {
28937
+ readonly contract: "DataRegistry";
28938
+ readonly event: "FileAddedV2";
28939
+ };
28940
+ readonly addFileWithSchema: {
28941
+ readonly contract: "DataRegistry";
28942
+ readonly event: "FileAddedV2";
28943
+ };
28944
+ readonly addFileWithPermissions: {
28945
+ readonly contract: "DataRegistry";
28946
+ readonly event: "FileAddedV2";
28947
+ };
28948
+ readonly addRefinement: {
28949
+ readonly contract: "DataRegistry";
28950
+ readonly event: "RefinementAdded";
28951
+ };
28952
+ readonly addRefiner: {
28953
+ readonly contract: "DataRefinerRegistry";
28954
+ readonly event: "RefinerAdded";
28955
+ };
28956
+ readonly updateSchemaId: {
28957
+ readonly contract: "DataRefinerRegistry";
28958
+ readonly event: "SchemaAdded";
28959
+ };
28960
+ readonly addSchema: {
28961
+ readonly contract: "DataRefinerRegistry";
28962
+ readonly event: "SchemaAdded";
28963
+ };
28964
+ readonly updateRefinement: {
28965
+ readonly contract: "DataRegistry";
28966
+ readonly event: "RefinementUpdated";
28967
+ };
28968
+ readonly addFilePermission: {
28969
+ readonly contract: "DataRegistry";
28970
+ readonly event: "PermissionGranted";
28971
+ };
28972
+ readonly registerGrantee: {
28973
+ readonly contract: "DataPortabilityGrantees";
28974
+ readonly event: "GranteeRegistered";
28975
+ };
28976
+ };
28977
+ type TransactionOperation = keyof typeof EVENT_MAPPINGS;
28978
+
28740
28979
  /**
28741
28980
  * Base interface for all transaction results.
28742
28981
  * Contains the event data plus transaction metadata.
@@ -28774,6 +29013,50 @@ interface PermissionRevokeResult extends BaseTransactionResult {
28774
29013
  /** ID of the permission that was revoked */
28775
29014
  permissionId: bigint;
28776
29015
  }
29016
+ /**
29017
+ * Result of a successful server trust operation.
29018
+ * Contains data from the ServerTrusted blockchain event.
29019
+ */
29020
+ interface ServerTrustResult extends BaseTransactionResult {
29021
+ /** Address of the user who trusted the server */
29022
+ user: Address;
29023
+ /** Address/ID of the trusted server */
29024
+ serverId: Address;
29025
+ /** URL of the trusted server */
29026
+ serverUrl: string;
29027
+ }
29028
+ /**
29029
+ * Result of a successful server untrust operation.
29030
+ * Contains data from the ServerUntrusted blockchain event.
29031
+ */
29032
+ interface ServerUntrustResult extends BaseTransactionResult {
29033
+ /** Address of the user who untrusted the server */
29034
+ user: Address;
29035
+ /** Address/ID of the untrusted server */
29036
+ serverId: Address;
29037
+ }
29038
+ /**
29039
+ * Result of a successful server update operation.
29040
+ * Contains data from the ServerUpdated blockchain event.
29041
+ */
29042
+ interface ServerUpdateResult extends BaseTransactionResult {
29043
+ /** ID of the server that was updated */
29044
+ serverId: bigint;
29045
+ /** New URL of the server */
29046
+ url: string;
29047
+ }
29048
+ /**
29049
+ * Result of a successful grantee registration operation.
29050
+ * Contains data from the GranteeRegistered blockchain event.
29051
+ */
29052
+ interface GranteeRegisterResult extends BaseTransactionResult {
29053
+ /** Unique grantee ID assigned by the registry */
29054
+ granteeId: bigint;
29055
+ /** Address of the registered grantee */
29056
+ granteeAddress: Address;
29057
+ /** Display name of the grantee */
29058
+ name: string;
29059
+ }
28777
29060
  /**
28778
29061
  * Result of a successful file permission addition operation.
28779
29062
  * Contains data from the FilePermissionAdded blockchain event.
@@ -28787,6 +29070,80 @@ interface FilePermissionResult extends BaseTransactionResult {
28787
29070
  encryptedKey: string;
28788
29071
  }
28789
29072
 
29073
+ /**
29074
+ * Provides a unified interface for blockchain transaction results with lazy-loaded event parsing.
29075
+ *
29076
+ * @remarks
29077
+ * TransactionHandle enables immediate access to transaction hashes while providing optional
29078
+ * lazy-loaded access to receipts and parsed event data. All transaction-submitting methods
29079
+ * in the SDK return this handle, allowing developers to choose between immediate hash access
29080
+ * or waiting for event data. Results are memoized to prevent redundant network calls.
29081
+ *
29082
+ * @category Transactions
29083
+ * @example
29084
+ * ```typescript
29085
+ * // Immediate hash access
29086
+ * const tx = await sdk.permissions.submitSignedGrant(typedData, signature);
29087
+ * console.log(`Transaction submitted: ${tx.hash}`);
29088
+ *
29089
+ * // Wait for and parse events
29090
+ * const eventData = await tx.waitForEvents();
29091
+ * console.log(`Permission ID: ${eventData.permissionId}`);
29092
+ *
29093
+ * // Check receipt for gas usage
29094
+ * const receipt = await tx.waitForReceipt();
29095
+ * console.log(`Gas used: ${receipt.gasUsed}`);
29096
+ * ```
29097
+ */
29098
+ declare class TransactionHandle<TEventData = unknown> {
29099
+ private readonly context;
29100
+ readonly hash: Hash;
29101
+ private readonly operation?;
29102
+ private _receipt?;
29103
+ private _eventData?;
29104
+ private _receiptPromise?;
29105
+ private _eventPromise?;
29106
+ constructor(context: ControllerContext$1, hash: Hash, operation?: TransactionOperation | undefined);
29107
+ /**
29108
+ * Waits for transaction confirmation and returns the receipt.
29109
+ * Results are memoized - multiple calls return the same promise.
29110
+ *
29111
+ * @param options Optional timeout configuration
29112
+ * @param options.timeout Timeout in milliseconds (default: 30000)
29113
+ * @returns Transaction receipt with gas usage, logs, and status
29114
+ */
29115
+ waitForReceipt(options?: {
29116
+ timeout?: number;
29117
+ }): Promise<TransactionReceipt$1>;
29118
+ /**
29119
+ * Waits for transaction confirmation and parses emitted events.
29120
+ * Results are memoized - multiple calls return the same promise.
29121
+ *
29122
+ * @returns Parsed event data with transaction metadata
29123
+ * @throws {Error} If no operation was specified for event parsing
29124
+ */
29125
+ waitForEvents(): Promise<TEventData>;
29126
+ /**
29127
+ * Enables string coercion for backwards compatibility.
29128
+ * Allows TransactionHandle to be used anywhere a Hash is expected.
29129
+ *
29130
+ * @example
29131
+ * ```typescript
29132
+ * const hash: Hash = tx; // Works via toString()
29133
+ * console.log(`Transaction: ${tx}`); // Prints hash
29134
+ * ```
29135
+ * @returns The transaction hash as a string
29136
+ */
29137
+ toString(): string;
29138
+ /**
29139
+ * JSON serialization support.
29140
+ * Returns the hash when serialized to JSON.
29141
+ *
29142
+ * @returns The transaction hash for JSON serialization
29143
+ */
29144
+ toJSON(): string;
29145
+ }
29146
+
28790
29147
  /**
28791
29148
  * Google Drive Storage Provider for Vana SDK
28792
29149
  *
@@ -29825,30 +30182,31 @@ declare class PermissionsController {
29825
30182
  */
29826
30183
  grant(params: GrantPermissionParams$1): Promise<PermissionGrantResult>;
29827
30184
  /**
29828
- * Submits a permission grant transaction and returns the transaction hash immediately.
30185
+ * Submits a permission grant transaction and returns a handle for flexible result access.
29829
30186
  *
29830
- * This is the lower-level method that provides maximum control over transaction timing.
29831
- * Use this when you want to handle transaction confirmation and event parsing separately,
29832
- * or when submitting multiple transactions in batch.
30187
+ * @remarks
30188
+ * This lower-level method provides maximum control over transaction timing.
30189
+ * Returns a TransactionHandle that allows immediate hash access or optional event parsing.
30190
+ * Use this when handling multiple transactions or when you need granular control.
29833
30191
  *
29834
30192
  * @param params - The permission grant configuration object
29835
- * @returns Promise that resolves to the transaction hash when successfully submitted
30193
+ * @returns Promise resolving to TransactionHandle with hash and event parsing capabilities
29836
30194
  * @throws {RelayerError} When gasless transaction submission fails
29837
30195
  * @throws {SignatureError} When user rejects the signature request
29838
30196
  * @throws {SerializationError} When grant data cannot be serialized
29839
30197
  * @throws {BlockchainError} When permission grant preparation fails
29840
30198
  * @example
29841
30199
  * ```typescript
29842
- * // Submit transaction and handle confirmation later
29843
- * const txHash = await vana.permissions.submitPermissionGrant(params);
29844
- * console.log(`Transaction submitted: ${txHash}`);
30200
+ * // Submit transaction and get immediate hash access
30201
+ * const tx = await vana.permissions.submitPermissionGrant(params);
30202
+ * console.log(`Transaction submitted: ${tx.hash}`);
29845
30203
  *
29846
- * // Later, when you need the permission data:
29847
- * const result = await parseTransactionResult(context, txHash, 'grant');
29848
- * console.log(`Permission ID: ${result.permissionId}`);
30204
+ * // Optionally wait for and parse events
30205
+ * const eventData = await tx.waitForEvents();
30206
+ * console.log(`Permission ID: ${eventData.permissionId}`);
29849
30207
  * ```
29850
30208
  */
29851
- submitPermissionGrant(params: GrantPermissionParams$1): Promise<Hash>;
30209
+ submitPermissionGrant(params: GrantPermissionParams$1): Promise<TransactionHandle<PermissionGrantResult>>;
29852
30210
  /**
29853
30211
  * Prepares a permission grant with preview before signing.
29854
30212
  *
@@ -29876,15 +30234,21 @@ declare class PermissionsController {
29876
30234
  */
29877
30235
  prepareGrant(params: GrantPermissionParams$1): Promise<{
29878
30236
  preview: GrantFile;
29879
- confirm: () => Promise<Hash>;
30237
+ confirm: () => Promise<TransactionHandle<PermissionGrantResult>>;
29880
30238
  }>;
29881
30239
  /**
29882
- * Internal method to complete the grant process after user confirmation.
29883
- * This is called by the confirm() function returned from prepareGrant().
30240
+ * Completes the grant process after user confirmation.
30241
+ *
30242
+ * @remarks
30243
+ * This internal method is called by the confirm() function returned from prepareGrant().
30244
+ * It handles IPFS upload, signature creation, and transaction submission.
29884
30245
  *
29885
30246
  * @param params - The permission grant parameters containing user and operation details
29886
30247
  * @param grantFile - The prepared grant file with permissions and metadata
29887
- * @returns Promise resolving to the transaction hash
30248
+ * @returns Promise resolving to TransactionHandle for flexible result access
30249
+ * @throws {BlockchainError} When permission grant confirmation fails
30250
+ * @throws {NetworkError} When IPFS upload fails
30251
+ * @throws {SignatureError} When user rejects the signature
29888
30252
  */
29889
30253
  private confirmGrantInternal;
29890
30254
  /**
@@ -29940,49 +30304,106 @@ declare class PermissionsController {
29940
30304
  * );
29941
30305
  * ```
29942
30306
  */
29943
- submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<Hash>;
30307
+ submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
29944
30308
  /**
29945
30309
  * Submits an already-signed trust server transaction to the blockchain.
30310
+ *
30311
+ * @remarks
29946
30312
  * This method extracts the trust server input from typed data and submits it directly.
30313
+ * Used internally by trust server methods after signature collection.
29947
30314
  *
29948
30315
  * @param typedData - The EIP-712 typed data for TrustServer
29949
- * @param signature - The user's signature
29950
- * @returns Promise resolving to the transaction hash
30316
+ * @param signature - The user's signature obtained via `signTypedData()`
30317
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30318
+ * @throws {BlockchainError} When contract submission fails
30319
+ * @throws {NetworkError} When blockchain communication fails
30320
+ * @example
30321
+ * ```typescript
30322
+ * const txHandle = await vana.permissions.submitSignedTrustServer(
30323
+ * typedData,
30324
+ * "0x1234..."
30325
+ * );
30326
+ * const result = await txHandle.waitForEvents();
30327
+ * ```
29951
30328
  */
29952
- submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<Hash>;
30329
+ submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
29953
30330
  /**
29954
30331
  * Submits an already-signed add and trust server transaction to the blockchain.
30332
+ *
30333
+ * @remarks
29955
30334
  * This method extracts the add and trust server input from typed data and submits it directly.
30335
+ * Combines server registration and trust operations in a single transaction.
29956
30336
  *
29957
30337
  * @param typedData - The EIP-712 typed data for AddAndTrustServer
29958
- * @param signature - The user's signature
29959
- * @returns Promise resolving to the transaction hash
30338
+ * @param signature - The user's signature obtained via `signTypedData()`
30339
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30340
+ * @throws {BlockchainError} When contract submission fails
30341
+ * @throws {NetworkError} When blockchain communication fails
30342
+ * @example
30343
+ * ```typescript
30344
+ * const txHandle = await vana.permissions.submitSignedAddAndTrustServer(
30345
+ * typedData,
30346
+ * "0x1234..."
30347
+ * );
30348
+ * const result = await txHandle.waitForEvents();
30349
+ * ```
29960
30350
  */
29961
- submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<Hash>;
30351
+ submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
29962
30352
  /**
29963
30353
  * Submits an already-signed permission revoke transaction to the blockchain.
30354
+ *
30355
+ * @remarks
29964
30356
  * This method handles the revocation of previously granted permissions.
30357
+ * Used internally by revocation methods after signature collection.
29965
30358
  *
29966
30359
  * @param typedData - The EIP-712 typed data for PermissionRevoke
29967
- * @param signature - The user's signature
29968
- * @returns Promise resolving to the transaction hash
30360
+ * @param signature - The user's signature obtained via `signTypedData()`
30361
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30362
+ * @throws {BlockchainError} When contract submission fails
30363
+ * @throws {NetworkError} When blockchain communication fails
30364
+ * @example
30365
+ * ```typescript
30366
+ * const txHandle = await vana.permissions.submitSignedRevoke(
30367
+ * typedData,
30368
+ * "0x1234..."
30369
+ * );
30370
+ * const result = await txHandle.waitForEvents();
30371
+ * ```
29969
30372
  */
29970
- submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30373
+ submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionRevokeResult>>;
29971
30374
  /**
29972
30375
  * Submits an already-signed untrust server transaction to the blockchain.
30376
+ *
30377
+ * @remarks
29973
30378
  * This method handles the removal of trusted servers.
30379
+ * Used internally by untrust server methods after signature collection.
29974
30380
  *
29975
30381
  * @param typedData - The EIP-712 typed data for UntrustServer
29976
- * @param signature - The user's signature
29977
- * @returns Promise resolving to the transaction hash
30382
+ * @param signature - The user's signature obtained via `signTypedData()`
30383
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30384
+ * @throws {BlockchainError} When contract submission fails
30385
+ * @throws {NetworkError} When blockchain communication fails
30386
+ * @example
30387
+ * ```typescript
30388
+ * const txHandle = await vana.permissions.submitSignedUntrustServer(
30389
+ * typedData,
30390
+ * "0x1234..."
30391
+ * );
30392
+ * const result = await txHandle.waitForEvents();
30393
+ * ```
29978
30394
  */
29979
- submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30395
+ submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<ServerUntrustResult>>;
29980
30396
  /**
29981
30397
  * Submits a signed transaction directly to the blockchain.
29982
30398
  *
30399
+ * @remarks
30400
+ * Internal method used when relayer callbacks are not available. Formats the signature
30401
+ * and submits the permission grant directly to the smart contract.
30402
+ *
29983
30403
  * @param typedData - The typed data structure for the permission grant
29984
30404
  * @param signature - The cryptographic signature authorizing the transaction
29985
30405
  * @returns Promise resolving to the transaction hash
30406
+ * @throws {BlockchainError} When contract submission fails
29986
30407
  */
29987
30408
  private submitDirectTransaction;
29988
30409
  /**
@@ -30029,19 +30450,33 @@ declare class PermissionsController {
30029
30450
  * console.log(`Revocation submitted: ${txHash}`);
30030
30451
  * ```
30031
30452
  */
30032
- submitPermissionRevoke(params: RevokePermissionParams): Promise<Hash>;
30453
+ submitPermissionRevoke(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
30033
30454
  /**
30034
- * Revokes a permission with a signature (gasless transaction).
30455
+ * Revokes a permission with a signature for gasless transactions.
30456
+ *
30457
+ * @remarks
30458
+ * This method creates an EIP-712 signature for permission revocation and submits
30459
+ * it either through relayer callbacks or directly to the blockchain. Provides
30460
+ * gasless revocation when relayer is configured.
30035
30461
  *
30036
30462
  * @param params - Parameters for revoking the permission
30037
- * @returns Promise resolving to transaction hash
30463
+ * @param params.permissionId - Permission identifier to revoke (accepts bigint, number, or string)
30464
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30038
30465
  * @throws {BlockchainError} When chain ID is not available
30039
30466
  * @throws {NonceError} When retrieving user nonce fails
30040
30467
  * @throws {SignatureError} When user rejects the signature request
30041
30468
  * @throws {RelayerError} When gasless submission fails
30042
30469
  * @throws {PermissionError} When revocation fails for any other reason
30470
+ * @example
30471
+ * ```typescript
30472
+ * const txHandle = await vana.permissions.submitRevokeWithSignature({
30473
+ * permissionId: 123n
30474
+ * });
30475
+ * const result = await txHandle.waitForEvents();
30476
+ * console.log(`Permission ${result.permissionId} revoked`);
30477
+ * ```
30043
30478
  */
30044
- submitRevokeWithSignature(params: RevokePermissionParams): Promise<Hash>;
30479
+ submitRevokeWithSignature(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
30045
30480
  /**
30046
30481
  * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30047
30482
  *
@@ -30066,6 +30501,18 @@ declare class PermissionsController {
30066
30501
  * const serversNonce = await this.getServersUserNonce();
30067
30502
  * ```
30068
30503
  */
30504
+ /**
30505
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30506
+ *
30507
+ * Retrieves the user's current nonce from the DataPortabilityServers contract.
30508
+ *
30509
+ * @remarks
30510
+ * This method is deprecated in favor of more specific nonce methods that target
30511
+ * the appropriate contract for the operation being performed.
30512
+ *
30513
+ * @returns Promise resolving to the user's current nonce as a bigint
30514
+ * @throws {NonceError} When retrieving the nonce fails
30515
+ */
30069
30516
  private getUserNonce;
30070
30517
  /**
30071
30518
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
@@ -30081,6 +30528,16 @@ declare class PermissionsController {
30081
30528
  * console.log(`Current servers nonce: ${nonce}`);
30082
30529
  * ```
30083
30530
  */
30531
+ /**
30532
+ * Retrieves the user's current nonce from the DataPortabilityServers contract.
30533
+ *
30534
+ * @remarks
30535
+ * Used for server-related operations (trust/untrust) to prevent replay attacks.
30536
+ * The nonce must be incremented with each server operation.
30537
+ *
30538
+ * @returns Promise resolving to the user's current nonce as a bigint
30539
+ * @throws {NonceError} When retrieving the nonce fails
30540
+ */
30084
30541
  private getServersUserNonce;
30085
30542
  /**
30086
30543
  * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
@@ -30096,6 +30553,16 @@ declare class PermissionsController {
30096
30553
  * console.log(`Current permissions nonce: ${nonce}`);
30097
30554
  * ```
30098
30555
  */
30556
+ /**
30557
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
30558
+ *
30559
+ * @remarks
30560
+ * Used for permission-related operations (grant/revoke) to prevent replay attacks.
30561
+ * The nonce must be incremented with each permission operation.
30562
+ *
30563
+ * @returns Promise resolving to the user's current nonce as a bigint
30564
+ * @throws {NonceError} When retrieving the nonce fails
30565
+ */
30099
30566
  private getPermissionsUserNonce;
30100
30567
  /**
30101
30568
  * Composes the EIP-712 typed data for PermissionGrant (new simplified format).
@@ -30117,6 +30584,7 @@ declare class PermissionsController {
30117
30584
  * @param params.granteeId - Grantee ID
30118
30585
  * @param params.grant - Grant URL or grant data
30119
30586
  * @param params.fileUrls - Array of file URLs
30587
+ * @param params.schemaIds - Schema IDs for each file
30120
30588
  * @param params.serverAddress - Server address
30121
30589
  * @param params.serverUrl - Server URL
30122
30590
  * @param params.serverPublicKey - Server public key
@@ -30222,7 +30690,7 @@ declare class PermissionsController {
30222
30690
  * console.log('Now trusting servers:', trustedServers);
30223
30691
  * ```
30224
30692
  */
30225
- addAndTrustServer(params: AddAndTrustServerParams): Promise<Hash>;
30693
+ addAndTrustServer(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30226
30694
  /**
30227
30695
  * Trusts a server for data processing (legacy method).
30228
30696
  *
@@ -30230,14 +30698,14 @@ declare class PermissionsController {
30230
30698
  * @returns Promise resolving to transaction hash
30231
30699
  * @deprecated Use addAndTrustServer instead
30232
30700
  */
30233
- submitTrustServer(params: TrustServerParams): Promise<Hash>;
30701
+ submitTrustServer(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30234
30702
  /**
30235
30703
  * Adds and trusts a server using a signature (gasless transaction).
30236
30704
  *
30237
30705
  * @param params - Parameters for adding and trusting the server
30238
- * @returns Promise resolving to transaction hash
30706
+ * @returns Promise resolving to TransactionHandle with ServerTrustResult event data
30239
30707
  */
30240
- submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<Hash>;
30708
+ submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30241
30709
  /**
30242
30710
  * Trusts a server using a signature (gasless transaction - legacy method).
30243
30711
  *
@@ -30251,13 +30719,24 @@ declare class PermissionsController {
30251
30719
  * @throws {ServerUrlMismatchError} When server URL doesn't match existing registration
30252
30720
  * @throws {BlockchainError} When trust operation fails for any other reason
30253
30721
  */
30254
- submitTrustServerWithSignature(params: TrustServerParams): Promise<Hash>;
30722
+ submitTrustServerWithSignature(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30255
30723
  /**
30256
30724
  * Submits a direct untrust server transaction (without signature).
30257
30725
  *
30258
30726
  * @param params - The untrust server parameters containing server details
30259
30727
  * @returns Promise resolving to the transaction hash
30260
30728
  */
30729
+ /**
30730
+ * Submits an untrust server transaction directly to the blockchain.
30731
+ *
30732
+ * @remarks
30733
+ * Internal method used for direct blockchain submission of untrust server operations
30734
+ * when relayer callbacks are not available.
30735
+ *
30736
+ * @param params - The untrust server parameters
30737
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30738
+ * @throws {BlockchainError} When contract submission fails
30739
+ */
30261
30740
  private submitDirectUntrustTransaction;
30262
30741
  /**
30263
30742
  * Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
@@ -30287,7 +30766,7 @@ declare class PermissionsController {
30287
30766
  * console.log('Still trusting servers:', trustedServers);
30288
30767
  * ```
30289
30768
  */
30290
- submitUntrustServer(params: UntrustServerParams): Promise<Hash>;
30769
+ submitUntrustServer(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
30291
30770
  /**
30292
30771
  * Untrusts a server using a signature (gasless transaction).
30293
30772
  *
@@ -30300,7 +30779,7 @@ declare class PermissionsController {
30300
30779
  * @throws {RelayerError} When gasless submission fails
30301
30780
  * @throws {BlockchainError} When untrust transaction fails
30302
30781
  */
30303
- submitUntrustServerWithSignature(params: UntrustServerParams): Promise<Hash>;
30782
+ submitUntrustServerWithSignature(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
30304
30783
  /**
30305
30784
  * Retrieves all servers trusted by a user from the DataPortabilityServers contract.
30306
30785
  *
@@ -30351,22 +30830,60 @@ declare class PermissionsController {
30351
30830
  /**
30352
30831
  * Gets server information for multiple servers efficiently.
30353
30832
  *
30354
- * @param serverIds - Array of server IDs to query
30355
- * @returns Promise resolving to batch result with successes and failures
30833
+ * @remarks
30834
+ * This method uses multicall to fetch information for multiple servers in a single
30835
+ * blockchain call, improving performance when querying many servers. Failed lookups
30836
+ * are returned separately for error handling.
30837
+ *
30838
+ * @param serverIds - Array of numeric server IDs to query
30839
+ * @returns Promise resolving to batch result containing successful lookups and failed IDs
30356
30840
  * @throws {BlockchainError} When reading from contract fails or chain is unavailable
30841
+ * @example
30842
+ * ```typescript
30843
+ * const result = await vana.permissions.getServerInfoBatch([1, 2, 3, 999]);
30844
+ *
30845
+ * // Process successful lookups
30846
+ * result.servers.forEach((server, id) => {
30847
+ * console.log(`Server ${id}: ${server.url}`);
30848
+ * });
30849
+ *
30850
+ * // Handle failed lookups
30851
+ * if (result.failed.length > 0) {
30852
+ * console.log(`Failed to fetch: ${result.failed.join(', ')}`);
30853
+ * }
30854
+ * ```
30357
30855
  */
30358
30856
  getServerInfoBatch(serverIds: number[]): Promise<BatchServerInfoResult>;
30359
30857
  /**
30360
30858
  * Checks whether a specific server is trusted by a user.
30361
30859
  *
30362
- * @param serverId - Server ID to check (numeric)
30860
+ * @remarks
30861
+ * This method queries the user's trusted server list and checks if the specified
30862
+ * server is present. Returns both the trust status and the index in the trust list
30863
+ * if trusted.
30864
+ *
30865
+ * @param serverId - Numeric server ID to check
30363
30866
  * @param userAddress - Optional user address (defaults to current user)
30364
- * @returns Promise resolving to server trust status
30867
+ * @returns Promise resolving to server trust status with trust index if applicable
30868
+ * @throws {BlockchainError} When reading from contract fails
30869
+ * @example
30870
+ * ```typescript
30871
+ * const status = await vana.permissions.checkServerTrustStatus(1);
30872
+ * if (status.isTrusted) {
30873
+ * console.log(`Server is trusted at index ${status.trustIndex}`);
30874
+ * } else {
30875
+ * console.log('Server is not trusted');
30876
+ * }
30877
+ * ```
30365
30878
  */
30366
30879
  checkServerTrustStatus(serverId: number, userAddress?: Address): Promise<ServerTrustStatus>;
30367
30880
  /**
30368
30881
  * Composes EIP-712 typed data for AddAndTrustServer.
30369
30882
  *
30883
+ * @remarks
30884
+ * Creates the complete typed data structure required for EIP-712 signature generation
30885
+ * when adding and trusting a new server in a single transaction.
30886
+ *
30370
30887
  * @param input - The add and trust server input data containing server details
30371
30888
  * @returns Promise resolving to the typed data structure for server add and trust
30372
30889
  */
@@ -30448,7 +30965,7 @@ declare class PermissionsController {
30448
30965
  * console.log(`Grantee registered in transaction: ${txHash}`);
30449
30966
  * ```
30450
30967
  */
30451
- submitRegisterGrantee(params: RegisterGranteeParams): Promise<Hash>;
30968
+ submitRegisterGrantee(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
30452
30969
  /**
30453
30970
  * Registers a grantee with a signature (gasless transaction)
30454
30971
  *
@@ -30464,7 +30981,7 @@ declare class PermissionsController {
30464
30981
  * });
30465
30982
  * ```
30466
30983
  */
30467
- submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<Hash>;
30984
+ submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
30468
30985
  /**
30469
30986
  * Submits a signed register grantee transaction via relayer
30470
30987
  *
@@ -30477,7 +30994,7 @@ declare class PermissionsController {
30477
30994
  * const result = await vana.permissions.submitSignedRegisterGrantee(typedData, signature);
30478
30995
  * ```
30479
30996
  */
30480
- submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<Hash>;
30997
+ submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<TransactionHandle<GranteeRegisterResult>>;
30481
30998
  /**
30482
30999
  * Retrieves all registered grantees from the DataPortabilityGrantees contract.
30483
31000
  *
@@ -30764,7 +31281,7 @@ declare class PermissionsController {
30764
31281
  * @param url - New URL for the server
30765
31282
  * @returns Promise resolving to transaction hash
30766
31283
  */
30767
- submitUpdateServer(serverId: bigint, url: string): Promise<Hash>;
31284
+ submitUpdateServer(serverId: bigint, url: string): Promise<TransactionHandle<ServerUpdateResult>>;
30768
31285
  /**
30769
31286
  * Get all permission IDs for a user
30770
31287
  *
@@ -30804,49 +31321,106 @@ declare class PermissionsController {
30804
31321
  * @throws {BlockchainError} When permission addition fails
30805
31322
  * @throws {NetworkError} When network communication fails
30806
31323
  */
30807
- submitAddPermission(params: ServerFilesAndPermissionParams): Promise<Hash>;
31324
+ submitAddPermission(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
30808
31325
  /**
30809
31326
  * Submits an already-signed add permission transaction to the blockchain.
30810
31327
  * This method supports both relayer-based gasless transactions and direct transactions.
30811
31328
  *
30812
31329
  * @param typedData - The EIP-712 typed data for AddPermission
30813
31330
  * @param signature - The user's signature
30814
- * @returns Promise resolving to the transaction hash
31331
+ * @returns Promise resolving to TransactionHandle with PermissionGrantResult event data
30815
31332
  * @throws {RelayerError} When gasless transaction submission fails
30816
31333
  * @throws {BlockchainError} When permission addition fails
30817
31334
  * @throws {NetworkError} When network communication fails
30818
31335
  */
30819
- submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
31336
+ submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
30820
31337
  /**
30821
- * Submit server files and permissions with signature to the blockchain (supports gasless transactions)
31338
+ * Submits server files and permissions with signature to the blockchain, supporting schema validation and gasless transactions.
31339
+ *
31340
+ * @remarks
31341
+ * This method validates files against their specified schemas before submission.
31342
+ * Schema validation ensures data conforms to expected formats before on-chain registration.
31343
+ * Files with schemaId = 0 bypass validation. The method supports atomic batch operations
31344
+ * where all files and permissions are registered in a single transaction.
30822
31345
  *
30823
31346
  * @param params - Parameters for adding server files and permissions
30824
- * @returns Promise resolving to transaction hash
30825
- * @throws {RelayerError} When gasless transaction submission fails
31347
+ * @param params.granteeId - The ID of the permission grantee
31348
+ * @param params.grant - Grant URL containing permission parameters (typically IPFS)
31349
+ * @param params.fileUrls - Array of file URLs to register
31350
+ * @param params.schemaIds - Schema IDs for each file. Use 0 for files without schema validation.
31351
+ * Array length must match fileUrls length.
31352
+ * @param params.serverAddress - Server wallet address for decryption permissions
31353
+ * @param params.serverUrl - Server endpoint URL
31354
+ * @param params.serverPublicKey - Server's public key for encryption.
31355
+ * Obtain via `vana.server.getIdentity(userAddress).public_key`.
31356
+ * @param params.filePermissions - Nested array of permissions for each file
31357
+ * @returns TransactionHandle with immediate hash access and event parsing capability
31358
+ * @throws {Error} When schemaIds array length doesn't match fileUrls array length
31359
+ * @throws {SchemaValidationError} When file data doesn't match the specified schema.
31360
+ * Verify data structure matches schema definition from `vana.schemas.get(schemaId)`.
31361
+ * @throws {RelayerError} When gasless transaction submission fails.
31362
+ * Retry without relayer configuration to submit direct transaction.
30826
31363
  * @throws {SignatureError} When user rejects the signature request
30827
31364
  * @throws {BlockchainError} When server files and permissions addition fails
30828
- * @throws {NetworkError} When network communication fails
31365
+ * @throws {NetworkError} When network communication fails.
31366
+ * Check network connection or configure alternative gateways.
31367
+ *
31368
+ * @example
31369
+ * ```typescript
31370
+ * const result = await vana.permissions.submitAddServerFilesAndPermissions({
31371
+ * granteeId: BigInt(1),
31372
+ * grant: "ipfs://QmXxx...",
31373
+ * fileUrls: ["https://storage.example.com/data.json"],
31374
+ * schemaIds: [123], // LinkedIn profile schema ID
31375
+ * serverAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
31376
+ * serverUrl: "https://server.example.com",
31377
+ * serverPublicKey: serverInfo.public_key,
31378
+ * filePermissions: [[{
31379
+ * account: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
31380
+ * key: encryptedKey
31381
+ * }]]
31382
+ * });
31383
+ * const events = await result.waitForEvents();
31384
+ * console.log(`Permission ID: ${events.permissionId}`);
31385
+ * ```
30829
31386
  */
30830
- submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<Hash>;
31387
+ submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
30831
31388
  /**
30832
31389
  * Submits an already-signed add server files and permissions transaction to the blockchain.
30833
- * This method supports both relayer-based gasless transactions and direct transactions.
31390
+ *
31391
+ * @remarks
31392
+ * This method returns a TransactionHandle that provides immediate access to the transaction hash
31393
+ * while allowing lazy-loaded access to parsed event data. Use `waitForEvents()` to retrieve
31394
+ * the permission ID and other event details after transaction confirmation.
30834
31395
  *
30835
31396
  * @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
30836
31397
  * @param signature - The user's signature
30837
- * @returns Promise resolving to the transaction hash
31398
+ * @returns TransactionHandle with immediate hash access and optional event parsing
30838
31399
  * @throws {RelayerError} When gasless transaction submission fails
30839
31400
  * @throws {BlockchainError} When server files and permissions addition fails
30840
31401
  * @throws {NetworkError} When network communication fails
31402
+ *
31403
+ * @example
31404
+ * ```typescript
31405
+ * const tx = await vana.permissions.submitSignedAddServerFilesAndPermissions(
31406
+ * typedData,
31407
+ * signature
31408
+ * );
31409
+ * console.log(`Transaction submitted: ${tx.hash}`);
31410
+ *
31411
+ * // Wait for confirmation and get the permission ID
31412
+ * const { permissionId } = await tx.waitForEvents();
31413
+ * console.log(`Permission created with ID: ${permissionId}`);
31414
+ * ```
30841
31415
  */
30842
- submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<Hash>;
31416
+ submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
30843
31417
  /**
30844
31418
  * Submit permission revocation with signature to the blockchain
30845
31419
  *
30846
31420
  * @param permissionId - Permission ID to revoke
30847
31421
  * @returns Promise resolving to transaction hash
30848
31422
  */
30849
- submitRevokePermission(permissionId: bigint): Promise<Hash>;
31423
+ submitRevokePermission(permissionId: bigint): Promise<TransactionHandle<PermissionRevokeResult>>;
30850
31424
  /**
30851
31425
  * Submits a signed add permission transaction directly to the blockchain.
30852
31426
  *
@@ -30876,10 +31450,10 @@ declare class PermissionsController {
30876
31450
  interface CreateSchemaParams {
30877
31451
  /** The name of the schema */
30878
31452
  name: string;
30879
- /** The type/category of the schema */
30880
- type: string;
31453
+ /** The dialect of the schema (e.g., 'json' or 'sqlite') */
31454
+ dialect: "json" | "sqlite";
30881
31455
  /** The schema definition object or JSON string */
30882
- definition: object | string;
31456
+ schema: object | string;
30883
31457
  }
30884
31458
  /**
30885
31459
  * Result of creating a new schema.
@@ -30924,8 +31498,8 @@ interface CreateSchemaResult {
30924
31498
  * // Create a new schema with automatic IPFS upload
30925
31499
  * const result = await vana.schemas.create({
30926
31500
  * name: "User Profile",
30927
- * type: "personal",
30928
- * definition: {
31501
+ * dialect: "json",
31502
+ * schema: {
30929
31503
  * type: "object",
30930
31504
  * properties: {
30931
31505
  * name: { type: "string" },
@@ -30960,7 +31534,7 @@ declare class SchemaController {
30960
31534
  * - Uploads the definition to IPFS to generate a permanent URL
30961
31535
  * - Registers the schema on the blockchain with the generated URL
30962
31536
  *
30963
- * @param params - Schema creation parameters including name, type, and definition
31537
+ * @param params - Schema creation parameters including name, dialect, and definition
30964
31538
  * @returns Promise resolving to creation results with schema ID and transaction hash
30965
31539
  * @throws {SchemaValidationError} When the schema definition is invalid
30966
31540
  * @throws {Error} When IPFS upload or blockchain registration fails
@@ -30969,8 +31543,8 @@ declare class SchemaController {
30969
31543
  * // Create a JSON schema for user profiles
30970
31544
  * const result = await vana.schemas.create({
30971
31545
  * name: "User Profile",
30972
- * type: "personal",
30973
- * definition: {
31546
+ * dialect: "json",
31547
+ * schema: {
30974
31548
  * type: "object",
30975
31549
  * properties: {
30976
31550
  * name: { type: "string" },
@@ -30985,42 +31559,66 @@ declare class SchemaController {
30985
31559
  */
30986
31560
  create(params: CreateSchemaParams): Promise<CreateSchemaResult>;
30987
31561
  /**
30988
- * Retrieves a schema by its ID.
31562
+ * Retrieves a complete schema by its ID with definition fetched and flattened.
30989
31563
  *
30990
31564
  * @param schemaId - The ID of the schema to retrieve
30991
- * @returns Promise resolving to the schema object
30992
- * @throws {Error} When the schema is not found or chain is unavailable
31565
+ * @param options - Optional parameters
31566
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
31567
+ * @returns Promise resolving to the complete schema object with all fields populated
31568
+ * @throws {Error} When the schema is not found, definition cannot be fetched, or chain is unavailable
30993
31569
  * @example
30994
31570
  * ```typescript
30995
31571
  * const schema = await vana.schemas.get(1);
30996
- * console.log(`Schema: ${schema.name} (${schema.type})`);
31572
+ * console.log(`Schema: ${schema.name} (${schema.dialect})`);
31573
+ * console.log(`Version: ${schema.version}`);
31574
+ * console.log(`Description: ${schema.description}`);
31575
+ * console.log('Schema:', schema.schema);
31576
+ *
31577
+ * // Use directly with validator (schema has all required fields)
31578
+ * validator.validateDataAgainstSchema(data, schema);
30997
31579
  * ```
30998
31580
  */
30999
- get(schemaId: number): Promise<Schema>;
31581
+ get(schemaId: number, options?: {
31582
+ subgraphUrl?: string;
31583
+ }): Promise<CompleteSchema>;
31000
31584
  /**
31001
31585
  * Gets the total number of schemas registered on the network.
31002
31586
  *
31587
+ * @param options - Optional parameters
31588
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
31003
31589
  * @returns Promise resolving to the total schema count
31004
31590
  * @throws {Error} When the count cannot be retrieved
31005
31591
  * @example
31006
31592
  * ```typescript
31007
31593
  * const count = await vana.schemas.count();
31008
31594
  * console.log(`Total schemas: ${count}`);
31595
+ *
31596
+ * // With custom subgraph
31597
+ * const count = await vana.schemas.count({
31598
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
31599
+ * });
31009
31600
  * ```
31010
31601
  */
31011
- count(): Promise<number>;
31602
+ count(options?: {
31603
+ subgraphUrl?: string;
31604
+ }): Promise<number>;
31012
31605
  /**
31013
31606
  * Lists all schemas with pagination.
31014
31607
  *
31015
31608
  * @param options - Optional parameters for listing schemas
31016
31609
  * @param options.limit - Maximum number of schemas to return
31017
31610
  * @param options.offset - Number of schemas to skip
31611
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
31612
+ * @param options.includeDefinitions - Whether to fetch and include schema definitions (default: false for performance)
31018
31613
  * @returns Promise resolving to an array of schemas
31019
31614
  * @example
31020
31615
  * ```typescript
31021
- * // Get all schemas
31616
+ * // Get all schemas (without definitions for performance)
31022
31617
  * const schemas = await vana.schemas.list();
31023
31618
  *
31619
+ * // Get schemas with definitions
31620
+ * const schemas = await vana.schemas.list({ includeDefinitions: true });
31621
+ *
31024
31622
  * // Get schemas with pagination
31025
31623
  * const schemas = await vana.schemas.list({ limit: 10, offset: 0 });
31026
31624
  * ```
@@ -31028,6 +31626,8 @@ declare class SchemaController {
31028
31626
  list(options?: {
31029
31627
  limit?: number;
31030
31628
  offset?: number;
31629
+ subgraphUrl?: string;
31630
+ includeDefinitions?: boolean;
31031
31631
  }): Promise<Schema[]>;
31032
31632
  /**
31033
31633
  * Adds a schema using the legacy method (low-level API).
@@ -31037,6 +31637,36 @@ declare class SchemaController {
31037
31637
  * @returns Promise resolving to the add schema result
31038
31638
  */
31039
31639
  addSchema(params: AddSchemaParams): Promise<AddSchemaResult>;
31640
+ /**
31641
+ * Internal method: Query schema via subgraph
31642
+ *
31643
+ * @param params - Query parameters
31644
+ * @param params.schemaId - The ID of the schema to retrieve
31645
+ * @param params.subgraphUrl - The subgraph URL to query
31646
+ * @returns Promise resolving to the schema object
31647
+ * @private
31648
+ */
31649
+ private _getSchemaViaSubgraph;
31650
+ /**
31651
+ * Internal method: List schemas via subgraph
31652
+ *
31653
+ * @param params - Query parameters
31654
+ * @param params.limit - Maximum number of schemas to return
31655
+ * @param params.offset - Number of schemas to skip
31656
+ * @param params.subgraphUrl - The subgraph URL to query
31657
+ * @returns Promise resolving to an array of schemas
31658
+ * @private
31659
+ */
31660
+ private _listSchemasViaSubgraph;
31661
+ /**
31662
+ * Internal method: Count schemas via subgraph
31663
+ *
31664
+ * @param params - Query parameters
31665
+ * @param params.subgraphUrl - The subgraph URL to query
31666
+ * @returns Promise resolving to the total schema count
31667
+ * @private
31668
+ */
31669
+ private _countSchemasViaSubgraph;
31040
31670
  /**
31041
31671
  * Gets the user's wallet address.
31042
31672
  *
@@ -31044,6 +31674,13 @@ declare class SchemaController {
31044
31674
  * @returns Promise resolving to the user's address
31045
31675
  */
31046
31676
  private getUserAddress;
31677
+ /**
31678
+ * Fetches and attaches definitions to an array of schemas.
31679
+ *
31680
+ * @param schemas - Array of schemas to fetch definitions for
31681
+ * @private
31682
+ */
31683
+ private _fetchDefinitionsForSchemas;
31047
31684
  }
31048
31685
 
31049
31686
  /**
@@ -31085,16 +31722,16 @@ declare class SchemaValidationError extends Error {
31085
31722
  }>);
31086
31723
  }
31087
31724
  /**
31088
- * Schema validation utility class
31725
+ * Data schema validation utility class
31089
31726
  */
31090
31727
  declare class SchemaValidator {
31091
31728
  private ajv;
31092
31729
  private dataSchemaValidator;
31093
31730
  constructor();
31094
31731
  /**
31095
- * Validates a data schema against the Vana meta-schema
31732
+ * Validates a data schema definition against the Vana meta-schema
31096
31733
  *
31097
- * @param schema - The data schema to validate
31734
+ * @param schema - The data schema definition to validate
31098
31735
  * @throws SchemaValidationError if invalid
31099
31736
  * @example
31100
31737
  * ```typescript
@@ -31113,39 +31750,35 @@ declare class SchemaValidator {
31113
31750
  * }
31114
31751
  * };
31115
31752
  *
31116
- * validator.validateDataSchema(schema); // throws if invalid
31753
+ * validator.validateDataSchemaAgainstMetaSchema(schema); // throws if invalid
31117
31754
  * ```
31118
31755
  */
31119
- validateDataSchema(schema: unknown): asserts schema is DataSchema;
31756
+ validateDataSchemaAgainstMetaSchema(schema: unknown): asserts schema is DataSchema;
31120
31757
  /**
31121
- * Validates data against a JSON Schema from a data schema
31758
+ * Validates data against a JSON Schema
31122
31759
  *
31123
31760
  * @param data - The data to validate
31124
- * @param schema - The data schema containing the schema
31761
+ * @param schema - The schema containing the validation rules (must have been validated or fetched from chain)
31125
31762
  * @throws SchemaValidationError if invalid
31126
31763
  * @example
31127
31764
  * ```typescript
31128
31765
  * const validator = new SchemaValidator();
31129
31766
  *
31130
- * const schema = {
31767
+ * // Works with Schema from schemas.get()
31768
+ * const schema = await vana.schemas.get(1);
31769
+ * validator.validateDataAgainstSchema(userData, schema);
31770
+ *
31771
+ * // Also works with pre-validated DataSchema object
31772
+ * const dataSchema = validator.validateDataSchemaAgainstMetaSchema({
31131
31773
  * name: "User Profile",
31132
31774
  * version: "1.0.0",
31133
31775
  * dialect: "json",
31134
- * schema: {
31135
- * type: "object",
31136
- * properties: {
31137
- * name: { type: "string" },
31138
- * age: { type: "number" }
31139
- * },
31140
- * required: ["name"]
31141
- * }
31142
- * };
31143
- *
31144
- * const userData = { name: "Alice", age: 30 };
31145
- * validator.validateDataAgainstSchema(userData, schema);
31776
+ * schema: { type: "object", properties: { name: { type: "string" } } }
31777
+ * });
31778
+ * validator.validateDataAgainstSchema(userData, dataSchema);
31146
31779
  * ```
31147
31780
  */
31148
- validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
31781
+ validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
31149
31782
  /**
31150
31783
  * Validates a SQLite DDL string for basic syntax
31151
31784
  * Note: This is a basic validation, full SQL parsing would require a proper SQL parser
@@ -31156,9 +31789,9 @@ declare class SchemaValidator {
31156
31789
  */
31157
31790
  validateSQLiteDDL(ddl: string, dialectVersion?: string): void;
31158
31791
  /**
31159
- * Fetches and validates a schema from a URL
31792
+ * Fetches and validates a data schema from a URL
31160
31793
  *
31161
- * @param url - The URL to fetch the schema from
31794
+ * @param url - The URL to fetch the data schema from
31162
31795
  * @returns The validated data schema
31163
31796
  * @throws SchemaValidationError if invalid or fetch fails
31164
31797
  * @example
@@ -31174,13 +31807,24 @@ declare class SchemaValidator {
31174
31807
  */
31175
31808
  declare const schemaValidator: SchemaValidator;
31176
31809
  /**
31177
- * Convenience function to validate a data schema
31810
+ * Convenience function to validate a data schema definition against the Vana meta-schema
31178
31811
  *
31179
- * @param schema - The data schema to validate
31180
- * @returns void - Assertion function that doesn't return a value
31812
+ * @param schema - The data schema definition to validate
31813
+ * @returns The validated DataSchema
31181
31814
  * @throws SchemaValidationError if invalid
31815
+ * @example
31816
+ * ```typescript
31817
+ * const schemaDefinition = {
31818
+ * name: "User Profile",
31819
+ * version: "1.0.0",
31820
+ * dialect: "json",
31821
+ * schema: { type: "object", properties: { name: { type: "string" } } }
31822
+ * };
31823
+ *
31824
+ * const validatedSchema = validateDataSchemaAgainstMetaSchema(schemaDefinition);
31825
+ * ```
31182
31826
  */
31183
- declare function validateDataSchema(schema: unknown): asserts schema is DataSchema;
31827
+ declare function validateDataSchemaAgainstMetaSchema(schema: unknown): DataSchema;
31184
31828
  /**
31185
31829
  * Convenience function to validate data against a schema
31186
31830
  *
@@ -31189,11 +31833,11 @@ declare function validateDataSchema(schema: unknown): asserts schema is DataSche
31189
31833
  * @returns void - Function doesn't return a value
31190
31834
  * @throws SchemaValidationError if invalid
31191
31835
  */
31192
- declare function validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
31836
+ declare function validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
31193
31837
  /**
31194
- * Convenience function to fetch and validate a schema from a URL
31838
+ * Convenience function to fetch and validate a data schema from a URL
31195
31839
  *
31196
- * @param url - The URL to fetch the schema from
31840
+ * @param url - The URL to fetch the data schema from
31197
31841
  * @returns The validated data schema
31198
31842
  * @throws SchemaValidationError if invalid or fetch fails
31199
31843
  */
@@ -33685,19 +34329,101 @@ declare class DataController {
33685
34329
  subgraphUrl?: string;
33686
34330
  }): Promise<UserFile$1[]>;
33687
34331
  /**
33688
- * Retrieves a list of permissions granted by a user using the new subgraph entities.
34332
+ * Fetches proof data for multiple files from the subgraph.
33689
34333
  *
33690
- * This method queries the Vana subgraph to find permissions directly granted by the user
33691
- * using the new Permission entity. It efficiently handles millions of permissions by:
33692
- * 1. Querying the subgraph for user's directly granted permissions
33693
- * 2. Returning complete permission information from subgraph
33694
- * 3. No need for additional contract calls as all data comes from subgraph
34334
+ * @private
34335
+ * @param fileIds - Array of file IDs to fetch proofs for
34336
+ * @param subgraphUrl - The subgraph endpoint URL
34337
+ * @returns Map of file IDs to their associated DLP IDs
34338
+ */
34339
+ private _fetchProofsFromSubgraph;
34340
+ /**
34341
+ * Fetches proof data for multiple files from the blockchain.
34342
+ * Falls back to this when subgraph is unavailable.
34343
+ *
34344
+ * @private
34345
+ * @param fileIds - Array of file IDs to fetch proofs for
34346
+ * @returns Map of file IDs to their associated DLP IDs
34347
+ */
34348
+ private _fetchProofsFromChain;
34349
+ /**
34350
+ * Retrieves information about a specific Data Liquidity Pool (DLP).
34351
+ *
34352
+ * @remarks
34353
+ * DLPs are entities that process and verify data files in the Vana network.
34354
+ * This method fetches DLP metadata including name, status, and performance rating.
34355
+ * Uses subgraph first for efficiency, falls back to chain if unavailable.
34356
+ *
34357
+ * @param dlpId - The unique identifier of the DLP
34358
+ * @param options - Optional parameters
34359
+ * @param options.subgraphUrl - Custom subgraph URL to override default
34360
+ * @returns Promise resolving to DLP information
34361
+ * @throws {Error} When DLP cannot be found - "DLP not found: {dlpId}"
34362
+ * @throws {Error} When query fails - "Failed to fetch DLP: {error}"
34363
+ * @example
34364
+ * ```typescript
34365
+ * const dlp = await vana.data.getDLP(26);
34366
+ * console.log(`DLP ${dlp.name}: ${dlp.status}`);
34367
+ * ```
34368
+ */
34369
+ getDLP(dlpId: number, options?: {
34370
+ subgraphUrl?: string;
34371
+ }): Promise<{
34372
+ id: number;
34373
+ name: string;
34374
+ metadata?: string;
34375
+ status?: number;
34376
+ address?: Address;
34377
+ owner?: Address;
34378
+ }>;
34379
+ /**
34380
+ * Lists all Data Liquidity Pools (DLPs) with optional pagination.
34381
+ *
34382
+ * @remarks
34383
+ * Fetches a paginated list of all DLPs registered in the network.
34384
+ * Uses subgraph for efficient querying with fallback to chain multicall.
34385
+ *
34386
+ * @param options - Optional parameters for pagination and filtering
34387
+ * @param options.limit - Maximum number of DLPs to return (default: 100)
34388
+ * @param options.offset - Number of DLPs to skip (default: 0)
34389
+ * @param options.subgraphUrl - Custom subgraph URL to override default
34390
+ * @returns Promise resolving to array of DLP information
34391
+ * @throws {Error} When query fails - "Failed to list DLPs: {error}"
34392
+ * @example
34393
+ * ```typescript
34394
+ * // Get first 10 DLPs
34395
+ * const dlps = await vana.data.listDLPs({ limit: 10 });
34396
+ * dlps.forEach(dlp => console.log(`${dlp.id}: ${dlp.name}`));
34397
+ *
34398
+ * // Get next page
34399
+ * const nextPage = await vana.data.listDLPs({ limit: 10, offset: 10 });
34400
+ * ```
34401
+ */
34402
+ listDLPs(options?: {
34403
+ limit?: number;
34404
+ offset?: number;
34405
+ subgraphUrl?: string;
34406
+ }): Promise<Array<{
34407
+ id: number;
34408
+ name: string;
34409
+ metadata?: string;
34410
+ status?: number;
34411
+ address?: Address;
34412
+ owner?: Address;
34413
+ }>>;
34414
+ /**
34415
+ * Retrieves a list of permissions granted by a user.
34416
+ *
34417
+ * This method supports automatic fallback between subgraph and RPC modes:
34418
+ * - If subgraph URL is available, tries subgraph query first
34419
+ * - Falls back to direct contract queries via RPC if subgraph fails
34420
+ * - RPC mode uses gasAwareMulticall for efficient batch queries
33695
34421
  *
33696
34422
  * @param params - Object containing the user address and optional subgraph URL
33697
34423
  * @param params.user - The wallet address of the user to query permissions for
33698
34424
  * @param params.subgraphUrl - Optional subgraph URL to override the default
33699
34425
  * @returns Promise resolving to an array of permission objects
33700
- * @throws Error if subgraph is unavailable or returns invalid data
34426
+ * @throws Error if both subgraph and RPC queries fail
33701
34427
  */
33702
34428
  getUserPermissions(params: {
33703
34429
  user: Address;
@@ -33713,43 +34439,59 @@ declare class DataController {
33713
34439
  user: Address;
33714
34440
  }>>;
33715
34441
  /**
33716
- * Retrieves a list of trusted servers for a user using the new subgraph entities.
34442
+ * Internal method: Query user permissions via subgraph
34443
+ *
34444
+ * @param params - Query parameters object
34445
+ * @param params.user - The user address to query permissions for
34446
+ * @param params.subgraphUrl - The subgraph URL endpoint to query
34447
+ * @returns Promise resolving to an array of permission objects
34448
+ */
34449
+ private _getUserPermissionsViaSubgraph;
34450
+ /**
34451
+ * Internal method: Query user permissions via direct RPC
33717
34452
  *
33718
- * This method queries the Vana subgraph to find trusted servers directly associated with the user
33719
- * with support for both subgraph and direct RPC queries.
34453
+ * @param params - Query parameters object
34454
+ * @param params.user - The user address to query permissions for
34455
+ * @returns Promise resolving to an array of permission objects
34456
+ */
34457
+ private _getUserPermissionsViaRpc;
34458
+ /**
34459
+ * Retrieves a list of trusted servers for a user.
33720
34460
  *
33721
- * This method supports multiple query modes:
33722
- * - 'subgraph': Fast query via subgraph (requires subgraphUrl)
33723
- * - 'rpc': Direct contract queries (slower but no external dependencies)
33724
- * - 'auto': Try subgraph first, fallback to RPC if unavailable
34461
+ * This method supports automatic fallback between subgraph and RPC modes:
34462
+ * - If subgraph URL is available, tries subgraph query first for fast results
34463
+ * - Falls back to direct contract queries via RPC if subgraph fails
34464
+ * - RPC mode uses gasAwareMulticall for efficient batch queries
33725
34465
  *
33726
- * @param params - Query parameters including user address and mode selection
33727
- * @returns Promise resolving to trusted servers with metadata about the query
33728
- * @throws Error if query fails in both modes (when using 'auto')
34466
+ * @param params - Query parameters including user address and optional pagination
34467
+ * @param params.user - The wallet address of the user to query trusted servers for
34468
+ * @param params.subgraphUrl - Optional subgraph URL to override the default
34469
+ * @param params.limit - Maximum number of results to return (default: 50)
34470
+ * @param params.offset - Number of results to skip for pagination (default: 0)
34471
+ * @returns Promise resolving to an array of trusted server objects
34472
+ * @throws Error if both subgraph and RPC queries fail
33729
34473
  * @example
33730
34474
  * ```typescript
33731
- * // Use subgraph for fast queries
33732
- * const result = await vana.data.getUserTrustedServers({
33733
- * user: '0x...',
33734
- * mode: 'subgraph',
33735
- * subgraphUrl: 'https://...'
34475
+ * // Basic usage with automatic fallback
34476
+ * const servers = await vana.data.getUserTrustedServers({
34477
+ * user: '0x...'
33736
34478
  * });
33737
34479
  *
33738
- * // Use direct RPC (no external dependencies)
33739
- * const result = await vana.data.getUserTrustedServers({
34480
+ * // With pagination
34481
+ * const servers = await vana.data.getUserTrustedServers({
33740
34482
  * user: '0x...',
33741
- * mode: 'rpc',
33742
- * limit: 10
34483
+ * limit: 10,
34484
+ * offset: 20
33743
34485
  * });
33744
34486
  *
33745
- * // Auto-fallback mode
33746
- * const result = await vana.data.getUserTrustedServers({
34487
+ * // With custom subgraph URL
34488
+ * const servers = await vana.data.getUserTrustedServers({
33747
34489
  * user: '0x...',
33748
- * mode: 'auto' // tries subgraph first, falls back to RPC
34490
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
33749
34491
  * });
33750
34492
  * ```
33751
34493
  */
33752
- getUserTrustedServers(params: GetUserTrustedServersParams): Promise<GetUserTrustedServersResult>;
34494
+ getUserTrustedServers(params: GetUserTrustedServersParams): Promise<TrustedServer[]>;
33753
34495
  /**
33754
34496
  * Internal method: Query trusted servers via subgraph
33755
34497
  *
@@ -33814,75 +34556,28 @@ declare class DataController {
33814
34556
  * for specific files by ID.
33815
34557
  */
33816
34558
  getFileById(fileId: number): Promise<UserFile$1>;
33817
- /**
33818
- * Uploads an encrypted file to storage and registers it on the blockchain.
33819
- *
33820
- * @deprecated Since v2.0.0 - Use vana.data.upload() instead for the high-level API with automatic encryption
33821
- *
33822
- * Migration guide:
33823
- * ```typescript
33824
- * // Old way (deprecated):
33825
- * const encrypted = await encryptBlob(data, key);
33826
- * const result = await vana.data.uploadEncryptedFile(encrypted, filename);
33827
- *
33828
- * // New way:
33829
- * const result = await vana.data.upload({
33830
- * content: data,
33831
- * filename: filename,
33832
- * encrypt: true // Handles encryption automatically
33833
- * });
33834
- * ```
33835
- * @param encryptedFile - The encrypted file blob to upload
33836
- * @param filename - Optional filename for the upload
33837
- * @param providerName - Optional storage provider to use
33838
- * @returns Promise resolving to upload result with file ID and storage URL
33839
- *
33840
- * This method handles the complete flow of:
33841
- * 1. Uploading the encrypted file to the specified storage provider
33842
- * 2. Registering the file URL on the DataRegistry contract via relayer
33843
- * 3. Returning the assigned file ID and storage URL
33844
- */
33845
- uploadEncryptedFile(encryptedFile: Blob, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
33846
- /**
33847
- * Uploads an encrypted file to storage and registers it on the blockchain with a schema.
33848
- *
33849
- * @deprecated Since v2.0.0 - Use vana.data.upload() instead for the high-level API with automatic encryption and schema validation
33850
- *
33851
- * Migration guide:
33852
- * ```typescript
33853
- * // Old way (deprecated):
33854
- * const encrypted = await encryptBlob(data, key);
33855
- * const result = await vana.data.uploadEncryptedFileWithSchema(encrypted, schemaId, filename);
33856
- *
33857
- * // New way:
33858
- * const result = await vana.data.upload({
33859
- * content: data,
33860
- * filename: filename,
33861
- * schemaId: schemaId, // Automatic validation
33862
- * encrypt: true
33863
- * });
33864
- * ```
33865
- * @param encryptedFile - The encrypted file blob to upload
33866
- * @param schemaId - The schema ID to associate with the file
33867
- * @param filename - Optional filename for the upload
33868
- * @param providerName - Optional storage provider to use
33869
- * @returns Promise resolving to upload result with file ID and storage URL
33870
- *
33871
- * This method handles the complete flow of:
33872
- * 1. Uploading the encrypted file to the specified storage provider
33873
- * 2. Registering the file URL on the DataRegistry contract with a schema ID
33874
- * 3. Returning the assigned file ID and storage URL
33875
- */
33876
- uploadEncryptedFileWithSchema(encryptedFile: Blob, schemaId: number, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
33877
34559
  /**
33878
34560
  * Registers a file URL directly on the blockchain with a schema ID.
33879
34561
  *
33880
- * @param url - The URL of the file to register
34562
+ * @remarks
34563
+ * This method registers an existing file URL on the DataRegistry contract
34564
+ * with a schema ID, without uploading any data. Useful when you have already
34565
+ * uploaded content to storage and just need to register it on-chain.
34566
+ *
34567
+ * @param url - The URL of the file to register (IPFS or HTTP/HTTPS)
33881
34568
  * @param schemaId - The schema ID to associate with the file
33882
34569
  * @returns Promise resolving to the file ID and transaction hash
33883
- *
33884
- * This method registers an existing file URL on the DataRegistry
33885
- * contract with a schema ID, without uploading any data.
34570
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34571
+ * @throws {Error} When wallet address is unavailable - "No addresses available"
34572
+ * @throws {Error} When transaction fails - "Failed to register file with schema"
34573
+ * @example
34574
+ * ```typescript
34575
+ * const { fileId, transactionHash } = await vana.data.registerFileWithSchema(
34576
+ * "ipfs://QmXxx...",
34577
+ * 1
34578
+ * );
34579
+ * console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
34580
+ * ```
33886
34581
  */
33887
34582
  registerFileWithSchema(url: string, schemaId: number): Promise<{
33888
34583
  fileId: number;
@@ -33940,95 +34635,114 @@ declare class DataController {
33940
34635
  transactionHash: string;
33941
34636
  }>;
33942
34637
  /**
33943
- * Adds a new schema to the DataRefinerRegistry.
33944
- *
33945
- * @deprecated Since v2.0.0 - Use vana.schemas.create() instead for the high-level API with automatic IPFS upload
34638
+ * Adds a new refiner to the DataRefinerRegistry.
33946
34639
  *
33947
- * Migration guide:
34640
+ * @remarks
34641
+ * Refiners are data processing templates that define how raw data should be
34642
+ * transformed into structured formats. Each refiner is associated with a DLP
34643
+ * (Data Liquidity Pool), has a specific schema for output, and includes
34644
+ * instructions for the refinement process.
34645
+ *
34646
+ * @param params - Refiner configuration parameters
34647
+ * @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
34648
+ * @param params.name - Human-readable name for the refiner
34649
+ * @param params.schemaId - Schema ID that defines the output format
34650
+ * @param params.refinementInstructionUrl - URL containing processing instructions
34651
+ * @returns Promise resolving to the new refiner ID and transaction hash
34652
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34653
+ * @throws {Error} When transaction fails - "Failed to add refiner: {error}"
34654
+ * @example
33948
34655
  * ```typescript
33949
- * // Old way (deprecated):
33950
- * const result = await vana.data.addSchema({
33951
- * name: "UserProfile",
33952
- * type: "JSON",
33953
- * definitionUrl: "ipfs://..."
33954
- * });
33955
- *
33956
- * // New way:
33957
- * const result = await vana.schemas.create({
33958
- * name: "UserProfile",
33959
- * type: "JSON",
33960
- * definition: schemaObject // Automatically uploads to IPFS
34656
+ * const result = await vana.data.addRefiner({
34657
+ * dlpId: 1,
34658
+ * name: "Social Media Sentiment Analyzer",
34659
+ * schemaId: 42,
34660
+ * refinementInstructionUrl: "ipfs://QmXxx..."
33961
34661
  * });
34662
+ * console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
33962
34663
  * ```
33963
- * @param params - Schema parameters including name, type, and definition URL
33964
- * @returns Promise resolving to the new schema ID and transaction hash
33965
34664
  */
33966
- addSchema(params: AddSchemaParams): Promise<AddSchemaResult>;
34665
+ addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
33967
34666
  /**
33968
- * Retrieves a schema by its ID.
34667
+ * Retrieves a refiner by its ID.
33969
34668
  *
33970
- * @deprecated Since v2.0.0 - Use vana.schemas.get() instead
34669
+ * @remarks
34670
+ * Queries the DataRefinerRegistry contract to get complete information about
34671
+ * a specific refiner including its DLP association, schema, and instructions.
33971
34672
  *
33972
- * Migration guide:
34673
+ * @param refinerId - The numeric refiner ID to retrieve
34674
+ * @returns Promise resolving to the refiner information object
34675
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34676
+ * @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
34677
+ * @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
34678
+ * @example
33973
34679
  * ```typescript
33974
- * // Old way (deprecated):
33975
- * const schema = await vana.data.getSchema(schemaId);
33976
- *
33977
- * // New way:
33978
- * const schema = await vana.schemas.get(schemaId);
34680
+ * const refiner = await vana.data.getRefiner(1);
34681
+ * console.log({
34682
+ * name: refiner.name,
34683
+ * dlp: refiner.dlpId,
34684
+ * schema: refiner.schemaId,
34685
+ * instructions: refiner.refinementInstructionUrl
34686
+ * });
33979
34687
  * ```
33980
- * @param schemaId - The schema ID to retrieve
33981
- * @returns Promise resolving to the schema information
33982
34688
  */
33983
- getSchema(schemaId: number): Promise<Schema>;
34689
+ getRefiner(refinerId: number): Promise<Refiner>;
33984
34690
  /**
33985
- * Gets the total number of schemas in the registry.
34691
+ * Validates if a schema ID exists in the registry.
33986
34692
  *
33987
- * @deprecated Since v2.0.0 - Use vana.schemas.count() instead
34693
+ * @remarks
34694
+ * Checks the DataRefinerRegistry contract to determine if a given schema ID
34695
+ * has been registered and is available for use.
33988
34696
  *
33989
- * Migration guide:
34697
+ * @param schemaId - The numeric schema ID to validate
34698
+ * @returns Promise resolving to true if schema exists, false otherwise
34699
+ * @example
33990
34700
  * ```typescript
33991
- * // Old way (deprecated):
33992
- * const count = await vana.data.getSchemasCount();
33993
- *
33994
- * // New way:
33995
- * const count = await vana.schemas.count();
34701
+ * const isValid = await vana.data.isValidSchemaId(42);
34702
+ * if (isValid) {
34703
+ * console.log('Schema 42 is available for use');
34704
+ * } else {
34705
+ * console.log('Schema 42 does not exist');
34706
+ * }
33996
34707
  * ```
33997
- * @returns Promise resolving to the total schema count
33998
- */
33999
- getSchemasCount(): Promise<number>;
34000
- /**
34001
- * Adds a new refiner to the DataRefinerRegistry.
34002
- *
34003
- * @param params - Refiner parameters including DLP ID, name, schema ID, and instruction URL
34004
- * @returns Promise resolving to the new refiner ID and transaction hash
34005
- */
34006
- addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
34007
- /**
34008
- * Retrieves a refiner by its ID.
34009
- *
34010
- * @param refinerId - The refiner ID to retrieve
34011
- * @returns Promise resolving to the refiner information
34012
- */
34013
- getRefiner(refinerId: number): Promise<Refiner>;
34014
- /**
34015
- * Validates if a schema ID exists in the registry.
34016
- *
34017
- * @param schemaId - The schema ID to validate
34018
- * @returns Promise resolving to boolean indicating if the schema ID is valid
34019
34708
  */
34020
34709
  isValidSchemaId(schemaId: number): Promise<boolean>;
34021
34710
  /**
34022
34711
  * Gets the total number of refiners in the registry.
34023
34712
  *
34713
+ * @remarks
34714
+ * Queries the DataRefinerRegistry contract to get the total count of all
34715
+ * registered refiners across all DLPs.
34716
+ *
34024
34717
  * @returns Promise resolving to the total refiner count
34718
+ * @example
34719
+ * ```typescript
34720
+ * const count = await vana.data.getRefinersCount();
34721
+ * console.log(`Total refiners registered: ${count}`);
34722
+ * ```
34025
34723
  */
34026
34724
  getRefinersCount(): Promise<number>;
34027
34725
  /**
34028
34726
  * Updates the schema ID for an existing refiner.
34029
34727
  *
34030
- * @param params - Parameters including refiner ID and new schema ID
34728
+ * @remarks
34729
+ * Allows the owner of a refiner to update its associated schema ID.
34730
+ * This is useful when refiner output format needs to change.
34731
+ *
34732
+ * @param params - Update parameters
34733
+ * @param params.refinerId - The refiner ID to update
34734
+ * @param params.newSchemaId - The new schema ID to set
34031
34735
  * @returns Promise resolving to the transaction hash
34736
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34737
+ * @throws {Error} When transaction fails - "Failed to update schema ID: {error}"
34738
+ * @example
34739
+ * ```typescript
34740
+ * const result = await vana.data.updateSchemaId({
34741
+ * refinerId: 1,
34742
+ * newSchemaId: 55
34743
+ * });
34744
+ * console.log(`Schema updated in tx ${result.transactionHash}`);
34745
+ * ```
34032
34746
  */
34033
34747
  updateSchemaId(params: UpdateSchemaIdParams): Promise<UpdateSchemaIdResult>;
34034
34748
  /**
@@ -34054,13 +34768,13 @@ declare class DataController {
34054
34768
  * Uploads content to storage without registering it on the blockchain.
34055
34769
  * This method only handles the storage upload and returns the file URL.
34056
34770
  *
34057
- * @param content - The content to upload (string, Blob, or Buffer)
34058
- * @param filename - Filename for the uploaded file
34771
+ * @param content - The content to upload (string, Blob, Buffer, or object - objects will be JSON stringified)
34772
+ * @param filename - Optional filename for the uploaded file (defaults to timestamp-based name)
34059
34773
  * @param encrypt - Optional flag to encrypt the content before upload
34060
34774
  * @param providerName - Optional specific storage provider to use
34061
- * @returns Promise resolving to the storage file URL
34775
+ * @returns Promise resolving to the storage upload result with url, size, and contentType
34062
34776
  */
34063
- uploadToStorage(content: string | Blob | Buffer, filename: string, encrypt?: boolean, providerName?: string): Promise<string>;
34777
+ uploadToStorage(content: string | Blob | Buffer | object, filename?: string, encrypt?: boolean, providerName?: string): Promise<StorageUploadResult>;
34064
34778
  /**
34065
34779
  * Adds a permission for a party to access an existing file.
34066
34780
  *
@@ -34087,24 +34801,36 @@ declare class DataController {
34087
34801
  * console.log(`Transaction: ${result.transactionHash}`);
34088
34802
  * ```
34089
34803
  */
34090
- addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<FilePermissionResult>;
34804
+ addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
34091
34805
  /**
34092
- * Submits a file permission transaction and returns the transaction hash immediately.
34806
+ * Submits a file permission transaction to the blockchain.
34093
34807
  *
34094
- * This is the lower-level method that provides maximum control over transaction timing.
34808
+ * @remarks
34809
+ * This method supports gasless transactions via relayer callbacks when configured.
34810
+ * It encrypts the user's encryption key with the recipient's public key before submission.
34095
34811
  * Use this when you want to handle transaction confirmation and event parsing separately.
34096
34812
  *
34097
- * @param fileId - The ID of the file to add permissions for
34098
- * @param account - The address of the account to grant permission to
34099
- * @param publicKey - The public key to encrypt the user's encryption key with
34100
- * @returns Promise resolving to the transaction hash
34813
+ * @param fileId - The ID of the file to grant permission for
34814
+ * @param account - The recipient's wallet address that will access the file
34815
+ * @param publicKey - The recipient's public key for encryption.
34816
+ * Obtain via `vana.server.getIdentity(account).public_key`
34817
+ * @returns Promise resolving to TransactionHandle for tracking the transaction
34818
+ * @throws {Error} When chain ID is not available
34819
+ * @throws {Error} When encryption key generation fails
34820
+ * @throws {Error} When public key encryption fails
34821
+ *
34101
34822
  * @example
34102
34823
  * ```typescript
34103
- * const txHash = await vana.data.submitFilePermission(fileId, account, publicKey);
34104
- * console.log(`Transaction submitted: ${txHash}`);
34824
+ * const tx = await vana.data.submitFilePermission(
34825
+ * fileId,
34826
+ * "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
34827
+ * recipientPublicKey
34828
+ * );
34829
+ * const result = await tx.waitForEvents();
34830
+ * console.log(`Permission granted with ID: ${result.permissionId}`);
34105
34831
  * ```
34106
34832
  */
34107
- submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<Hash>;
34833
+ submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
34108
34834
  /**
34109
34835
  * Gets the encrypted key for a specific account's permission to access a file.
34110
34836
  *
@@ -34200,10 +34926,10 @@ declare class DataController {
34200
34926
  gateways?: string[];
34201
34927
  }): Promise<Blob>;
34202
34928
  /**
34203
- * Validates a data schema against the Vana meta-schema.
34929
+ * Validates a data schema definition against the Vana meta-schema.
34204
34930
  *
34205
- * @param schema - The data schema to validate
34206
- * @returns Assertion that schema is valid (throws if invalid)
34931
+ * @param schema - The data schema definition to validate
34932
+ * @returns The validated DataSchema
34207
34933
  * @throws SchemaValidationError if invalid
34208
34934
  * @example
34209
34935
  * ```typescript
@@ -34220,10 +34946,10 @@ declare class DataController {
34220
34946
  * }
34221
34947
  * };
34222
34948
  *
34223
- * vana.data.validateDataSchema(schema);
34949
+ * const validatedSchema = vana.data.validateDataSchemaAgainstMetaSchema(schema);
34224
34950
  * ```
34225
34951
  */
34226
- validateDataSchema(schema: unknown): asserts schema is DataSchema;
34952
+ validateDataSchemaAgainstMetaSchema(schema: unknown): DataSchema;
34227
34953
  /**
34228
34954
  * Validates data against a JSON Schema from a data schema.
34229
34955
  *
@@ -34253,9 +34979,9 @@ declare class DataController {
34253
34979
  */
34254
34980
  validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
34255
34981
  /**
34256
- * Fetches and validates a schema from a URL, then returns the parsed data schema.
34982
+ * Fetches and validates a data schema from a URL, then returns the parsed data schema.
34257
34983
  *
34258
- * @param url - The URL to fetch the schema from
34984
+ * @param url - The URL to fetch the data schema from
34259
34985
  * @returns The validated data schema
34260
34986
  * @throws SchemaValidationError if invalid or fetch fails
34261
34987
  * @example
@@ -34271,24 +34997,53 @@ declare class DataController {
34271
34997
  * ```
34272
34998
  */
34273
34999
  fetchAndValidateSchema(url: string): Promise<DataSchema>;
35000
+ }
35001
+
35002
+ /**
35003
+ * Configuration options for polling server operations.
35004
+ */
35005
+ interface PollingOptions {
35006
+ /** Polling interval in milliseconds (default: 500) */
35007
+ pollingInterval?: number;
35008
+ /** Maximum time to wait in milliseconds (default: 30000) */
35009
+ timeout?: number;
35010
+ }
35011
+ /**
35012
+ * Provides a Promise-based interface for server operation lifecycle management.
35013
+ *
35014
+ * @remarks
35015
+ * OperationHandle enables immediate access to operation IDs while providing
35016
+ * Promise-based methods for waiting on results. This pattern matches
35017
+ * TransactionHandle for consistency across the SDK's async operations.
35018
+ *
35019
+ * @category Server Operations
35020
+ */
35021
+ declare class OperationHandle<T = unknown> {
35022
+ private readonly controller;
35023
+ readonly id: string;
35024
+ private _resultPromise?;
35025
+ constructor(controller: ServerController, id: string);
34274
35026
  /**
34275
- * Retrieves a schema by ID and fetches its definition URL to get the full data schema.
35027
+ * Waits for the operation to complete and returns the result.
34276
35028
  *
34277
- * @param schemaId - The schema ID to retrieve and validate
34278
- * @returns The validated data schema
34279
- * @throws SchemaValidationError if schema is invalid
35029
+ * @remarks
35030
+ * Results are memoized - multiple calls return the same promise.
35031
+ * The method polls the server at regular intervals until the operation
35032
+ * succeeds, fails, or times out.
35033
+ *
35034
+ * @param options - Optional polling configuration
35035
+ * @returns The operation result when completed
35036
+ * @throws {PersonalServerError} When the operation fails or times out
34280
35037
  * @example
34281
35038
  * ```typescript
34282
- * // Get schema from registry and validate its schema
34283
- * const schema = await vana.data.getValidatedSchema(123);
34284
- *
34285
- * // Use it to validate user data
34286
- * if (schema.dialect === "json") {
34287
- * vana.data.validateDataAgainstSchema(userData, schema);
34288
- * }
35039
+ * const result = await handle.waitForResult({
35040
+ * timeout: 60000,
35041
+ * pollingInterval: 1000
35042
+ * });
34289
35043
  * ```
34290
35044
  */
34291
- getValidatedSchema(schemaId: number): Promise<DataSchema>;
35045
+ waitForResult(options?: PollingOptions): Promise<T>;
35046
+ private pollForCompletion;
34292
35047
  }
34293
35048
 
34294
35049
  /**
@@ -34371,54 +35126,47 @@ declare class ServerController {
34371
35126
  */
34372
35127
  getIdentity(request: InitPersonalServerParams): Promise<PersonalServerIdentity>;
34373
35128
  /**
34374
- * Creates an operation via the personal server API.
35129
+ * Creates a server operation and returns a handle for lifecycle management.
34375
35130
  *
34376
35131
  * @remarks
34377
- * This method submits a computation request to the personal server API.
34378
- * The response includes the operation ID.
34379
- * @param params - The request parameters object
35132
+ * This method submits a computation request to the personal server and returns
35133
+ * an OperationHandle that provides Promise-based methods for waiting on results.
35134
+ * The handle pattern matches TransactionHandle for consistency across async operations.
35135
+ *
35136
+ * @param params - The operation request parameters
34380
35137
  * @param params.permissionId - The permission ID authorizing this operation.
34381
- * Obtain from granted permissions via `vana.permissions.getUserPermissionGrantsOnChain()`.
34382
- * @returns A Promise that resolves to an operation response with status and control URLs
34383
- * @throws {PersonalServerError} When server request fails or parameters are invalid.
34384
- * Verify permissionId exists and is active for the target server.
34385
- * @throws {NetworkError} When personal server API communication fails.
34386
- * Check server URL configuration and network connectivity.
35138
+ * Obtain via `vana.permissions.getUserPermissionGrantsOnChain()`.
35139
+ * @returns An OperationHandle providing access to the operation ID and result methods
35140
+ * @throws {PersonalServerError} When the server request fails or parameters are invalid
35141
+ * @throws {NetworkError} When personal server API communication fails
34387
35142
  * @example
34388
35143
  * ```typescript
34389
- * const response = await vana.server.createOperation({
34390
- * permissionId: 123,
35144
+ * const operation = await vana.server.createOperation({
35145
+ * permissionId: 123
34391
35146
  * });
35147
+ * console.log(`Operation ID: ${operation.id}`);
34392
35148
  *
34393
- * console.log(`Operation created: ${response.id}`);
35149
+ * // Wait for completion
35150
+ * const result = await operation.waitForResult();
35151
+ * console.log("Result:", result);
34394
35152
  * ```
34395
35153
  */
34396
- createOperation(params: CreateOperationParams): Promise<CreateOperationResponse>;
35154
+ createOperation<T = unknown>(params: CreateOperationParams): Promise<OperationHandle<T>>;
34397
35155
  /**
34398
- * Polls the status of a computation request for updates and results.
35156
+ * Retrieves the current status and result of a server operation.
34399
35157
  *
34400
35158
  * @remarks
34401
- * This method checks the current status of a computation request by querying
34402
- * the personal server API using the provided operation ID. It returns the current
34403
- * status, any available output, and error information. The method can be
34404
- * called periodically until the operation completes or fails.
34405
- *
34406
- * Common status values include: `starting`, `processing`, `succeeded`, `failed`, `canceled`.
34407
- * @param operationId - The operation ID returned from the initial request submission
34408
- * @returns A Promise that resolves to the current operation response with status and results
34409
- * @throws {NetworkError} When the polling request fails or returns invalid data
35159
+ * Common status values: `starting`, `running`, `succeeded`, `failed`, `canceled`.
35160
+ * When status is `succeeded`, the result field contains the operation output.
35161
+ *
35162
+ * @param operationId - The ID of the operation to query
35163
+ * @returns The operation response containing status, result, and metadata
35164
+ * @throws {NetworkError} When the API request fails or returns invalid data
34410
35165
  * @example
34411
35166
  * ```typescript
34412
- * // Poll until completion
34413
- * let result = await vana.server.getOperation(response.id);
34414
- *
34415
- * while (result.status === "processing") {
34416
- * await new Promise(resolve => setTimeout(resolve, 1000));
34417
- * result = await vana.server.getOperation(response.id);
34418
- * }
34419
- *
34420
- * if (result.status === "succeeded") {
34421
- * console.log("Computation completed:", result.output);
35167
+ * const status = await vana.server.getOperation(operationId);
35168
+ * if (status.status === 'succeeded') {
35169
+ * console.log('Result:', JSON.parse(status.result));
34422
35170
  * }
34423
35171
  * ```
34424
35172
  */
@@ -34491,6 +35239,31 @@ interface Chains {
34491
35239
  }
34492
35240
  declare const chains: Chains;
34493
35241
 
35242
+ /**
35243
+ * Creates or retrieves a cached public client for blockchain read operations.
35244
+ *
35245
+ * @remarks
35246
+ * This function provides an optimized way to access blockchain data by maintaining
35247
+ * a cached client instance per chain. The client is used for reading contract state,
35248
+ * querying events, and other read-only blockchain operations. It automatically
35249
+ * handles HTTP transport configuration and chain switching.
35250
+ *
35251
+ * @param chainId - The chain ID to connect to (defaults to Moksha testnet)
35252
+ * @returns A public client configured for the specified chain with caching optimization
35253
+ * @throws {Error} When the specified chain ID is not supported by the SDK
35254
+ * @example
35255
+ * ```typescript
35256
+ * // Get client for default chain (Moksha testnet)
35257
+ * const client = createClient();
35258
+ *
35259
+ * // Get client for specific chain
35260
+ * const mainnetClient = createClient(14800);
35261
+ *
35262
+ * // Use client for blockchain reads
35263
+ * const blockNumber = await client.getBlockNumber();
35264
+ * ```
35265
+ * @category Blockchain
35266
+ */
34494
35267
  declare const createClient: (chainId?: keyof typeof chains) => PublicClient & {
34495
35268
  chain: Chain;
34496
35269
  };
@@ -35209,51 +35982,157 @@ declare class SerializationError extends VanaError {
35209
35982
  constructor(message: string);
35210
35983
  }
35211
35984
  /**
35212
- * Error thrown when a signature operation fails.
35985
+ * Thrown when a signature operation fails or cannot be completed.
35213
35986
  *
35214
35987
  * @remarks
35215
- * Recovery strategies: Check wallet connection and account unlock status,
35216
- * retry operation with explicit user interaction, or for gasless operations
35217
- * consider switching to direct transactions.
35988
+ * This error occurs when wallet signature operations fail due to disconnection,
35989
+ * locked accounts, or other wallet-related issues. It preserves the original
35990
+ * error for debugging while providing consistent error handling across the SDK.
35991
+ *
35992
+ * Recovery strategies:
35993
+ * - Check wallet connection and account unlock status
35994
+ * - Retry operation with explicit user interaction
35995
+ * - For gasless operations, consider switching to direct transactions
35996
+ *
35997
+ * @example
35998
+ * ```typescript
35999
+ * try {
36000
+ * await vana.permissions.grant({ grantee: '0x...' });
36001
+ * } catch (error) {
36002
+ * if (error instanceof SignatureError) {
36003
+ * // Prompt user to unlock wallet
36004
+ * await promptWalletUnlock();
36005
+ * // Retry operation
36006
+ * }
36007
+ * }
36008
+ * ```
36009
+ * @category Error Handling
35218
36010
  */
35219
36011
  declare class SignatureError extends VanaError {
35220
36012
  readonly originalError?: Error | undefined;
35221
36013
  constructor(message: string, originalError?: Error | undefined);
35222
36014
  }
35223
36015
  /**
35224
- * Error thrown when a network operation fails.
36016
+ * Thrown when network communication fails during API calls or blockchain interactions.
35225
36017
  *
35226
36018
  * @remarks
35227
- * Recovery strategies: Check network connectivity, retry with exponential backoff,
35228
- * verify API endpoints are accessible, or switch to alternative network providers.
36019
+ * This error encompasses network connectivity issues, API unavailability,
36020
+ * timeout errors, and CORS restrictions. It's commonly encountered during
36021
+ * IPFS operations, subgraph queries, or RPC calls.
36022
+ *
36023
+ * Recovery strategies:
36024
+ * - Check network connectivity
36025
+ * - Retry with exponential backoff
36026
+ * - Verify API endpoints are accessible
36027
+ * - Switch to alternative network providers or gateways
36028
+ *
36029
+ * @example
36030
+ * ```typescript
36031
+ * try {
36032
+ * const files = await vana.data.getUserFiles({ owner: '0x...' });
36033
+ * } catch (error) {
36034
+ * if (error instanceof NetworkError) {
36035
+ * // Implement retry with exponential backoff
36036
+ * await retryWithBackoff(() => vana.data.getUserFiles({ owner: '0x...' }));
36037
+ * }
36038
+ * }
36039
+ * ```
36040
+ * @category Error Handling
35229
36041
  */
35230
36042
  declare class NetworkError extends VanaError {
35231
36043
  readonly originalError?: Error | undefined;
35232
36044
  constructor(message: string, originalError?: Error | undefined);
35233
36045
  }
35234
36046
  /**
35235
- * Error thrown when the nonce retrieval fails.
36047
+ * Thrown when transaction nonce retrieval fails during gasless operations.
35236
36048
  *
35237
36049
  * @remarks
35238
- * Recovery strategies: Retry nonce retrieval after brief delay, check wallet connection
35239
- * and account status, or use manual nonce specification if supported by the operation.
36050
+ * This error occurs when the SDK cannot retrieve the user's current nonce from
36051
+ * smart contracts, preventing gasless transaction submission. Nonces are critical
36052
+ * for preventing replay attacks in signed transactions.
36053
+ *
36054
+ * Recovery strategies:
36055
+ * - Retry nonce retrieval after brief delay
36056
+ * - Check wallet connection and account status
36057
+ * - Use manual nonce specification if supported by the operation
36058
+ * - Switch to direct transactions as fallback
36059
+ *
36060
+ * @example
36061
+ * ```typescript
36062
+ * try {
36063
+ * await vana.permissions.grant({ grantee: '0x...' });
36064
+ * } catch (error) {
36065
+ * if (error instanceof NonceError) {
36066
+ * // Wait and retry
36067
+ * await delay(1000);
36068
+ * await vana.permissions.grant({ grantee: '0x...' });
36069
+ * }
36070
+ * }
36071
+ * ```
36072
+ * @category Error Handling
35240
36073
  */
35241
36074
  declare class NonceError extends VanaError {
35242
36075
  constructor(message: string);
35243
36076
  }
35244
36077
  /**
35245
- * Error thrown when a personal server operation fails.
36078
+ * Thrown when personal server operations fail or cannot be completed.
35246
36079
  *
35247
36080
  * @remarks
35248
- * Recovery strategies: Verify server URL accessibility, check server trust status via
35249
- * `vana.permissions.getUserTrustedServers()`, or retry after server becomes available.
36081
+ * This error occurs during interactions with personal servers for computation
36082
+ * requests, identity retrieval, or operation status checks. Common causes include
36083
+ * server unavailability, untrusted server status, or invalid permission grants.
36084
+ *
36085
+ * Recovery strategies:
36086
+ * - Verify server URL accessibility
36087
+ * - Check server trust status via `vana.permissions.getTrustedServers()`
36088
+ * - Ensure valid permissions exist for the operation
36089
+ * - Retry after server becomes available
36090
+ *
36091
+ * @example
36092
+ * ```typescript
36093
+ * try {
36094
+ * const result = await vana.server.createOperation({ permissionId: 123 });
36095
+ * } catch (error) {
36096
+ * if (error instanceof PersonalServerError) {
36097
+ * // Check if server is trusted
36098
+ * const trustedServers = await vana.permissions.getTrustedServers();
36099
+ * if (!trustedServers.includes(serverId)) {
36100
+ * await vana.permissions.trustServer({ serverId });
36101
+ * }
36102
+ * }
36103
+ * }
36104
+ * ```
36105
+ * @category Error Handling
35250
36106
  */
35251
36107
  declare class PersonalServerError extends VanaError {
35252
36108
  readonly originalError?: Error | undefined;
35253
36109
  constructor(message: string, originalError?: Error | undefined);
35254
36110
  }
35255
36111
  /**
35256
- * Error thrown when trying to register a server with a URL that doesn't match the existing registration.
36112
+ * Thrown when attempting to register a server with a URL different from its existing registration.
36113
+ *
36114
+ * @remarks
36115
+ * This error occurs when trying to add or trust a server that's already registered
36116
+ * on-chain with a different URL. Server URLs are immutable once registered to
36117
+ * maintain consistency and security. Applications should use the existing URL
36118
+ * or register a new server with a different ID.
36119
+ *
36120
+ * @example
36121
+ * ```typescript
36122
+ * try {
36123
+ * await vana.permissions.addAndTrustServer({
36124
+ * serverId: 1,
36125
+ * serverUrl: 'https://new-url.com',
36126
+ * publicKey: '0x...'
36127
+ * });
36128
+ * } catch (error) {
36129
+ * if (error instanceof ServerUrlMismatchError) {
36130
+ * console.log(`Server already registered with: ${error.existingUrl}`);
36131
+ * // Use existing URL or register new server
36132
+ * }
36133
+ * }
36134
+ * ```
36135
+ * @category Error Handling
35257
36136
  */
35258
36137
  declare class ServerUrlMismatchError extends VanaError {
35259
36138
  constructor(existingUrl: string, providedUrl: string, serverId: string);
@@ -35262,7 +36141,25 @@ declare class ServerUrlMismatchError extends VanaError {
35262
36141
  readonly serverId: string;
35263
36142
  }
35264
36143
  /**
35265
- * Error thrown when a permission operation fails.
36144
+ * Thrown when permission grant, revoke, or validation operations fail.
36145
+ *
36146
+ * @remarks
36147
+ * This error occurs during permission management operations including grants,
36148
+ * revocations, and permission validation checks. Common causes include invalid
36149
+ * grantee addresses, expired permissions, or insufficient privileges.
36150
+ *
36151
+ * @example
36152
+ * ```typescript
36153
+ * try {
36154
+ * await vana.permissions.revoke({ permissionId: 999999 });
36155
+ * } catch (error) {
36156
+ * if (error instanceof PermissionError) {
36157
+ * console.error('Permission operation failed:', error.message);
36158
+ * // Permission may not exist or user may not be owner
36159
+ * }
36160
+ * }
36161
+ * ```
36162
+ * @category Error Handling
35266
36163
  */
35267
36164
  declare class PermissionError extends VanaError {
35268
36165
  readonly originalError?: Error | undefined;
@@ -36270,21 +37167,53 @@ declare function withSignatureCache(cache: VanaCacheAdapter, walletAddress: stri
36270
37167
 
36271
37168
  declare const CONTRACT_ADDRESSES: Record<number, Record<string, string>>;
36272
37169
  /**
36273
- * Retrieves the deployed contract address for a specific contract on a given chain.
37170
+ * Retrieves the deployed contract address for a specific Vana protocol contract on a given chain.
36274
37171
  *
36275
- * @param chainId - The chain ID to look up the contract on
36276
- * @param contract - The contract name to get the address for
36277
- * @returns The contract address as a hex string
36278
- * @throws {Error} When contract address not found for the specified contract and chain
37172
+ * @remarks
37173
+ * This function provides type-safe access to contract addresses across all supported Vana networks.
37174
+ * It automatically searches both current and legacy contract registries to ensure backwards
37175
+ * compatibility while providing clear error messages for unsupported combinations.
37176
+ *
37177
+ * The function validates that both the chain ID and contract name are supported before
37178
+ * attempting address lookup, helping developers identify deployment or configuration issues
37179
+ * early in the development process.
37180
+ *
37181
+ * **Supported Chains:**
37182
+ * - 14800: Vana Mainnet
37183
+ * - 1480: Moksha Testnet
37184
+ *
37185
+ * **Contract Categories:**
37186
+ * - Data Management: DataRegistry, DataRefinerRegistry
37187
+ * - Permissions: DataPortabilityPermissions, DataPortabilityServers, DataPortabilityGrantees
37188
+ * - Computing: TeePoolPhala, TeePoolDedicatedGpu, etc.
37189
+ * - Token & Governance: DATImplementation, VanaPoolStaking, etc.
37190
+ *
37191
+ * @param chainId - The chain ID to look up the contract on (14800 for mainnet, 1480 for testnet)
37192
+ * @param contract - The contract name to get the address for (use TypeScript autocomplete for available options)
37193
+ * @returns The contract address as a checksummed hex string (0x...)
37194
+ * @throws {Error} When contract address not found for the specified contract and chain combination.
37195
+ * This typically indicates the contract is not deployed on the requested network.
36279
37196
  * @example
36280
37197
  * ```typescript
37198
+ * // Get core protocol contract addresses
37199
+ * const dataRegistry = getContractAddress(14800, 'DataRegistry');
37200
+ * const permissions = getContractAddress(14800, 'DataPortabilityPermissions');
37201
+ * const trustedServers = getContractAddress(14800, 'DataPortabilityServers');
37202
+ *
37203
+ * // Handle unsupported combinations gracefully
36281
37204
  * try {
36282
- * const dataRegistryAddress = getContractAddress(1480, 'DataRegistry');
36283
- * console.log('DataRegistry address:', dataRegistryAddress);
37205
+ * const address = getContractAddress(1480, 'DataRegistry');
37206
+ * console.log('DataRegistry testnet address:', address);
36284
37207
  * } catch (error) {
36285
- * console.error('Contract not deployed on this chain:', error.message);
37208
+ * console.error('Contract not available on testnet:', error.message);
37209
+ * // Fallback to mainnet or show user-friendly error
36286
37210
  * }
37211
+ *
37212
+ * // TypeScript provides autocomplete for contract names
37213
+ * const poolAddress = getContractAddress(14800, 'TeePoolPhala'); // ✅ Valid
37214
+ * // const invalid = getContractAddress(14800, 'InvalidContract'); // ❌ TypeScript error
36287
37215
  * ```
37216
+ * @category Configuration
36288
37217
  */
36289
37218
  declare const getContractAddress: (chainId: keyof typeof CONTRACT_ADDRESSES, contract: VanaContract) => `0x${string}`;
36290
37219
 
@@ -36459,6 +37388,10 @@ declare class CircuitBreaker {
36459
37388
  *
36460
37389
  * This implementation uses browser-compatible libraries and configurations
36461
37390
  * to provide crypto, PGP, and HTTP functionality without Node.js dependencies.
37391
+ *
37392
+ * WARNING: Dependencies that access globals during init
37393
+ * MUST be dynamically imported to support Turbopack.
37394
+ * See: https://github.com/vercel/next.js/issues/82632
36462
37395
  */
36463
37396
 
36464
37397
  /**
@@ -36798,4 +37731,4 @@ declare function Vana(config: VanaConfig): VanaBrowserImpl;
36798
37731
  */
36799
37732
  type VanaInstance = VanaBrowserImpl;
36800
37733
 
36801
- 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 };
37734
+ 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 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, validateDataSchemaAgainstMetaSchema, validateGrant, validateGrantExpiry, validateGrantFile, validateGranteeAccess, validateOperationAccess, vanaMainnet, type webhooks, withSignatureCache };