@opendatalabs/vana-sdk 0.1.0-alpha.606fa2d → 0.1.0-alpha.66768f7

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 (44) hide show
  1. package/README.md +4 -13
  2. package/dist/{browser-Bb8gLWHp.d.ts → browser-DY8XDblx.d.ts} +14 -61
  3. package/dist/browser.d.ts +1 -1
  4. package/dist/browser.js +106 -723
  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 +261 -342
  19. package/dist/index.browser.js +691 -861
  20. package/dist/index.browser.js.map +1 -1
  21. package/dist/index.node.cjs +729 -1010
  22. package/dist/index.node.cjs.map +1 -1
  23. package/dist/index.node.d.cts +265 -101
  24. package/dist/index.node.d.ts +265 -101
  25. package/dist/index.node.js +731 -1024
  26. package/dist/index.node.js.map +1 -1
  27. package/dist/node.cjs +53 -692
  28. package/dist/node.cjs.map +1 -1
  29. package/dist/node.js +52 -704
  30. package/dist/node.js.map +1 -1
  31. package/dist/platform.browser.d.ts +2 -2
  32. package/dist/platform.browser.js +116 -780
  33. package/dist/platform.browser.js.map +1 -1
  34. package/dist/platform.cjs +156 -933
  35. package/dist/platform.cjs.map +1 -1
  36. package/dist/platform.js +156 -945
  37. package/dist/platform.js.map +1 -1
  38. package/dist/platform.node.cjs +156 -933
  39. package/dist/platform.node.cjs.map +1 -1
  40. package/dist/platform.node.d.cts +14 -61
  41. package/dist/platform.node.d.ts +14 -61
  42. package/dist/platform.node.js +156 -945
  43. package/dist/platform.node.js.map +1 -1
  44. package/package.json +15 -31
@@ -1023,6 +1023,39 @@ interface ServerFilesAndPermissionTypedData extends GenericTypedData {
1023
1023
  filePermissions: Permission[][];
1024
1024
  };
1025
1025
  }
1026
+ /**
1027
+ * Input structure for FilePermission typed data
1028
+ *
1029
+ * @category Permissions
1030
+ */
1031
+ interface FilePermissionInput extends RecordCompatible {
1032
+ /** User nonce */
1033
+ nonce: bigint;
1034
+ /** File ID to grant permission for */
1035
+ fileId: number;
1036
+ /** Account address to grant permission to */
1037
+ account: Address;
1038
+ /** Encrypted key for the permission */
1039
+ encryptedKey: string;
1040
+ }
1041
+ /**
1042
+ * EIP-712 typed data for FilePermission
1043
+ *
1044
+ * @category Permissions
1045
+ */
1046
+ interface FilePermissionTypedData extends GenericTypedData {
1047
+ /** EIP-712 types */
1048
+ types: {
1049
+ FilePermission: Array<{
1050
+ name: string;
1051
+ type: string;
1052
+ }>;
1053
+ };
1054
+ /** Primary type */
1055
+ primaryType: "FilePermission";
1056
+ /** Message to sign */
1057
+ message: FilePermissionInput;
1058
+ }
1026
1059
 
1027
1060
  /**
1028
1061
  * Marker interface to indicate that a Vana instance has storage configured.
@@ -1247,6 +1280,22 @@ interface RelayerCallbacks {
1247
1280
  * @returns Promise resolving to the storage URL
1248
1281
  */
1249
1282
  storeGrantFile?: (grantData: GrantFile) => Promise<string>;
1283
+ /**
1284
+ * Submit a signed file permission transaction for relay
1285
+ *
1286
+ * @param params - Complete parameters for file permission
1287
+ * @param params.fileId - The file ID to grant permission for
1288
+ * @param params.account - The account address to grant permission to
1289
+ * @param params.encryptedKey - The encrypted key for the permission
1290
+ * @param params.userAddress - The user's address (owner of the file)
1291
+ * @returns Promise resolving to the transaction hash
1292
+ */
1293
+ submitFilePermission?: (params: {
1294
+ fileId: number;
1295
+ account: Address;
1296
+ encryptedKey: string;
1297
+ userAddress: Address;
1298
+ }) => Promise<Hash>;
1250
1299
  }
