@opendatalabs/vana-sdk 0.1.0-alpha.670b7a5 → 0.1.0-alpha.6acbe90

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.
@@ -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<{
@@ -33814,66 +33812,6 @@ declare class DataController {
33814
33812
  * for specific files by ID.
33815
33813
  */
33816
33814
  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
33815
  /**
33878
33816
  * Registers a file URL directly on the blockchain with a schema ID.
33879
33817
  *
@@ -33939,64 +33877,6 @@ declare class DataController {
33939
33877
  fileId: number;
33940
33878
  transactionHash: string;
33941
33879
  }>;
33942
- /**
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
33946
- *
33947
- * Migration guide:
33948
- * ```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
33961
- * });
33962
- * ```
33963
- * @param params - Schema parameters including name, type, and definition URL
33964
- * @returns Promise resolving to the new schema ID and transaction hash
33965
- */
33966
- addSchema(params: AddSchemaParams): Promise<AddSchemaResult>;
33967
- /**
33968
- * Retrieves a schema by its ID.
33969
- *
33970
- * @deprecated Since v2.0.0 - Use vana.schemas.get() instead
33971
- *
33972
- * Migration guide:
33973
- * ```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);
33979
- * ```
33980
- * @param schemaId - The schema ID to retrieve
33981
- * @returns Promise resolving to the schema information
33982
- */
33983
- getSchema(schemaId: number): Promise<Schema>;
33984
- /**
33985
- * Gets the total number of schemas in the registry.
33986
- *
33987
- * @deprecated Since v2.0.0 - Use vana.schemas.count() instead
33988
- *
33989
- * Migration guide:
33990
- * ```typescript
33991
- * // Old way (deprecated):
33992
- * const count = await vana.data.getSchemasCount();
33993
- *
33994
- * // New way:
33995
- * const count = await vana.schemas.count();
33996
- * ```
33997
- * @returns Promise resolving to the total schema count
33998
- */
33999
- getSchemasCount(): Promise<number>;
34000
33880
  /**
34001
33881
  * Adds a new refiner to the DataRefinerRegistry.
34002
33882
  *
@@ -34054,13 +33934,13 @@ declare class DataController {
34054
33934
  * Uploads content to storage without registering it on the blockchain.
34055
33935
  * This method only handles the storage upload and returns the file URL.
34056
33936
  *
34057
- * @param content - The content to upload (string, Blob, or Buffer)
34058
- * @param filename - Filename for the uploaded file
33937
+ * @param content - The content to upload (string, Blob, Buffer, or object - objects will be JSON stringified)
33938
+ * @param filename - Optional filename for the uploaded file (defaults to timestamp-based name)
34059
33939
  * @param encrypt - Optional flag to encrypt the content before upload
34060
33940
  * @param providerName - Optional specific storage provider to use
34061
- * @returns Promise resolving to the storage file URL
33941
+ * @returns Promise resolving to the storage upload result with url, size, and contentType
34062
33942
  */
34063
- uploadToStorage(content: string | Blob | Buffer, filename: string, encrypt?: boolean, providerName?: string): Promise<string>;
33943
+ uploadToStorage(content: string | Blob | Buffer | object, filename?: string, encrypt?: boolean, providerName?: string): Promise<StorageUploadResult>;
34064
33944
  /**
34065
33945
  * Adds a permission for a party to access an existing file.
34066
33946
  *