1251
1300
  /**
1252
1301
  * Storage callback functions for flexible storage operations.
@@ -1752,6 +1801,12 @@ interface UserFile$1 {
1752
1801
  transactionHash?: Address;
1753
1802
  /** Additional file properties and custom application data. */
1754
1803
  metadata?: FileMetadata;
1804
+ /**
1805
+ * Array of DLP IDs that have submitted proofs for this file.
1806
+ * Each proof represents verification or processing by a Data Liquidity Pool.
1807
+ * Obtain DLP details via `vana.data.getDLP(dlpId)`.
1808
+ */
1809
+ dlpIds?: number[];
1755
1810
  }
1756
1811
  /**
1757
1812
  * Provides optional metadata for uploaded files and content description.
@@ -5230,6 +5285,31 @@ declare const contractAbis: {
5230
5285
  }];
5231
5286
  readonly name: "FileAdded";
5232
5287
  readonly type: "event";
5288
+ }, {
5289
+ readonly anonymous: false;
5290
+ readonly inputs: readonly [{
5291
+ readonly indexed: true;
5292
+ readonly internalType: "uint256";
5293
+ readonly name: "fileId";
5294
+ readonly type: "uint256";
5295
+ }, {
5296
+ readonly indexed: true;
5297
+ readonly internalType: "address";
5298
+ readonly name: "ownerAddress";
5299
+ readonly type: "address";
5300
+ }, {
5301
+ readonly indexed: false;
5302
+ readonly internalType: "string";
5303
+ readonly name: "url";
5304
+ readonly type: "string";
5305
+ }, {
5306
+ readonly indexed: false;
5307
+ readonly internalType: "uint256";
5308
+ readonly name: "schemaId";
5309
+ readonly type: "uint256";
5310
+ }];
5311
+ readonly name: "FileAddedV2";
5312
+ readonly type: "event";
5233
5313
  }, {
5234
5314
  readonly anonymous: false;
5235
5315
  readonly inputs: readonly [{
@@ -5656,6 +5736,16 @@ declare const contractAbis: {
5656
5736
  }];
5657
5737
  readonly stateMutability: "view";
5658
5738
  readonly type: "function";
5739
+ }, {
5740
+ readonly inputs: readonly [];
5741
+ readonly name: "emitLegacyEvents";
5742
+ readonly outputs: readonly [{
5743
+ readonly internalType: "bool";
5744
+ readonly name: "";
5745
+ readonly type: "bool";
5746
+ }];
5747
+ readonly stateMutability: "view";
5748
+ readonly type: "function";
5659
5749
  }, {
5660
5750
  readonly inputs: readonly [{
5661
5751
  readonly internalType: "string";
@@ -5774,6 +5864,10 @@ declare const contractAbis: {
5774
5864
  readonly internalType: "string";
5775
5865
  readonly name: "url";
5776
5866
  readonly type: "string";
5867
+ }, {
5868
+ readonly internalType: "uint256";
5869
+ readonly name: "schemaId";
5870
+ readonly type: "uint256";
5777
5871
  }, {
5778
5872
  readonly internalType: "uint256";
5779
5873
  readonly name: "addedAtBlock";
@@ -5991,6 +6085,16 @@ declare const contractAbis: {
5991
6085
  readonly outputs: readonly [];
5992
6086
  readonly stateMutability: "nonpayable";
5993
6087
  readonly type: "function";
6088
+ }, {
6089
+ readonly inputs: readonly [{
6090
+ readonly internalType: "bool";
6091
+ readonly name: "newEmitLegacyEvents";
6092
+ readonly type: "bool";
6093
+ }];
6094
+ readonly name: "updateEmitLegacyEvents";
6095
+ readonly outputs: readonly [];
6096
+ readonly stateMutability: "nonpayable";
6097
+ readonly type: "function";
5994
6098
  }, {
5995
6099
  readonly inputs: readonly [{
5996
6100
  readonly internalType: "address";
@@ -28839,19 +28943,19 @@ declare const EVENT_MAPPINGS: {
28839
28943
  };
28840
28944
  readonly addFile: {
28841
28945
  readonly contract: "DataRegistry";
28842
- readonly event: "FileAdded";
28946
+ readonly event: "FileAddedV2";
28843
28947
  };
28844
28948
  readonly addFileWithPermissionsAndSchema: {
28845
28949
  readonly contract: "DataRegistry";
28846
- readonly event: "FileAdded";
28950
+ readonly event: "FileAddedV2";
28847
28951
  };
28848
28952
  readonly addFileWithSchema: {
28849
28953
  readonly contract: "DataRegistry";
28850
- readonly event: "FileAdded";
28954
+ readonly event: "FileAddedV2";
28851
28955
  };
28852
28956
  readonly addFileWithPermissions: {
28853
28957
  readonly contract: "DataRegistry";
28854
- readonly event: "FileAdded";
28958
+ readonly event: "FileAddedV2";
28855
28959
  };
28856
28960
  readonly addRefinement: {
28857
28961
  readonly contract: "DataRegistry";
@@ -28967,7 +29071,7 @@ interface GranteeRegisterResult extends BaseTransactionResult {
28967
29071
  }
28968
29072
  /**
28969
29073
  * Result of a successful file addition operation.
28970
- * Contains data from the FileAdded blockchain event.
29074
+ * Contains data from the FileAddedV2 blockchain event.
28971
29075
  */
28972
29076
  interface FileAddedResult extends BaseTransactionResult {
28973
29077
  /** Unique file ID assigned by the registry */
@@ -28976,6 +29080,8 @@ interface FileAddedResult extends BaseTransactionResult {
28976
29080
  ownerAddress: Address;
28977
29081
  /** URL where the file is stored */
28978
29082
  url: string;
29083
+ /** Schema ID associated with the file (0 for no schema) */
29084
+ schemaId: bigint;
28979
29085
  }
28980
29086
  /**
28981
29087
  * Result of a successful file permission addition operation.
@@ -31642,16 +31748,16 @@ declare class SchemaValidationError extends Error {
31642
31748
  }>);
31643
31749
  }
31644
31750
  /**
31645
- * Schema validation utility class
31751
+ * Data schema validation utility class
31646
31752
  */
31647
31753
  declare class SchemaValidator {
31648
31754
  private ajv;
31649
31755
  private dataSchemaValidator;
31650
31756
  constructor();
31651
31757
  /**
31652
- * Validates a data schema against the Vana meta-schema
31758
+ * Validates a data schema definition against the Vana meta-schema
31653
31759
  *
31654
- * @param schema - The data schema to validate
31760
+ * @param schema - The data schema definition to validate
31655
31761
  * @throws SchemaValidationError if invalid
31656
31762
  * @example
31657
31763
  * ```typescript
@@ -31670,15 +31776,15 @@ declare class SchemaValidator {
31670
31776
  * }
31671
31777
  * };
31672
31778
  *
31673
- * validator.validateDataSchema(schema); // throws if invalid
31779
+ * validator.validateDataSchemaAgainstMetaSchema(schema); // throws if invalid
31674
31780
  * ```
31675
31781
  */
31676
- validateDataSchema(schema: unknown): asserts schema is DataSchema;
31782
+ validateDataSchemaAgainstMetaSchema(schema: unknown): asserts schema is DataSchema;
31677
31783
  /**
31678
- * Validates data against a JSON Schema from a schema
31784
+ * Validates data against a JSON Schema
31679
31785
  *
31680
31786
  * @param data - The data to validate
31681
- * @param schema - The schema containing the validation rules (DataSchema or Schema)
31787
+ * @param schema - The schema containing the validation rules (must have been validated or fetched from chain)
31682
31788
  * @throws SchemaValidationError if invalid
31683
31789
  * @example
31684
31790
  * ```typescript
@@ -31688,13 +31794,13 @@ declare class SchemaValidator {
31688
31794
  * const schema = await vana.schemas.get(1);
31689
31795
  * validator.validateDataAgainstSchema(userData, schema);
31690
31796
  *
31691
- * // Also works with DataSchema object
31692
- * const dataSchema: DataSchema = {
31797
+ * // Also works with pre-validated DataSchema object
31798
+ * const dataSchema = validator.validateDataSchemaAgainstMetaSchema({
31693
31799
  * name: "User Profile",
31694
31800
  * version: "1.0.0",
31695
31801
  * dialect: "json",
31696
31802
  * schema: { type: "object", properties: { name: { type: "string" } } }
31697
- * };
31803
+ * });
31698
31804
  * validator.validateDataAgainstSchema(userData, dataSchema);
31699
31805
  * ```
31700
31806
  */
@@ -31709,9 +31815,9 @@ declare class SchemaValidator {
31709
31815
  */
31710
31816
  validateSQLiteDDL(ddl: string, dialectVersion?: string): void;
31711
31817
  /**
31712
- * Fetches and validates a schema from a URL
31818
+ * Fetches and validates a data schema from a URL
31713
31819
  *
31714
- * @param url - The URL to fetch the schema from
31820
+ * @param url - The URL to fetch the data schema from
31715
31821
  * @returns The validated data schema
31716
31822
  * @throws SchemaValidationError if invalid or fetch fails
31717
31823
  * @example
@@ -31727,13 +31833,24 @@ declare class SchemaValidator {
31727
31833
  */
31728
31834
  declare const schemaValidator: SchemaValidator;
31729
31835
  /**
31730
- * Convenience function to validate a data schema
31836
+ * Convenience function to validate a data schema definition against the Vana meta-schema
31731
31837
  *
31732
- * @param schema - The data schema to validate
31733
- * @returns void - Assertion function that doesn't return a value
31838
+ * @param schema - The data schema definition to validate
31839
+ * @returns The validated DataSchema
31734
31840
  * @throws SchemaValidationError if invalid
31841
+ * @example
31842
+ * ```typescript
31843
+ * const schemaDefinition = {
31844
+ * name: "User Profile",
31845
+ * version: "1.0.0",
31846
+ * dialect: "json",
31847
+ * schema: { type: "object", properties: { name: { type: "string" } } }
31848
+ * };
31849
+ *
31850
+ * const validatedSchema = validateDataSchemaAgainstMetaSchema(schemaDefinition);
31851
+ * ```
31735
31852
  */
31736
- declare function validateDataSchema(schema: unknown): asserts schema is DataSchema;
31853
+ declare function validateDataSchemaAgainstMetaSchema(schema: unknown): DataSchema;
31737
31854
  /**
31738
31855
  * Convenience function to validate data against a schema
31739
31856
  *
@@ -31744,9 +31861,9 @@ declare function validateDataSchema(schema: unknown): asserts schema is DataSche
31744
31861
  */
31745
31862
  declare function validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
31746
31863
  /**
31747
- * Convenience function to fetch and validate a schema from a URL
31864
+ * Convenience function to fetch and validate a data schema from a URL
31748
31865
  *
31749
- * @param url - The URL to fetch the schema from
31866
+ * @param url - The URL to fetch the data schema from
31750
31867
  * @returns The validated data schema
31751
31868
  * @throws SchemaValidationError if invalid or fetch fails
31752
31869
  */
@@ -34237,6 +34354,89 @@ declare class DataController {
34237
34354
  owner: Address;
34238
34355
  subgraphUrl?: string;
34239
34356
  }): Promise<UserFile$1[]>;
34357
+ /**
34358
+ * Fetches proof data for multiple files from the subgraph.
34359
+ *
34360
+ * @private
34361
+ * @param fileIds - Array of file IDs to fetch proofs for
34362
+ * @param subgraphUrl - The subgraph endpoint URL
34363
+ * @returns Map of file IDs to their associated DLP IDs
34364
+ */
34365
+ private _fetchProofsFromSubgraph;
34366
+ /**
34367
+ * Fetches proof data for multiple files from the blockchain.
34368
+ * Falls back to this when subgraph is unavailable.
34369
+ *
34370
+ * @private
34371
+ * @param fileIds - Array of file IDs to fetch proofs for
34372
+ * @returns Map of file IDs to their associated DLP IDs
34373
+ */
34374
+ private _fetchProofsFromChain;
34375
+ /**
34376
+ * Retrieves information about a specific Data Liquidity Pool (DLP).
34377
+ *
34378
+ * @remarks
34379
+ * DLPs are entities that process and verify data files in the Vana network.
34380
+ * This method fetches DLP metadata including name, status, and performance rating.
34381
+ * Uses subgraph first for efficiency, falls back to chain if unavailable.
34382
+ *
34383
+ * @param dlpId - The unique identifier of the DLP
34384
+ * @param options - Optional parameters
34385
+ * @param options.subgraphUrl - Custom subgraph URL to override default
34386
+ * @returns Promise resolving to DLP information
34387
+ * @throws {Error} When DLP cannot be found - "DLP not found: {dlpId}"
34388
+ * @throws {Error} When query fails - "Failed to fetch DLP: {error}"
34389
+ * @example
34390
+ * ```typescript
34391
+ * const dlp = await vana.data.getDLP(26);
34392
+ * console.log(`DLP ${dlp.name}: ${dlp.status}`);
34393
+ * ```
34394
+ */
34395
+ getDLP(dlpId: number, options?: {
34396
+ subgraphUrl?: string;
34397
+ }): Promise<{
34398
+ id: number;
34399
+ name: string;
34400
+ metadata?: string;
34401
+ status?: number;
34402
+ address?: Address;
34403
+ owner?: Address;
34404
+ }>;
34405
+ /**
34406
+ * Lists all Data Liquidity Pools (DLPs) with optional pagination.
34407
+ *
34408
+ * @remarks
34409
+ * Fetches a paginated list of all DLPs registered in the network.
34410
+ * Uses subgraph for efficient querying with fallback to chain multicall.
34411
+ *
34412
+ * @param options - Optional parameters for pagination and filtering
34413
+ * @param options.limit - Maximum number of DLPs to return (default: 100)
34414
+ * @param options.offset - Number of DLPs to skip (default: 0)
34415
+ * @param options.subgraphUrl - Custom subgraph URL to override default
34416
+ * @returns Promise resolving to array of DLP information
34417
+ * @throws {Error} When query fails - "Failed to list DLPs: {error}"
34418
+ * @example
34419
+ * ```typescript
34420
+ * // Get first 10 DLPs
34421
+ * const dlps = await vana.data.listDLPs({ limit: 10 });
34422
+ * dlps.forEach(dlp => console.log(`${dlp.id}: ${dlp.name}`));
34423
+ *
34424
+ * // Get next page
34425
+ * const nextPage = await vana.data.listDLPs({ limit: 10, offset: 10 });
34426
+ * ```
34427
+ */
34428
+ listDLPs(options?: {
34429
+ limit?: number;
34430
+ offset?: number;
34431
+ subgraphUrl?: string;
34432
+ }): Promise<Array<{
34433
+ id: number;
34434
+ name: string;
34435
+ metadata?: string;
34436
+ status?: number;
34437
+ address?: Address;
34438
+ owner?: Address;
34439
+ }>>;
34240
34440
  /**
34241
34441
  * Retrieves a list of permissions granted by a user.
34242
34442
  *
@@ -34645,6 +34845,17 @@ declare class DataController {
34645
34845
  * ```
34646
34846
  */
34647
34847
  submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
34848
+ /**
34849
+ * Composes the EIP-712 typed data for FilePermission.
34850
+ *
34851
+ * @param params - The parameters for composing the file permission message
34852
+ * @param params.nonce - The user's nonce for preventing replay attacks
34853
+ * @param params.fileId - The ID of the file to grant permission for
34854
+ * @param params.account - The account address to grant permission to
34855
+ * @param params.encryptedKey - The encrypted key for the permission
34856
+ * @returns Promise resolving to the typed data structure
34857
+ */
34858
+ private composeFilePermissionMessage;
34648
34859
  /**
34649
34860
  * Gets the encrypted key for a specific account's permission to access a file.
34650
34861
  *
@@ -34740,10 +34951,10 @@ declare class DataController {
34740
34951
  gateways?: string[];
34741
34952
  }): Promise<Blob>;
34742
34953
  /**
34743
- * Validates a data schema against the Vana meta-schema.
34954
+ * Validates a data schema definition against the Vana meta-schema.
34744
34955
  *
34745
- * @param schema - The data schema to validate
34746
- * @returns Assertion that schema is valid (throws if invalid)
34956
+ * @param schema - The data schema definition to validate
34957
+ * @returns The validated DataSchema
34747
34958
  * @throws SchemaValidationError if invalid
34748
34959
  * @example
34749
34960
  * ```typescript
@@ -34760,10 +34971,10 @@ declare class DataController {
34760
34971
  * }
34761
34972
  * };
34762
34973
  *
34763
- * vana.data.validateDataSchema(schema);
34974
+ * const validatedSchema = vana.data.validateDataSchemaAgainstMetaSchema(schema);
34764
34975
  * ```
34765
34976
  */
34766
- validateDataSchema(schema: unknown): asserts schema is DataSchema;
34977
+ validateDataSchemaAgainstMetaSchema(schema: unknown): DataSchema;
34767
34978
  /**
34768
34979
  * Validates data against a JSON Schema from a data schema.
34769
34980
  *
@@ -34793,9 +35004,9 @@ declare class DataController {
34793
35004
  */
34794
35005
  validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
34795
35006
  /**
34796
- * Fetches and validates a schema from a URL, then returns the parsed data schema.
35007
+ * Fetches and validates a data schema from a URL, then returns the parsed data schema.
34797
35008
  *
34798
- * @param url - The URL to fetch the schema from
35009
+ * @param url - The URL to fetch the data schema from
34799
35010
  * @returns The validated data schema
34800
35011
  * @throws SchemaValidationError if invalid or fetch fails
34801
35012
  * @example
@@ -36899,12 +37110,12 @@ declare class SignatureCache {
36899
37110
  * Generate a deterministic hash of a message object for cache key generation
36900
37111
  *
36901
37112
  * @remarks
36902
- * Creates a cryptographically secure hash from complex objects including EIP-712 typed data.
36903
- * Uses SHA-256 for collision resistance and deterministic key generation.
36904
- * Handles BigInt serialization and sorts object keys for consistency.
37113
+ * Creates a consistent hash from complex objects including EIP-712 typed data.
37114
+ * Handles BigInt serialization and produces a 32-character hash that balances
37115
+ * uniqueness with key length constraints.
36905
37116
  *
36906
37117
  * @param message - The message object to hash (typically EIP-712 typed data)
36907
- * @returns A hex string hash (SHA-256) suitable for cache keys
37118
+ * @returns A 32-character hash string suitable for cache keys
36908
37119
  * @example
36909
37120
  * ```typescript
36910
37121
  * const typedData = {
@@ -36913,19 +37124,19 @@ declare class SignatureCache {
36913
37124
  * };
36914
37125
  *
36915
37126
  * const hash = SignatureCache.hashMessage(typedData);
36916
- * // Returns SHA-256 hash like: "a1b2c3d4e5f6..."
37127
+ * // Returns something like: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
36917
37128
  * ```
36918
37129
  */
36919
37130
  static hashMessage(message: object): string;
36920
37131
  /**
36921
- * Deterministic JSON replacer that handles BigInt values and sorts object keys
36922
- * This ensures consistent cache key generation for EIP-712 typed data
37132
+ * Custom JSON replacer that converts BigInt values to strings for serialization
37133
+ * This ensures deterministic cache key generation for EIP-712 typed data
36923
37134
  *
36924
37135
  * @param _key - The object key being serialized (unused)
36925
37136
  * @param value - The value to serialize
36926
- * @returns The serialized value with sorted keys for objects
37137
+ * @returns The serialized value
36927
37138
  */
36928
- private static deterministicReplacer;
37139
+ private static bigIntReplacer;
36929
37140
  }
36930
37141
  /**
36931
37142
  * Wrapper function to cache signature operations
@@ -37258,73 +37469,26 @@ declare class NodePlatformAdapter implements VanaPlatformAdapter {
37258
37469
  }
37259
37470
 
37260
37471
  /**
37261
- * Browser implementation of the Vana Platform Adapter using Uint8Array
37472
+ * Browser implementation of the Vana Platform Adapter
37262
37473
  *
37263
- * This implementation uses browser-compatible libraries and native APIs
37264
- * without requiring Buffer or other Node.js polyfills.
37474
+ * This implementation uses browser-compatible libraries and configurations
37475
+ * to provide crypto, PGP, and HTTP functionality without Node.js dependencies.
37476
+ *
37477
+ * WARNING: Dependencies that access globals during init
37478
+ * MUST be dynamically imported to support Turbopack.
37479
+ * See: https://github.com/vercel/next.js/issues/82632
37265
37480
  */
37266
37481
 
37267
37482
  /**
37268
- * Browser implementation of crypto operations using Uint8Array
37269
- */
37270
- declare class BrowserCryptoAdapter implements VanaCryptoAdapter {
37271
- private eciesProvider;
37272
- private walletKeyEncryptionService;
37273
- encryptWithPublicKey(data: string, publicKeyHex: string): Promise<string>;
37274
- decryptWithPrivateKey(encryptedData: string, privateKeyHex: string): Promise<string>;
37275
- encryptWithWalletPublicKey(data: string, publicKey: string): Promise<string>;
37276
- decryptWithWalletPrivateKey(encryptedData: string, privateKey: string): Promise<string>;
37277
- generateKeyPair(): Promise<{
37278
- privateKey: string;
37279
- publicKey: string;
37280
- }>;
37281
- encryptWithPassword(data: Uint8Array, password: string): Promise<Uint8Array>;
37282
- decryptWithPassword(encryptedData: Uint8Array, password: string): Promise<Uint8Array>;
37283
- }
37284
- /**
37285
- * Browser implementation of PGP operations
37286
- */
37287
- declare class BrowserPGPAdapter implements VanaPGPAdapter {
37288
- encrypt(data: string, publicKeyArmored: string): Promise<string>;
37289
- decrypt(encryptedData: string, privateKeyArmored: string): Promise<string>;
37290
- generateKeyPair(options?: {
37291
- name?: string;
37292
- email?: string;
37293
- passphrase?: string;
37294
- }): Promise<{
37295
- publicKey: string;
37296
- privateKey: string;
37297
- }>;
37298
- }
37299
- /**
37300
- * Browser implementation of HTTP operations using Fetch API
37301
- */
37302
- declare class BrowserHttpAdapter implements VanaHttpAdapter {
37303
- fetch(url: string, options?: RequestInit): Promise<Response>;
37304
- }
37305
- /**
37306
- * Browser implementation of caching using sessionStorage for security
37307
- * SessionStorage is cleared when the tab closes, making it more secure for signature caching
37308
- */
37309
- declare class BrowserCacheAdapter implements VanaCacheAdapter {
37310
- private readonly prefix;
37311
- get(key: string): string | null;
37312
- set(key: string, value: string): void;
37313
- delete(key: string): void;
37314
- clear(): void;
37315
- }
37316
- /**
37317
- * Browser implementation of the Vana Platform Adapter
37318
- *
37319
- * This adapter provides all platform-specific functionality for browser environments
37320
- * without requiring any Node.js polyfills.
37483
+ * Complete browser platform adapter implementation
37321
37484
  */
37322
37485
  declare class BrowserPlatformAdapter implements VanaPlatformAdapter {
37323
- readonly crypto: BrowserCryptoAdapter;
37324
- readonly pgp: BrowserPGPAdapter;
37325
- readonly http: BrowserHttpAdapter;
37326
- readonly cache: BrowserCacheAdapter;
37327
- readonly platform: "browser";
37486
+ crypto: VanaCryptoAdapter;
37487
+ pgp: VanaPGPAdapter;
37488
+ http: VanaHttpAdapter;
37489
+ cache: VanaCacheAdapter;
37490
+ platform: "browser";
37491
+ constructor();
37328
37492
  }
37329
37493
 
37330
37494
  /**
@@ -37701,4 +37865,4 @@ declare function Vana(config: VanaConfig): VanaNodeImpl;
37701
37865
  */
37702
37866
  type VanaInstance = VanaNodeImpl;
37703
37867
 
37704
- 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, NodePlatformAdapter, 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 RelayerRequestPayload, 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, SchemaController, 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, 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, VanaNodeImpl, type VanaPlatformAdapter, type WalletConfig, type WalletConfigWithStorage, __contractCache, chains, checkGrantAccess, clearContractCache, type components, convertIpfsUrl, convertIpfsUrlWithFallbacks, createAndStoreGrant, createBrowserPlatformAdapter, createGrantFile, createNodePlatformAdapter, createPlatformAdapter, createPlatformAdapterFor, 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, handleRelayerRequest, 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 };
37868
+ 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 FilePermissionInput, type FilePermissionParams, type FilePermissionTypedData, 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, NodePlatformAdapter, 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 RelayerRequestPayload, 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, SchemaController, 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, 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, VanaNodeImpl, type VanaPlatformAdapter, type WalletConfig, type WalletConfigWithStorage, __contractCache, chains, checkGrantAccess, clearContractCache, type components, convertIpfsUrl, convertIpfsUrlWithFallbacks, createAndStoreGrant, createBrowserPlatformAdapter, createGrantFile, createNodePlatformAdapter, createPlatformAdapter, createPlatformAdapterFor, 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, handleRelayerRequest, 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 };