@opendatalabs/vana-sdk 0.1.0-alpha.603cc4b → 0.1.0-alpha.606fa2d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { Chain, Address, Hash, WalletClient, Account, Abi, GetContractReturnType, PublicClient } from 'viem';
1
+ import { Chain, Address, Hash, WalletClient, Account, Abi, GetContractReturnType, TransactionReceipt as TransactionReceipt$1, PublicClient } from 'viem';
2
2
  export { Abi, Account, Address, Chain, GetContractReturnType, Hash, PublicClient, WalletClient } from 'viem';
3
3
  import { Abi as Abi$1 } from 'abitype';
4
4
 
@@ -984,6 +984,8 @@ interface ServerFilesAndPermissionParams {
984
984
  grant: string;
985
985
  /** File URLs */
986
986
  fileUrls: string[];
987
+ /** Schema IDs for each file - use 0 for files without schema validation */
988
+ schemaIds: number[];
987
989
  /** Server address */
988
990
  serverAddress: Address;
989
991
  /** Server URL */
@@ -1009,6 +1011,8 @@ interface ServerFilesAndPermissionTypedData extends GenericTypedData {
1009
1011
  grant: string;
1010
1012
  /** File URLs */
1011
1013
  fileUrls: string[];
1014
+ /** Schema IDs for each file - use 0 for files without schema validation */
1015
+ schemaIds: bigint[];
1012
1016
  /** Server address */
1013
1017
  serverAddress: Address;
1014
1018
  /** Server URL */
@@ -2159,33 +2163,84 @@ interface BatchUploadResult {
2159
2163
  errors?: string[];
2160
2164
  }
2161
2165
  /**
2162
- * Represents a data schema in the refiner registry.
2166
+ * Schema metadata from the blockchain (without fetched definition).
2167
+ *
2168
+ * This represents the on-chain schema registration data before the
2169
+ * definition has been fetched from the storage URL.
2170
+ *
2171
+ * @category Data Management
2172
+ */
2173
+ interface SchemaMetadata {
2174
+ /** Schema ID */
2175
+ id: number;
2176
+ /** Schema name */
2177
+ name: string;
2178
+ /** Schema dialect ('json' or 'sqlite') */
2179
+ dialect: "json" | "sqlite";
2180
+ /** URL containing the schema definition */
2181
+ definitionUrl: string;
2182
+ }
2183
+ /**
2184
+ * Complete schema with all definition fields populated.
2185
+ * This is what schemas.get() returns - a schema with the definition fetched.
2186
+ */
2187
+ interface CompleteSchema extends SchemaMetadata {
2188
+ /** Version of the schema */
2189
+ version: string;
2190
+ /** Optional description of the schema */
2191
+ description?: string;
2192
+ /** Optional version of the dialect */
2193
+ dialectVersion?: string;
2194
+ /** The actual schema - JSON Schema object for 'json' dialect, DDL string for 'sqlite' */
2195
+ schema: object | string;
2196
+ }
2197
+ /**
2198
+ * Schema with optional definition fields.
2163
2199
  *
2164
2200
  * Schemas define the structure and validation rules for user data processed by refiners.
2165
2201
  * They ensure data quality and consistency across the Vana network by specifying how
2166
2202
  * raw user data should be formatted, validated, and processed.
2167
2203
  *
2204
+ * When the definition has been fetched (via schemas.get() or schemas.list() with includeDefinitions),
2205
+ * the version and schema fields will be populated. Otherwise, only the metadata fields are present.
2206
+ *
2168
2207
  * @category Data Management
2169
2208
  * @example
2170
2209
  * ```typescript
2171
- * const socialMediaSchema: Schema = {
2210
+ * // Complete schema from schemas.get()
2211
+ * const completeSchema: Schema = {
2212
+ * id: 5,
2213
+ * name: 'Social Media Profile',
2214
+ * dialect: 'json',
2215
+ * definitionUrl: 'ipfs://QmSchema...',
2216
+ * version: '1.0.0',
2217
+ * description: 'Schema for validating social media profile data',
2218
+ * schema: { // JSON Schema object
2219
+ * type: 'object',
2220
+ * properties: {
2221
+ * username: { type: 'string' }
2222
+ * }
2223
+ * }
2224
+ * };
2225
+ *
2226
+ * // Metadata-only schema from schemas.list() without includeDefinitions
2227
+ * const metadataSchema: Schema = {
2172
2228
  * id: 5,
2173
2229
  * name: 'Social Media Profile',
2174
- * type: 'JSON',
2175
- * url: 'ipfs://QmSchema...', // Schema definition file
2176
- * description: 'Schema for validating social media profile data'
2230
+ * dialect: 'json',
2231
+ * definitionUrl: 'ipfs://QmSchema...'
2177
2232
  * };
2178
2233
  * ```
2179
2234
  */
2180
- interface Schema {
2181
- /** Schema ID */
2182
- id: number;
2183
- /** Schema name */
2184
- name: string;
2185
- /** Schema dialect */
2186
- dialect: string;
2187
- /** URL containing the schema definition */
2188
- definitionUrl: string;
2235
+ interface Schema extends SchemaMetadata {
2236
+ /** Version of the schema (present when definition is fetched) */
2237
+ version?: string;
2238
+ /** Optional description of the schema */
2239
+ description?: string;
2240
+ /** Optional version of the dialect */
2241
+ dialectVersion?: string;
2242
+ /** The actual schema - JSON Schema object for 'json' dialect, DDL string for 'sqlite' (present when definition is fetched) */
2243
+ schema?: object | string;
2189
2244
  }
2190
2245
  /**
2191
2246
  * Represents a refiner with schema information
@@ -2441,6 +2496,18 @@ declare const contractAbis: {
2441
2496
  }];
2442
2497
  readonly name: "InvalidPermissionsLength";
2443
2498
  readonly type: "error";
2499
+ }, {
2500
+ readonly inputs: readonly [{
2501
+ readonly internalType: "uint256";
2502
+ readonly name: "filesLength";
2503
+ readonly type: "uint256";
2504
+ }, {
2505
+ readonly internalType: "uint256";
2506
+ readonly name: "schemaIdsLength";
2507
+ readonly type: "uint256";
2508
+ }];
2509
+ readonly name: "InvalidSchemaIdsLength";
2510
+ readonly type: "error";
2444
2511
  }, {
2445
2512
  readonly inputs: readonly [];
2446
2513
  readonly name: "InvalidSignature";
@@ -2717,6 +2784,10 @@ declare const contractAbis: {
2717
2784
  readonly internalType: "string[]";
2718
2785
  readonly name: "fileUrls";
2719
2786
  readonly type: "string[]";
2787
+ }, {
2788
+ readonly internalType: "uint256[]";
2789
+ readonly name: "schemaIds";
2790
+ readonly type: "uint256[]";
2720
2791
  }, {
2721
2792
  readonly internalType: "address";
2722
2793
  readonly name: "serverAddress";
@@ -3699,7 +3770,7 @@ declare const contractAbis: {
3699
3770
  readonly name: "addServerInput";
3700
3771
  readonly type: "tuple";
3701
3772
  }];
3702
- readonly name: "addAndTrustServerOnBehalf";
3773
+ readonly name: "addAndTrustServerByManager";
3703
3774
  readonly outputs: readonly [];
3704
3775
  readonly stateMutability: "nonpayable";
3705
3776
  readonly type: "function";
@@ -4087,6 +4158,20 @@ declare const contractAbis: {
4087
4158
  readonly outputs: readonly [];
4088
4159
  readonly stateMutability: "nonpayable";
4089
4160
  readonly type: "function";
4161
+ }, {
4162
+ readonly inputs: readonly [{
4163
+ readonly internalType: "address";
4164
+ readonly name: "userAddress";
4165
+ readonly type: "address";
4166
+ }, {
4167
+ readonly internalType: "uint256";
4168
+ readonly name: "serverId";
4169
+ readonly type: "uint256";
4170
+ }];
4171
+ readonly name: "trustServerByManager";
4172
+ readonly outputs: readonly [];
4173
+ readonly stateMutability: "nonpayable";
4174
+ readonly type: "function";
4090
4175
  }, {
4091
4176
  readonly inputs: readonly [{
4092
4177
  readonly components: readonly [{
@@ -28710,6 +28795,95 @@ type VanaContract = keyof ContractAbis;
28710
28795
  */
28711
28796
  declare function getAbi<T extends VanaContract>(contract: T): ContractAbis[T];
28712
28797
 
28798
+ /**
28799
+ * Comprehensive mapping of SDK transaction operations to blockchain events.
28800
+ * Used by the generic transaction parser to know which contract and event
28801
+ * to look for when parsing transaction results.
28802
+ */
28803
+ declare const EVENT_MAPPINGS: {
28804
+ readonly grant: {
28805
+ readonly contract: "DataPortabilityPermissions";
28806
+ readonly event: "PermissionAdded";
28807
+ };
28808
+ readonly revoke: {
28809
+ readonly contract: "DataPortabilityPermissions";
28810
+ readonly event: "PermissionRevoked";
28811
+ };
28812
+ readonly revokePermission: {
28813
+ readonly contract: "DataPortabilityPermissions";
28814
+ readonly event: "PermissionRevoked";
28815
+ };
28816
+ readonly addServerFilesAndPermissions: {
28817
+ readonly contract: "DataPortabilityPermissions";
28818
+ readonly event: "PermissionAdded";
28819
+ };
28820
+ readonly trustServer: {
28821
+ readonly contract: "DataPortabilityServers";
28822
+ readonly event: "ServerTrusted";
28823
+ };
28824
+ readonly untrustServer: {
28825
+ readonly contract: "DataPortabilityServers";
28826
+ readonly event: "ServerUntrusted";
28827
+ };
28828
+ readonly registerServer: {
28829
+ readonly contract: "DataPortabilityServers";
28830
+ readonly event: "ServerRegistered";
28831
+ };
28832
+ readonly updateServer: {
28833
+ readonly contract: "DataPortabilityServers";
28834
+ readonly event: "ServerUpdated";
28835
+ };
28836
+ readonly addAndTrustServer: {
28837
+ readonly contract: "DataPortabilityServers";
28838
+ readonly event: "ServerTrusted";
28839
+ };
28840
+ readonly addFile: {
28841
+ readonly contract: "DataRegistry";
28842
+ readonly event: "FileAdded";
28843
+ };
28844
+ readonly addFileWithPermissionsAndSchema: {
28845
+ readonly contract: "DataRegistry";
28846
+ readonly event: "FileAdded";
28847
+ };
28848
+ readonly addFileWithSchema: {
28849
+ readonly contract: "DataRegistry";
28850
+ readonly event: "FileAdded";
28851
+ };
28852
+ readonly addFileWithPermissions: {
28853
+ readonly contract: "DataRegistry";
28854
+ readonly event: "FileAdded";
28855
+ };
28856
+ readonly addRefinement: {
28857
+ readonly contract: "DataRegistry";
28858
+ readonly event: "RefinementAdded";
28859
+ };
28860
+ readonly addRefiner: {
28861
+ readonly contract: "DataRefinerRegistry";
28862
+ readonly event: "RefinerAdded";
28863
+ };
28864
+ readonly updateSchemaId: {
28865
+ readonly contract: "DataRefinerRegistry";
28866
+ readonly event: "SchemaAdded";
28867
+ };
28868
+ readonly addSchema: {
28869
+ readonly contract: "DataRefinerRegistry";
28870
+ readonly event: "SchemaAdded";
28871
+ };
28872
+ readonly updateRefinement: {
28873
+ readonly contract: "DataRegistry";
28874
+ readonly event: "RefinementUpdated";
28875
+ };
28876
+ readonly addFilePermission: {
28877
+ readonly contract: "DataRegistry";
28878
+ readonly event: "PermissionGranted";
28879
+ };
28880
+ readonly registerGrantee: {
28881
+ readonly contract: "DataPortabilityGrantees";
28882
+ readonly event: "GranteeRegistered";
28883
+ };
28884
+ };
28885
+ type TransactionOperation = keyof typeof EVENT_MAPPINGS;
28886
+
28713
28887
  /**
28714
28888
  * Base interface for all transaction results.
28715
28889
  * Contains the event data plus transaction metadata.
@@ -28747,6 +28921,50 @@ interface PermissionRevokeResult extends BaseTransactionResult {
28747
28921
  /** ID of the permission that was revoked */
28748
28922
  permissionId: bigint;
28749
28923
  }
28924
+ /**
28925
+ * Result of a successful server trust operation.
28926
+ * Contains data from the ServerTrusted blockchain event.
28927
+ */
28928
+ interface ServerTrustResult extends BaseTransactionResult {
28929
+ /** Address of the user who trusted the server */
28930
+ user: Address;
28931
+ /** Address/ID of the trusted server */
28932
+ serverId: Address;
28933
+ /** URL of the trusted server */
28934
+ serverUrl: string;
28935
+ }
28936
+ /**
28937
+ * Result of a successful server untrust operation.
28938
+ * Contains data from the ServerUntrusted blockchain event.
28939
+ */
28940
+ interface ServerUntrustResult extends BaseTransactionResult {
28941
+ /** Address of the user who untrusted the server */
28942
+ user: Address;
28943
+ /** Address/ID of the untrusted server */
28944
+ serverId: Address;
28945
+ }
28946
+ /**
28947
+ * Result of a successful server update operation.
28948
+ * Contains data from the ServerUpdated blockchain event.
28949
+ */
28950
+ interface ServerUpdateResult extends BaseTransactionResult {
28951
+ /** ID of the server that was updated */
28952
+ serverId: bigint;
28953
+ /** New URL of the server */
28954
+ url: string;
28955
+ }
28956
+ /**
28957
+ * Result of a successful grantee registration operation.
28958
+ * Contains data from the GranteeRegistered blockchain event.
28959
+ */
28960
+ interface GranteeRegisterResult extends BaseTransactionResult {
28961
+ /** Unique grantee ID assigned by the registry */
28962
+ granteeId: bigint;
28963
+ /** Address of the registered grantee */
28964
+ granteeAddress: Address;
28965
+ /** Display name of the grantee */
28966
+ name: string;
28967
+ }
28750
28968
  /**
28751
28969
  * Result of a successful file permission addition operation.
28752
28970
  * Contains data from the FilePermissionAdded blockchain event.
@@ -28760,6 +28978,80 @@ interface FilePermissionResult extends BaseTransactionResult {
28760
28978
  encryptedKey: string;
28761
28979
  }
28762
28980
 
28981
+ /**
28982
+ * Provides a unified interface for blockchain transaction results with lazy-loaded event parsing.
28983
+ *
28984
+ * @remarks
28985
+ * TransactionHandle enables immediate access to transaction hashes while providing optional
28986
+ * lazy-loaded access to receipts and parsed event data. All transaction-submitting methods
28987
+ * in the SDK return this handle, allowing developers to choose between immediate hash access
28988
+ * or waiting for event data. Results are memoized to prevent redundant network calls.
28989
+ *
28990
+ * @category Transactions
28991
+ * @example
28992
+ * ```typescript
28993
+ * // Immediate hash access
28994
+ * const tx = await sdk.permissions.submitSignedGrant(typedData, signature);
28995
+ * console.log(`Transaction submitted: ${tx.hash}`);
28996
+ *
28997
+ * // Wait for and parse events
28998
+ * const eventData = await tx.waitForEvents();
28999
+ * console.log(`Permission ID: ${eventData.permissionId}`);
29000
+ *
29001
+ * // Check receipt for gas usage
29002
+ * const receipt = await tx.waitForReceipt();
29003
+ * console.log(`Gas used: ${receipt.gasUsed}`);
29004
+ * ```
29005
+ */
29006
+ declare class TransactionHandle<TEventData = unknown> {
29007
+ private readonly context;
29008
+ readonly hash: Hash;
29009
+ private readonly operation?;
29010
+ private _receipt?;
29011
+ private _eventData?;
29012
+ private _receiptPromise?;
29013
+ private _eventPromise?;
29014
+ constructor(context: ControllerContext$1, hash: Hash, operation?: TransactionOperation | undefined);
29015
+ /**
29016
+ * Waits for transaction confirmation and returns the receipt.
29017
+ * Results are memoized - multiple calls return the same promise.
29018
+ *
29019
+ * @param options Optional timeout configuration
29020
+ * @param options.timeout Timeout in milliseconds (default: 30000)
29021
+ * @returns Transaction receipt with gas usage, logs, and status
29022
+ */
29023
+ waitForReceipt(options?: {
29024
+ timeout?: number;
29025
+ }): Promise<TransactionReceipt$1>;
29026
+ /**
29027
+ * Waits for transaction confirmation and parses emitted events.
29028
+ * Results are memoized - multiple calls return the same promise.
29029
+ *
29030
+ * @returns Parsed event data with transaction metadata
29031
+ * @throws {Error} If no operation was specified for event parsing
29032
+ */
29033
+ waitForEvents(): Promise<TEventData>;
29034
+ /**
29035
+ * Enables string coercion for backwards compatibility.
29036
+ * Allows TransactionHandle to be used anywhere a Hash is expected.
29037
+ *
29038
+ * @example
29039
+ * ```typescript
29040
+ * const hash: Hash = tx; // Works via toString()
29041
+ * console.log(`Transaction: ${tx}`); // Prints hash
29042
+ * ```
29043
+ * @returns The transaction hash as a string
29044
+ */
29045
+ toString(): string;
29046
+ /**
29047
+ * JSON serialization support.
29048
+ * Returns the hash when serialized to JSON.
29049
+ *
29050
+ * @returns The transaction hash for JSON serialization
29051
+ */
29052
+ toJSON(): string;
29053
+ }
29054
+
28763
29055
  /**
28764
29056
  * Google Drive Storage Provider for Vana SDK
28765
29057
  *
@@ -29798,30 +30090,31 @@ declare class PermissionsController {
29798
30090
  */
29799
30091
  grant(params: GrantPermissionParams$1): Promise<PermissionGrantResult>;
29800
30092
  /**
29801
- * Submits a permission grant transaction and returns the transaction hash immediately.
30093
+ * Submits a permission grant transaction and returns a handle for flexible result access.
29802
30094
  *
29803
- * This is the lower-level method that provides maximum control over transaction timing.
29804
- * Use this when you want to handle transaction confirmation and event parsing separately,
29805
- * or when submitting multiple transactions in batch.
30095
+ * @remarks
30096
+ * This lower-level method provides maximum control over transaction timing.
30097
+ * Returns a TransactionHandle that allows immediate hash access or optional event parsing.
30098
+ * Use this when handling multiple transactions or when you need granular control.
29806
30099
  *
29807
30100
  * @param params - The permission grant configuration object
29808
- * @returns Promise that resolves to the transaction hash when successfully submitted
30101
+ * @returns Promise resolving to TransactionHandle with hash and event parsing capabilities
29809
30102
  * @throws {RelayerError} When gasless transaction submission fails
29810
30103
  * @throws {SignatureError} When user rejects the signature request
29811
30104
  * @throws {SerializationError} When grant data cannot be serialized
29812
30105
  * @throws {BlockchainError} When permission grant preparation fails
29813
30106
  * @example
29814
30107
  * ```typescript
29815
- * // Submit transaction and handle confirmation later
29816
- * const txHash = await vana.permissions.submitPermissionGrant(params);
29817
- * console.log(`Transaction submitted: ${txHash}`);
30108
+ * // Submit transaction and get immediate hash access
30109
+ * const tx = await vana.permissions.submitPermissionGrant(params);
30110
+ * console.log(`Transaction submitted: ${tx.hash}`);
29818
30111
  *
29819
- * // Later, when you need the permission data:
29820
- * const result = await parseTransactionResult(context, txHash, 'grant');
29821
- * console.log(`Permission ID: ${result.permissionId}`);
30112
+ * // Optionally wait for and parse events
30113
+ * const eventData = await tx.waitForEvents();
30114
+ * console.log(`Permission ID: ${eventData.permissionId}`);
29822
30115
  * ```
29823
30116
  */
29824
- submitPermissionGrant(params: GrantPermissionParams$1): Promise<Hash>;
30117
+ submitPermissionGrant(params: GrantPermissionParams$1): Promise<TransactionHandle<PermissionGrantResult>>;
29825
30118
  /**
29826
30119
  * Prepares a permission grant with preview before signing.
29827
30120
  *
@@ -29849,15 +30142,21 @@ declare class PermissionsController {
29849
30142
  */
29850
30143
  prepareGrant(params: GrantPermissionParams$1): Promise<{
29851
30144
  preview: GrantFile;
29852
- confirm: () => Promise<Hash>;
30145
+ confirm: () => Promise<TransactionHandle<PermissionGrantResult>>;
29853
30146
  }>;
29854
30147
  /**
29855
- * Internal method to complete the grant process after user confirmation.
29856
- * This is called by the confirm() function returned from prepareGrant().
30148
+ * Completes the grant process after user confirmation.
30149
+ *
30150
+ * @remarks
30151
+ * This internal method is called by the confirm() function returned from prepareGrant().
30152
+ * It handles IPFS upload, signature creation, and transaction submission.
29857
30153
  *
29858
30154
  * @param params - The permission grant parameters containing user and operation details
29859
30155
  * @param grantFile - The prepared grant file with permissions and metadata
29860
- * @returns Promise resolving to the transaction hash
30156
+ * @returns Promise resolving to TransactionHandle for flexible result access
30157
+ * @throws {BlockchainError} When permission grant confirmation fails
30158
+ * @throws {NetworkError} When IPFS upload fails
30159
+ * @throws {SignatureError} When user rejects the signature
29861
30160
  */
29862
30161
  private confirmGrantInternal;
29863
30162
  /**
@@ -29913,49 +30212,106 @@ declare class PermissionsController {
29913
30212
  * );
29914
30213
  * ```
29915
30214
  */
29916
- submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<Hash>;
30215
+ submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
29917
30216
  /**
29918
30217
  * Submits an already-signed trust server transaction to the blockchain.
30218
+ *
30219
+ * @remarks
29919
30220
  * This method extracts the trust server input from typed data and submits it directly.
30221
+ * Used internally by trust server methods after signature collection.
29920
30222
  *
29921
30223
  * @param typedData - The EIP-712 typed data for TrustServer
29922
- * @param signature - The user's signature
29923
- * @returns Promise resolving to the transaction hash
30224
+ * @param signature - The user's signature obtained via `signTypedData()`
30225
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30226
+ * @throws {BlockchainError} When contract submission fails
30227
+ * @throws {NetworkError} When blockchain communication fails
30228
+ * @example
30229
+ * ```typescript
30230
+ * const txHandle = await vana.permissions.submitSignedTrustServer(
30231
+ * typedData,
30232
+ * "0x1234..."
30233
+ * );
30234
+ * const result = await txHandle.waitForEvents();
30235
+ * ```
29924
30236
  */
29925
- submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<Hash>;
30237
+ submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
29926
30238
  /**
29927
30239
  * Submits an already-signed add and trust server transaction to the blockchain.
30240
+ *
30241
+ * @remarks
29928
30242
  * This method extracts the add and trust server input from typed data and submits it directly.
30243
+ * Combines server registration and trust operations in a single transaction.
29929
30244
  *
29930
30245
  * @param typedData - The EIP-712 typed data for AddAndTrustServer
29931
- * @param signature - The user's signature
29932
- * @returns Promise resolving to the transaction hash
30246
+ * @param signature - The user's signature obtained via `signTypedData()`
30247
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30248
+ * @throws {BlockchainError} When contract submission fails
30249
+ * @throws {NetworkError} When blockchain communication fails
30250
+ * @example
30251
+ * ```typescript
30252
+ * const txHandle = await vana.permissions.submitSignedAddAndTrustServer(
30253
+ * typedData,
30254
+ * "0x1234..."
30255
+ * );
30256
+ * const result = await txHandle.waitForEvents();
30257
+ * ```
29933
30258
  */
29934
- submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<Hash>;
30259
+ submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
29935
30260
  /**
29936
30261
  * Submits an already-signed permission revoke transaction to the blockchain.
30262
+ *
30263
+ * @remarks
29937
30264
  * This method handles the revocation of previously granted permissions.
30265
+ * Used internally by revocation methods after signature collection.
29938
30266
  *
29939
30267
  * @param typedData - The EIP-712 typed data for PermissionRevoke
29940
- * @param signature - The user's signature
29941
- * @returns Promise resolving to the transaction hash
30268
+ * @param signature - The user's signature obtained via `signTypedData()`
30269
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30270
+ * @throws {BlockchainError} When contract submission fails
30271
+ * @throws {NetworkError} When blockchain communication fails
30272
+ * @example
30273
+ * ```typescript
30274
+ * const txHandle = await vana.permissions.submitSignedRevoke(
30275
+ * typedData,
30276
+ * "0x1234..."
30277
+ * );
30278
+ * const result = await txHandle.waitForEvents();
30279
+ * ```
29942
30280
  */
29943
- submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30281
+ submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionRevokeResult>>;
29944
30282
  /**
29945
30283
  * Submits an already-signed untrust server transaction to the blockchain.
30284
+ *
30285
+ * @remarks
29946
30286
  * This method handles the removal of trusted servers.
30287
+ * Used internally by untrust server methods after signature collection.
29947
30288
  *
29948
30289
  * @param typedData - The EIP-712 typed data for UntrustServer
29949
- * @param signature - The user's signature
29950
- * @returns Promise resolving to the transaction hash
30290
+ * @param signature - The user's signature obtained via `signTypedData()`
30291
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30292
+ * @throws {BlockchainError} When contract submission fails
30293
+ * @throws {NetworkError} When blockchain communication fails
30294
+ * @example
30295
+ * ```typescript
30296
+ * const txHandle = await vana.permissions.submitSignedUntrustServer(
30297
+ * typedData,
30298
+ * "0x1234..."
30299
+ * );
30300
+ * const result = await txHandle.waitForEvents();
30301
+ * ```
29951
30302
  */
29952
- submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30303
+ submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<ServerUntrustResult>>;
29953
30304
  /**
29954
30305
  * Submits a signed transaction directly to the blockchain.
29955
30306
  *
30307
+ * @remarks
30308
+ * Internal method used when relayer callbacks are not available. Formats the signature
30309
+ * and submits the permission grant directly to the smart contract.
30310
+ *
29956
30311
  * @param typedData - The typed data structure for the permission grant
29957
30312
  * @param signature - The cryptographic signature authorizing the transaction
29958
30313
  * @returns Promise resolving to the transaction hash
30314
+ * @throws {BlockchainError} When contract submission fails
29959
30315
  */
29960
30316
  private submitDirectTransaction;
29961
30317
  /**
@@ -30002,19 +30358,33 @@ declare class PermissionsController {
30002
30358
  * console.log(`Revocation submitted: ${txHash}`);
30003
30359
  * ```
30004
30360
  */
30005
- submitPermissionRevoke(params: RevokePermissionParams): Promise<Hash>;
30361
+ submitPermissionRevoke(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
30006
30362
  /**
30007
- * Revokes a permission with a signature (gasless transaction).
30363
+ * Revokes a permission with a signature for gasless transactions.
30364
+ *
30365
+ * @remarks
30366
+ * This method creates an EIP-712 signature for permission revocation and submits
30367
+ * it either through relayer callbacks or directly to the blockchain. Provides
30368
+ * gasless revocation when relayer is configured.
30008
30369
  *
30009
30370
  * @param params - Parameters for revoking the permission
30010
- * @returns Promise resolving to transaction hash
30371
+ * @param params.permissionId - Permission identifier to revoke (accepts bigint, number, or string)
30372
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30011
30373
  * @throws {BlockchainError} When chain ID is not available
30012
30374
  * @throws {NonceError} When retrieving user nonce fails
30013
30375
  * @throws {SignatureError} When user rejects the signature request
30014
30376
  * @throws {RelayerError} When gasless submission fails
30015
30377
  * @throws {PermissionError} When revocation fails for any other reason
30378
+ * @example
30379
+ * ```typescript
30380
+ * const txHandle = await vana.permissions.submitRevokeWithSignature({
30381
+ * permissionId: 123n
30382
+ * });
30383
+ * const result = await txHandle.waitForEvents();
30384
+ * console.log(`Permission ${result.permissionId} revoked`);
30385
+ * ```
30016
30386
  */
30017
- submitRevokeWithSignature(params: RevokePermissionParams): Promise<Hash>;
30387
+ submitRevokeWithSignature(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
30018
30388
  /**
30019
30389
  * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30020
30390
  *
@@ -30039,6 +30409,18 @@ declare class PermissionsController {
30039
30409
  * const serversNonce = await this.getServersUserNonce();
30040
30410
  * ```
30041
30411
  */
30412
+ /**
30413
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30414
+ *
30415
+ * Retrieves the user's current nonce from the DataPortabilityServers contract.
30416
+ *
30417
+ * @remarks
30418
+ * This method is deprecated in favor of more specific nonce methods that target
30419
+ * the appropriate contract for the operation being performed.
30420
+ *
30421
+ * @returns Promise resolving to the user's current nonce as a bigint
30422
+ * @throws {NonceError} When retrieving the nonce fails
30423
+ */
30042
30424
  private getUserNonce;
30043
30425
  /**
30044
30426
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
@@ -30054,6 +30436,16 @@ declare class PermissionsController {
30054
30436
  * console.log(`Current servers nonce: ${nonce}`);
30055
30437
  * ```
30056
30438
  */
30439
+ /**
30440
+ * Retrieves the user's current nonce from the DataPortabilityServers contract.
30441
+ *
30442
+ * @remarks
30443
+ * Used for server-related operations (trust/untrust) to prevent replay attacks.
30444
+ * The nonce must be incremented with each server operation.
30445
+ *
30446
+ * @returns Promise resolving to the user's current nonce as a bigint
30447
+ * @throws {NonceError} When retrieving the nonce fails
30448
+ */
30057
30449
  private getServersUserNonce;
30058
30450
  /**
30059
30451
  * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
@@ -30069,6 +30461,16 @@ declare class PermissionsController {
30069
30461
  * console.log(`Current permissions nonce: ${nonce}`);
30070
30462
  * ```
30071
30463
  */
30464
+ /**
30465
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
30466
+ *
30467
+ * @remarks
30468
+ * Used for permission-related operations (grant/revoke) to prevent replay attacks.
30469
+ * The nonce must be incremented with each permission operation.
30470
+ *
30471
+ * @returns Promise resolving to the user's current nonce as a bigint
30472
+ * @throws {NonceError} When retrieving the nonce fails
30473
+ */
30072
30474
  private getPermissionsUserNonce;
30073
30475
  /**
30074
30476
  * Composes the EIP-712 typed data for PermissionGrant (new simplified format).
@@ -30090,6 +30492,7 @@ declare class PermissionsController {
30090
30492
  * @param params.granteeId - Grantee ID
30091
30493
  * @param params.grant - Grant URL or grant data
30092
30494
  * @param params.fileUrls - Array of file URLs
30495
+ * @param params.schemaIds - Schema IDs for each file
30093
30496
  * @param params.serverAddress - Server address
30094
30497
  * @param params.serverUrl - Server URL
30095
30498
  * @param params.serverPublicKey - Server public key
@@ -30195,7 +30598,7 @@ declare class PermissionsController {
30195
30598
  * console.log('Now trusting servers:', trustedServers);
30196
30599
  * ```
30197
30600
  */
30198
- addAndTrustServer(params: AddAndTrustServerParams): Promise<Hash>;
30601
+ addAndTrustServer(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30199
30602
  /**
30200
30603
  * Trusts a server for data processing (legacy method).
30201
30604
  *
@@ -30203,14 +30606,14 @@ declare class PermissionsController {
30203
30606
  * @returns Promise resolving to transaction hash
30204
30607
  * @deprecated Use addAndTrustServer instead
30205
30608
  */
30206
- submitTrustServer(params: TrustServerParams): Promise<Hash>;
30609
+ submitTrustServer(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30207
30610
  /**
30208
30611
  * Adds and trusts a server using a signature (gasless transaction).
30209
30612
  *
30210
30613
  * @param params - Parameters for adding and trusting the server
30211
- * @returns Promise resolving to transaction hash
30614
+ * @returns Promise resolving to TransactionHandle with ServerTrustResult event data
30212
30615
  */
30213
- submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<Hash>;
30616
+ submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30214
30617
  /**
30215
30618
  * Trusts a server using a signature (gasless transaction - legacy method).
30216
30619
  *
@@ -30224,13 +30627,24 @@ declare class PermissionsController {
30224
30627
  * @throws {ServerUrlMismatchError} When server URL doesn't match existing registration
30225
30628
  * @throws {BlockchainError} When trust operation fails for any other reason
30226
30629
  */
30227
- submitTrustServerWithSignature(params: TrustServerParams): Promise<Hash>;
30630
+ submitTrustServerWithSignature(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30228
30631
  /**
30229
30632
  * Submits a direct untrust server transaction (without signature).
30230
30633
  *
30231
30634
  * @param params - The untrust server parameters containing server details
30232
30635
  * @returns Promise resolving to the transaction hash
30233
30636
  */
30637
+ /**
30638
+ * Submits an untrust server transaction directly to the blockchain.
30639
+ *
30640
+ * @remarks
30641
+ * Internal method used for direct blockchain submission of untrust server operations
30642
+ * when relayer callbacks are not available.
30643
+ *
30644
+ * @param params - The untrust server parameters
30645
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30646
+ * @throws {BlockchainError} When contract submission fails
30647
+ */
30234
30648
  private submitDirectUntrustTransaction;
30235
30649
  /**
30236
30650
  * Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
@@ -30260,7 +30674,7 @@ declare class PermissionsController {
30260
30674
  * console.log('Still trusting servers:', trustedServers);
30261
30675
  * ```
30262
30676
  */
30263
- submitUntrustServer(params: UntrustServerParams): Promise<Hash>;
30677
+ submitUntrustServer(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
30264
30678
  /**
30265
30679
  * Untrusts a server using a signature (gasless transaction).
30266
30680
  *
@@ -30273,7 +30687,7 @@ declare class PermissionsController {
30273
30687
  * @throws {RelayerError} When gasless submission fails
30274
30688
  * @throws {BlockchainError} When untrust transaction fails
30275
30689
  */
30276
- submitUntrustServerWithSignature(params: UntrustServerParams): Promise<Hash>;
30690
+ submitUntrustServerWithSignature(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
30277
30691
  /**
30278
30692
  * Retrieves all servers trusted by a user from the DataPortabilityServers contract.
30279
30693
  *
@@ -30324,22 +30738,60 @@ declare class PermissionsController {
30324
30738
  /**
30325
30739
  * Gets server information for multiple servers efficiently.
30326
30740
  *
30327
- * @param serverIds - Array of server IDs to query
30328
- * @returns Promise resolving to batch result with successes and failures
30741
+ * @remarks
30742
+ * This method uses multicall to fetch information for multiple servers in a single
30743
+ * blockchain call, improving performance when querying many servers. Failed lookups
30744
+ * are returned separately for error handling.
30745
+ *
30746
+ * @param serverIds - Array of numeric server IDs to query
30747
+ * @returns Promise resolving to batch result containing successful lookups and failed IDs
30329
30748
  * @throws {BlockchainError} When reading from contract fails or chain is unavailable
30749
+ * @example
30750
+ * ```typescript
30751
+ * const result = await vana.permissions.getServerInfoBatch([1, 2, 3, 999]);
30752
+ *
30753
+ * // Process successful lookups
30754
+ * result.servers.forEach((server, id) => {
30755
+ * console.log(`Server ${id}: ${server.url}`);
30756
+ * });
30757
+ *
30758
+ * // Handle failed lookups
30759
+ * if (result.failed.length > 0) {
30760
+ * console.log(`Failed to fetch: ${result.failed.join(', ')}`);
30761
+ * }
30762
+ * ```
30330
30763
  */
30331
30764
  getServerInfoBatch(serverIds: number[]): Promise<BatchServerInfoResult>;
30332
30765
  /**
30333
30766
  * Checks whether a specific server is trusted by a user.
30334
30767
  *
30335
- * @param serverId - Server ID to check (numeric)
30768
+ * @remarks
30769
+ * This method queries the user's trusted server list and checks if the specified
30770
+ * server is present. Returns both the trust status and the index in the trust list
30771
+ * if trusted.
30772
+ *
30773
+ * @param serverId - Numeric server ID to check
30336
30774
  * @param userAddress - Optional user address (defaults to current user)
30337
- * @returns Promise resolving to server trust status
30775
+ * @returns Promise resolving to server trust status with trust index if applicable
30776
+ * @throws {BlockchainError} When reading from contract fails
30777
+ * @example
30778
+ * ```typescript
30779
+ * const status = await vana.permissions.checkServerTrustStatus(1);
30780
+ * if (status.isTrusted) {
30781
+ * console.log(`Server is trusted at index ${status.trustIndex}`);
30782
+ * } else {
30783
+ * console.log('Server is not trusted');
30784
+ * }
30785
+ * ```
30338
30786
  */
30339
30787
  checkServerTrustStatus(serverId: number, userAddress?: Address): Promise<ServerTrustStatus>;
30340
30788
  /**
30341
30789
  * Composes EIP-712 typed data for AddAndTrustServer.
30342
30790
  *
30791
+ * @remarks
30792
+ * Creates the complete typed data structure required for EIP-712 signature generation
30793
+ * when adding and trusting a new server in a single transaction.
30794
+ *
30343
30795
  * @param input - The add and trust server input data containing server details
30344
30796
  * @returns Promise resolving to the typed data structure for server add and trust
30345
30797
  */
@@ -30421,7 +30873,7 @@ declare class PermissionsController {
30421
30873
  * console.log(`Grantee registered in transaction: ${txHash}`);
30422
30874
  * ```
30423
30875
  */
30424
- submitRegisterGrantee(params: RegisterGranteeParams): Promise<Hash>;
30876
+ submitRegisterGrantee(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
30425
30877
  /**
30426
30878
  * Registers a grantee with a signature (gasless transaction)
30427
30879
  *
@@ -30437,7 +30889,7 @@ declare class PermissionsController {
30437
30889
  * });
30438
30890
  * ```
30439
30891
  */
30440
- submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<Hash>;
30892
+ submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
30441
30893
  /**
30442
30894
  * Submits a signed register grantee transaction via relayer
30443
30895
  *
@@ -30450,7 +30902,7 @@ declare class PermissionsController {
30450
30902
  * const result = await vana.permissions.submitSignedRegisterGrantee(typedData, signature);
30451
30903
  * ```
30452
30904
  */
30453
- submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<Hash>;
30905
+ submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<TransactionHandle<GranteeRegisterResult>>;
30454
30906
  /**
30455
30907
  * Retrieves all registered grantees from the DataPortabilityGrantees contract.
30456
30908
  *
@@ -30737,7 +31189,7 @@ declare class PermissionsController {
30737
31189
  * @param url - New URL for the server
30738
31190
  * @returns Promise resolving to transaction hash
30739
31191
  */
30740
- submitUpdateServer(serverId: bigint, url: string): Promise<Hash>;
31192
+ submitUpdateServer(serverId: bigint, url: string): Promise<TransactionHandle<ServerUpdateResult>>;
30741
31193
  /**
30742
31194
  * Get all permission IDs for a user
30743
31195
  *
@@ -30777,49 +31229,106 @@ declare class PermissionsController {
30777
31229
  * @throws {BlockchainError} When permission addition fails
30778
31230
  * @throws {NetworkError} When network communication fails
30779
31231
  */
30780
- submitAddPermission(params: ServerFilesAndPermissionParams): Promise<Hash>;
31232
+ submitAddPermission(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
30781
31233
  /**
30782
31234
  * Submits an already-signed add permission transaction to the blockchain.
30783
31235
  * This method supports both relayer-based gasless transactions and direct transactions.
30784
31236
  *
30785
31237
  * @param typedData - The EIP-712 typed data for AddPermission
30786
31238
  * @param signature - The user's signature
30787
- * @returns Promise resolving to the transaction hash
31239
+ * @returns Promise resolving to TransactionHandle with PermissionGrantResult event data
30788
31240
  * @throws {RelayerError} When gasless transaction submission fails
30789
31241
  * @throws {BlockchainError} When permission addition fails
30790
31242
  * @throws {NetworkError} When network communication fails
30791
31243
  */
30792
- submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
31244
+ submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
30793
31245
  /**
30794
- * Submit server files and permissions with signature to the blockchain (supports gasless transactions)
31246
+ * Submits server files and permissions with signature to the blockchain, supporting schema validation and gasless transactions.
31247
+ *
31248
+ * @remarks
31249
+ * This method validates files against their specified schemas before submission.
31250
+ * Schema validation ensures data conforms to expected formats before on-chain registration.
31251
+ * Files with schemaId = 0 bypass validation. The method supports atomic batch operations
31252
+ * where all files and permissions are registered in a single transaction.
30795
31253
  *
30796
31254
  * @param params - Parameters for adding server files and permissions
30797
- * @returns Promise resolving to transaction hash
30798
- * @throws {RelayerError} When gasless transaction submission fails
31255
+ * @param params.granteeId - The ID of the permission grantee
31256
+ * @param params.grant - Grant URL containing permission parameters (typically IPFS)
31257
+ * @param params.fileUrls - Array of file URLs to register
31258
+ * @param params.schemaIds - Schema IDs for each file. Use 0 for files without schema validation.
31259
+ * Array length must match fileUrls length.
31260
+ * @param params.serverAddress - Server wallet address for decryption permissions
31261
+ * @param params.serverUrl - Server endpoint URL
31262
+ * @param params.serverPublicKey - Server's public key for encryption.
31263
+ * Obtain via `vana.server.getIdentity(userAddress).public_key`.
31264
+ * @param params.filePermissions - Nested array of permissions for each file
31265
+ * @returns TransactionHandle with immediate hash access and event parsing capability
31266
+ * @throws {Error} When schemaIds array length doesn't match fileUrls array length
31267
+ * @throws {SchemaValidationError} When file data doesn't match the specified schema.
31268
+ * Verify data structure matches schema definition from `vana.schemas.get(schemaId)`.
31269
+ * @throws {RelayerError} When gasless transaction submission fails.
31270
+ * Retry without relayer configuration to submit direct transaction.
30799
31271
  * @throws {SignatureError} When user rejects the signature request
30800
31272
  * @throws {BlockchainError} When server files and permissions addition fails
30801
- * @throws {NetworkError} When network communication fails
31273
+ * @throws {NetworkError} When network communication fails.
31274
+ * Check network connection or configure alternative gateways.
31275
+ *
31276
+ * @example
31277
+ * ```typescript
31278
+ * const result = await vana.permissions.submitAddServerFilesAndPermissions({
31279
+ * granteeId: BigInt(1),
31280
+ * grant: "ipfs://QmXxx...",
31281
+ * fileUrls: ["https://storage.example.com/data.json"],
31282
+ * schemaIds: [123], // LinkedIn profile schema ID
31283
+ * serverAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
31284
+ * serverUrl: "https://server.example.com",
31285
+ * serverPublicKey: serverInfo.public_key,
31286
+ * filePermissions: [[{
31287
+ * account: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
31288
+ * key: encryptedKey
31289
+ * }]]
31290
+ * });
31291
+ * const events = await result.waitForEvents();
31292
+ * console.log(`Permission ID: ${events.permissionId}`);
31293
+ * ```
30802
31294
  */
30803
- submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<Hash>;
31295
+ submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
30804
31296
  /**
30805
31297
  * Submits an already-signed add server files and permissions transaction to the blockchain.
30806
- * This method supports both relayer-based gasless transactions and direct transactions.
31298
+ *
31299
+ * @remarks
31300
+ * This method returns a TransactionHandle that provides immediate access to the transaction hash
31301
+ * while allowing lazy-loaded access to parsed event data. Use `waitForEvents()` to retrieve
31302
+ * the permission ID and other event details after transaction confirmation.
30807
31303
  *
30808
31304
  * @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
30809
31305
  * @param signature - The user's signature
30810
- * @returns Promise resolving to the transaction hash
31306
+ * @returns TransactionHandle with immediate hash access and optional event parsing
30811
31307
  * @throws {RelayerError} When gasless transaction submission fails
30812
31308
  * @throws {BlockchainError} When server files and permissions addition fails
30813
31309
  * @throws {NetworkError} When network communication fails
31310
+ *
31311
+ * @example
31312
+ * ```typescript
31313
+ * const tx = await vana.permissions.submitSignedAddServerFilesAndPermissions(
31314
+ * typedData,
31315
+ * signature
31316
+ * );
31317
+ * console.log(`Transaction submitted: ${tx.hash}`);
31318
+ *
31319
+ * // Wait for confirmation and get the permission ID
31320
+ * const { permissionId } = await tx.waitForEvents();
31321
+ * console.log(`Permission created with ID: ${permissionId}`);
31322
+ * ```
30814
31323
  */
30815
- submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<Hash>;
31324
+ submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
30816
31325
  /**
30817
31326
  * Submit permission revocation with signature to the blockchain
30818
31327
  *
30819
31328
  * @param permissionId - Permission ID to revoke
30820
31329
  * @returns Promise resolving to transaction hash
30821
31330
  */
30822
- submitRevokePermission(permissionId: bigint): Promise<Hash>;
31331
+ submitRevokePermission(permissionId: bigint): Promise<TransactionHandle<PermissionRevokeResult>>;
30823
31332
  /**
30824
31333
  * Submits a signed add permission transaction directly to the blockchain.
30825
31334
  *
@@ -30849,10 +31358,10 @@ declare class PermissionsController {
30849
31358
  interface CreateSchemaParams {
30850
31359
  /** The name of the schema */
30851
31360
  name: string;
30852
- /** The type/category of the schema */
30853
- type: string;
31361
+ /** The dialect of the schema (e.g., 'json' or 'sqlite') */
31362
+ dialect: "json" | "sqlite";
30854
31363
  /** The schema definition object or JSON string */
30855
- definition: object | string;
31364
+ schema: object | string;
30856
31365
  }
30857
31366
  /**
30858
31367
  * Result of creating a new schema.
@@ -30897,8 +31406,8 @@ interface CreateSchemaResult {
30897
31406
  * // Create a new schema with automatic IPFS upload
30898
31407
  * const result = await vana.schemas.create({
30899
31408
  * name: "User Profile",
30900
- * type: "personal",
30901
- * definition: {
31409
+ * dialect: "json",
31410
+ * schema: {
30902
31411
  * type: "object",
30903
31412
  * properties: {
30904
31413
  * name: { type: "string" },
@@ -30933,7 +31442,7 @@ declare class SchemaController {
30933
31442
  * - Uploads the definition to IPFS to generate a permanent URL
30934
31443
  * - Registers the schema on the blockchain with the generated URL
30935
31444
  *
30936
- * @param params - Schema creation parameters including name, type, and definition
31445
+ * @param params - Schema creation parameters including name, dialect, and definition
30937
31446
  * @returns Promise resolving to creation results with schema ID and transaction hash
30938
31447
  * @throws {SchemaValidationError} When the schema definition is invalid
30939
31448
  * @throws {Error} When IPFS upload or blockchain registration fails
@@ -30942,8 +31451,8 @@ declare class SchemaController {
30942
31451
  * // Create a JSON schema for user profiles
30943
31452
  * const result = await vana.schemas.create({
30944
31453
  * name: "User Profile",
30945
- * type: "personal",
30946
- * definition: {
31454
+ * dialect: "json",
31455
+ * schema: {
30947
31456
  * type: "object",
30948
31457
  * properties: {
30949
31458
  * name: { type: "string" },
@@ -30958,27 +31467,28 @@ declare class SchemaController {
30958
31467
  */
30959
31468
  create(params: CreateSchemaParams): Promise<CreateSchemaResult>;
30960
31469
  /**
30961
- * Retrieves a schema by its ID.
31470
+ * Retrieves a complete schema by its ID with definition fetched and flattened.
30962
31471
  *
30963
31472
  * @param schemaId - The ID of the schema to retrieve
30964
31473
  * @param options - Optional parameters
30965
31474
  * @param options.subgraphUrl - Custom subgraph URL to use instead of default
30966
- * @returns Promise resolving to the schema object
30967
- * @throws {Error} When the schema is not found or chain is unavailable
31475
+ * @returns Promise resolving to the complete schema object with all fields populated
31476
+ * @throws {Error} When the schema is not found, definition cannot be fetched, or chain is unavailable
30968
31477
  * @example
30969
31478
  * ```typescript
30970
31479
  * const schema = await vana.schemas.get(1);
30971
- * console.log(`Schema: ${schema.name} (${schema.type})`);
31480
+ * console.log(`Schema: ${schema.name} (${schema.dialect})`);
31481
+ * console.log(`Version: ${schema.version}`);
31482
+ * console.log(`Description: ${schema.description}`);
31483
+ * console.log('Schema:', schema.schema);
30972
31484
  *
30973
- * // With custom subgraph
30974
- * const schema = await vana.schemas.get(1, {
30975
- * subgraphUrl: 'https://custom-subgraph.com/graphql'
30976
- * });
31485
+ * // Use directly with validator (schema has all required fields)
31486
+ * validator.validateDataAgainstSchema(data, schema);
30977
31487
  * ```
30978
31488
  */
30979
31489
  get(schemaId: number, options?: {
30980
31490
  subgraphUrl?: string;
30981
- }): Promise<Schema>;
31491
+ }): Promise<CompleteSchema>;
30982
31492
  /**
30983
31493
  * Gets the total number of schemas registered on the network.
30984
31494
  *
@@ -31007,27 +31517,25 @@ declare class SchemaController {
31007
31517
  * @param options.limit - Maximum number of schemas to return
31008
31518
  * @param options.offset - Number of schemas to skip
31009
31519
  * @param options.subgraphUrl - Custom subgraph URL to use instead of default
31520
+ * @param options.includeDefinitions - Whether to fetch and include schema definitions (default: false for performance)
31010
31521
  * @returns Promise resolving to an array of schemas
31011
31522
  * @example
31012
31523
  * ```typescript
31013
- * // Get all schemas
31524
+ * // Get all schemas (without definitions for performance)
31014
31525
  * const schemas = await vana.schemas.list();
31015
31526
  *
31527
+ * // Get schemas with definitions
31528
+ * const schemas = await vana.schemas.list({ includeDefinitions: true });
31529
+ *
31016
31530
  * // Get schemas with pagination
31017
31531
  * const schemas = await vana.schemas.list({ limit: 10, offset: 0 });
31018
- *
31019
- * // With custom subgraph
31020
- * const schemas = await vana.schemas.list({
31021
- * limit: 10,
31022
- * offset: 0,
31023
- * subgraphUrl: 'https://custom-subgraph.com/graphql'
31024
- * });
31025
31532
  * ```
31026
31533
  */
31027
31534
  list(options?: {
31028
31535
  limit?: number;
31029
31536
  offset?: number;
31030
31537
  subgraphUrl?: string;
31538
+ includeDefinitions?: boolean;
31031
31539
  }): Promise<Schema[]>;
31032
31540
  /**
31033
31541
  * Adds a schema using the legacy method (low-level API).
@@ -31074,6 +31582,13 @@ declare class SchemaController {
31074
31582
  * @returns Promise resolving to the user's address
31075
31583
  */
31076
31584
  private getUserAddress;
31585
+ /**
31586
+ * Fetches and attaches definitions to an array of schemas.
31587
+ *
31588
+ * @param schemas - Array of schemas to fetch definitions for
31589
+ * @private
31590
+ */
31591
+ private _fetchDefinitionsForSchemas;
31077
31592
  }
31078
31593
 
31079
31594
  /**
@@ -31148,34 +31663,30 @@ declare class SchemaValidator {
31148
31663
  */
31149
31664
  validateDataSchema(schema: unknown): asserts schema is DataSchema;
31150
31665
  /**
31151
- * Validates data against a JSON Schema from a data schema
31666
+ * Validates data against a JSON Schema from a schema
31152
31667
  *
31153
31668
  * @param data - The data to validate
31154
- * @param schema - The data schema containing the schema
31669
+ * @param schema - The schema containing the validation rules (DataSchema or Schema)
31155
31670
  * @throws SchemaValidationError if invalid
31156
31671
  * @example
31157
31672
  * ```typescript
31158
31673
  * const validator = new SchemaValidator();
31159
31674
  *
31160
- * const schema = {
31675
+ * // Works with Schema from schemas.get()
31676
+ * const schema = await vana.schemas.get(1);
31677
+ * validator.validateDataAgainstSchema(userData, schema);
31678
+ *
31679
+ * // Also works with DataSchema object
31680
+ * const dataSchema: DataSchema = {
31161
31681
  * name: "User Profile",
31162
31682
  * version: "1.0.0",
31163
31683
  * dialect: "json",
31164
- * schema: {
31165
- * type: "object",
31166
- * properties: {
31167
- * name: { type: "string" },
31168
- * age: { type: "number" }
31169
- * },
31170
- * required: ["name"]
31171
- * }
31684
+ * schema: { type: "object", properties: { name: { type: "string" } } }
31172
31685
  * };
31173
- *
31174
- * const userData = { name: "Alice", age: 30 };
31175
- * validator.validateDataAgainstSchema(userData, schema);
31686
+ * validator.validateDataAgainstSchema(userData, dataSchema);
31176
31687
  * ```
31177
31688
  */
31178
- validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
31689
+ validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
31179
31690
  /**
31180
31691
  * Validates a SQLite DDL string for basic syntax
31181
31692
  * Note: This is a basic validation, full SQL parsing would require a proper SQL parser
@@ -31219,7 +31730,7 @@ declare function validateDataSchema(schema: unknown): asserts schema is DataSche
31219
31730
  * @returns void - Function doesn't return a value
31220
31731
  * @throws SchemaValidationError if invalid
31221
31732
  */
31222
- declare function validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
31733
+ declare function validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
31223
31734
  /**
31224
31735
  * Convenience function to fetch and validate a schema from a URL
31225
31736
  *
@@ -33862,12 +34373,25 @@ declare class DataController {
33862
34373
  /**
33863
34374
  * Registers a file URL directly on the blockchain with a schema ID.
33864
34375
  *
33865
- * @param url - The URL of the file to register
34376
+ * @remarks
34377
+ * This method registers an existing file URL on the DataRegistry contract
34378
+ * with a schema ID, without uploading any data. Useful when you have already
34379
+ * uploaded content to storage and just need to register it on-chain.
34380
+ *
34381
+ * @param url - The URL of the file to register (IPFS or HTTP/HTTPS)
33866
34382
  * @param schemaId - The schema ID to associate with the file
33867
34383
  * @returns Promise resolving to the file ID and transaction hash
33868
- *
33869
- * This method registers an existing file URL on the DataRegistry
33870
- * contract with a schema ID, without uploading any data.
34384
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34385
+ * @throws {Error} When wallet address is unavailable - "No addresses available"
34386
+ * @throws {Error} When transaction fails - "Failed to register file with schema"
34387
+ * @example
34388
+ * ```typescript
34389
+ * const { fileId, transactionHash } = await vana.data.registerFileWithSchema(
34390
+ * "ipfs://QmXxx...",
34391
+ * 1
34392
+ * );
34393
+ * console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
34394
+ * ```
33871
34395
  */
33872
34396
  registerFileWithSchema(url: string, schemaId: number): Promise<{
33873
34397
  fileId: number;
@@ -33927,35 +34451,112 @@ declare class DataController {
33927
34451
  /**
33928
34452
  * Adds a new refiner to the DataRefinerRegistry.
33929
34453
  *
33930
- * @param params - Refiner parameters including DLP ID, name, schema ID, and instruction URL
34454
+ * @remarks
34455
+ * Refiners are data processing templates that define how raw data should be
34456
+ * transformed into structured formats. Each refiner is associated with a DLP
34457
+ * (Data Liquidity Pool), has a specific schema for output, and includes
34458
+ * instructions for the refinement process.
34459
+ *
34460
+ * @param params - Refiner configuration parameters
34461
+ * @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
34462
+ * @param params.name - Human-readable name for the refiner
34463
+ * @param params.schemaId - Schema ID that defines the output format
34464
+ * @param params.refinementInstructionUrl - URL containing processing instructions
33931
34465
  * @returns Promise resolving to the new refiner ID and transaction hash
34466
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34467
+ * @throws {Error} When transaction fails - "Failed to add refiner: {error}"
34468
+ * @example
34469
+ * ```typescript
34470
+ * const result = await vana.data.addRefiner({
34471
+ * dlpId: 1,
34472
+ * name: "Social Media Sentiment Analyzer",
34473
+ * schemaId: 42,
34474
+ * refinementInstructionUrl: "ipfs://QmXxx..."
34475
+ * });
34476
+ * console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
34477
+ * ```
33932
34478
  */
33933
34479
  addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
33934
34480
  /**
33935
34481
  * Retrieves a refiner by its ID.
33936
34482
  *
33937
- * @param refinerId - The refiner ID to retrieve
33938
- * @returns Promise resolving to the refiner information
34483
+ * @remarks
34484
+ * Queries the DataRefinerRegistry contract to get complete information about
34485
+ * a specific refiner including its DLP association, schema, and instructions.
34486
+ *
34487
+ * @param refinerId - The numeric refiner ID to retrieve
34488
+ * @returns Promise resolving to the refiner information object
34489
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34490
+ * @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
34491
+ * @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
34492
+ * @example
34493
+ * ```typescript
34494
+ * const refiner = await vana.data.getRefiner(1);
34495
+ * console.log({
34496
+ * name: refiner.name,
34497
+ * dlp: refiner.dlpId,
34498
+ * schema: refiner.schemaId,
34499
+ * instructions: refiner.refinementInstructionUrl
34500
+ * });
34501
+ * ```
33939
34502
  */
33940
34503
  getRefiner(refinerId: number): Promise<Refiner>;
33941
34504
  /**
33942
34505
  * Validates if a schema ID exists in the registry.
33943
34506
  *
33944
- * @param schemaId - The schema ID to validate
33945
- * @returns Promise resolving to boolean indicating if the schema ID is valid
34507
+ * @remarks
34508
+ * Checks the DataRefinerRegistry contract to determine if a given schema ID
34509
+ * has been registered and is available for use.
34510
+ *
34511
+ * @param schemaId - The numeric schema ID to validate
34512
+ * @returns Promise resolving to true if schema exists, false otherwise
34513
+ * @example
34514
+ * ```typescript
34515
+ * const isValid = await vana.data.isValidSchemaId(42);
34516
+ * if (isValid) {
34517
+ * console.log('Schema 42 is available for use');
34518
+ * } else {
34519
+ * console.log('Schema 42 does not exist');
34520
+ * }
34521
+ * ```
33946
34522
  */
33947
34523
  isValidSchemaId(schemaId: number): Promise<boolean>;
33948
34524
  /**
33949
34525
  * Gets the total number of refiners in the registry.
33950
34526
  *
34527
+ * @remarks
34528
+ * Queries the DataRefinerRegistry contract to get the total count of all
34529
+ * registered refiners across all DLPs.
34530
+ *
33951
34531
  * @returns Promise resolving to the total refiner count
34532
+ * @example
34533
+ * ```typescript
34534
+ * const count = await vana.data.getRefinersCount();
34535
+ * console.log(`Total refiners registered: ${count}`);
34536
+ * ```
33952
34537
  */
33953
34538
  getRefinersCount(): Promise<number>;
33954
34539
  /**
33955
34540
  * Updates the schema ID for an existing refiner.
33956
34541
  *
33957
- * @param params - Parameters including refiner ID and new schema ID
34542
+ * @remarks
34543
+ * Allows the owner of a refiner to update its associated schema ID.
34544
+ * This is useful when refiner output format needs to change.
34545
+ *
34546
+ * @param params - Update parameters
34547
+ * @param params.refinerId - The refiner ID to update
34548
+ * @param params.newSchemaId - The new schema ID to set
33958
34549
  * @returns Promise resolving to the transaction hash
34550
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34551
+ * @throws {Error} When transaction fails - "Failed to update schema ID: {error}"
34552
+ * @example
34553
+ * ```typescript
34554
+ * const result = await vana.data.updateSchemaId({
34555
+ * refinerId: 1,
34556
+ * newSchemaId: 55
34557
+ * });
34558
+ * console.log(`Schema updated in tx ${result.transactionHash}`);
34559
+ * ```
33959
34560
  */
33960
34561
  updateSchemaId(params: UpdateSchemaIdParams): Promise<UpdateSchemaIdResult>;
33961
34562
  /**
@@ -34014,7 +34615,7 @@ declare class DataController {
34014
34615
  * console.log(`Transaction: ${result.transactionHash}`);
34015
34616
  * ```
34016
34617
  */
34017
- addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<FilePermissionResult>;
34618
+ addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
34018
34619
  /**
34019
34620
  * Submits a file permission transaction and returns the transaction hash immediately.
34020
34621
  *
@@ -34031,7 +34632,7 @@ declare class DataController {
34031
34632
  * console.log(`Transaction submitted: ${txHash}`);
34032
34633
  * ```
34033
34634
  */
34034
- submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<Hash>;
34635
+ submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
34035
34636
  /**
34036
34637
  * Gets the encrypted key for a specific account's permission to access a file.
34037
34638
  *
@@ -34198,24 +34799,6 @@ declare class DataController {
34198
34799
  * ```
34199
34800
  */
34200
34801
  fetchAndValidateSchema(url: string): Promise<DataSchema>;
34201
- /**
34202
- * Retrieves a schema by ID and fetches its definition URL to get the full data schema.
34203
- *
34204
- * @param schemaId - The schema ID to retrieve and validate
34205
- * @returns The validated data schema
34206
- * @throws SchemaValidationError if schema is invalid
34207
- * @example
34208
- * ```typescript
34209
- * // Get schema from registry and validate its schema
34210
- * const schema = await vana.data.getValidatedSchema(123);
34211
- *
34212
- * // Use it to validate user data
34213
- * if (schema.dialect === "json") {
34214
- * vana.data.validateDataAgainstSchema(userData, schema);
34215
- * }
34216
- * ```
34217
- */
34218
- getValidatedSchema(schemaId: number): Promise<DataSchema>;
34219
34802
  }
34220
34803
 
34221
34804
  /**
@@ -34418,6 +35001,31 @@ interface Chains {
34418
35001
  }
34419
35002
  declare const chains: Chains;
34420
35003
 
35004
+ /**
35005
+ * Creates or retrieves a cached public client for blockchain read operations.
35006
+ *
35007
+ * @remarks
35008
+ * This function provides an optimized way to access blockchain data by maintaining
35009
+ * a cached client instance per chain. The client is used for reading contract state,
35010
+ * querying events, and other read-only blockchain operations. It automatically
35011
+ * handles HTTP transport configuration and chain switching.
35012
+ *
35013
+ * @param chainId - The chain ID to connect to (defaults to Moksha testnet)
35014
+ * @returns A public client configured for the specified chain with caching optimization
35015
+ * @throws {Error} When the specified chain ID is not supported by the SDK
35016
+ * @example
35017
+ * ```typescript
35018
+ * // Get client for default chain (Moksha testnet)
35019
+ * const client = createClient();
35020
+ *
35021
+ * // Get client for specific chain
35022
+ * const mainnetClient = createClient(14800);
35023
+ *
35024
+ * // Use client for blockchain reads
35025
+ * const blockNumber = await client.getBlockNumber();
35026
+ * ```
35027
+ * @category Blockchain
35028
+ */
34421
35029
  declare const createClient: (chainId?: keyof typeof chains) => PublicClient & {
34422
35030
  chain: Chain;
34423
35031
  };
@@ -35136,51 +35744,157 @@ declare class SerializationError extends VanaError {
35136
35744
  constructor(message: string);
35137
35745
  }
35138
35746
  /**
35139
- * Error thrown when a signature operation fails.
35747
+ * Thrown when a signature operation fails or cannot be completed.
35140
35748
  *
35141
35749
  * @remarks
35142
- * Recovery strategies: Check wallet connection and account unlock status,
35143
- * retry operation with explicit user interaction, or for gasless operations
35144
- * consider switching to direct transactions.
35750
+ * This error occurs when wallet signature operations fail due to disconnection,
35751
+ * locked accounts, or other wallet-related issues. It preserves the original
35752
+ * error for debugging while providing consistent error handling across the SDK.
35753
+ *
35754
+ * Recovery strategies:
35755
+ * - Check wallet connection and account unlock status
35756
+ * - Retry operation with explicit user interaction
35757
+ * - For gasless operations, consider switching to direct transactions
35758
+ *
35759
+ * @example
35760
+ * ```typescript
35761
+ * try {
35762
+ * await vana.permissions.grant({ grantee: '0x...' });
35763
+ * } catch (error) {
35764
+ * if (error instanceof SignatureError) {
35765
+ * // Prompt user to unlock wallet
35766
+ * await promptWalletUnlock();
35767
+ * // Retry operation
35768
+ * }
35769
+ * }
35770
+ * ```
35771
+ * @category Error Handling
35145
35772
  */
35146
35773
  declare class SignatureError extends VanaError {
35147
35774
  readonly originalError?: Error | undefined;
35148
35775
  constructor(message: string, originalError?: Error | undefined);
35149
35776
  }
35150
35777
  /**
35151
- * Error thrown when a network operation fails.
35778
+ * Thrown when network communication fails during API calls or blockchain interactions.
35152
35779
  *
35153
35780
  * @remarks
35154
- * Recovery strategies: Check network connectivity, retry with exponential backoff,
35155
- * verify API endpoints are accessible, or switch to alternative network providers.
35781
+ * This error encompasses network connectivity issues, API unavailability,
35782
+ * timeout errors, and CORS restrictions. It's commonly encountered during
35783
+ * IPFS operations, subgraph queries, or RPC calls.
35784
+ *
35785
+ * Recovery strategies:
35786
+ * - Check network connectivity
35787
+ * - Retry with exponential backoff
35788
+ * - Verify API endpoints are accessible
35789
+ * - Switch to alternative network providers or gateways
35790
+ *
35791
+ * @example
35792
+ * ```typescript
35793
+ * try {
35794
+ * const files = await vana.data.getUserFiles({ owner: '0x...' });
35795
+ * } catch (error) {
35796
+ * if (error instanceof NetworkError) {
35797
+ * // Implement retry with exponential backoff
35798
+ * await retryWithBackoff(() => vana.data.getUserFiles({ owner: '0x...' }));
35799
+ * }
35800
+ * }
35801
+ * ```
35802
+ * @category Error Handling
35156
35803
  */
35157
35804
  declare class NetworkError extends VanaError {
35158
35805
  readonly originalError?: Error | undefined;
35159
35806
  constructor(message: string, originalError?: Error | undefined);
35160
35807
  }
35161
35808
  /**
35162
- * Error thrown when the nonce retrieval fails.
35809
+ * Thrown when transaction nonce retrieval fails during gasless operations.
35163
35810
  *
35164
35811
  * @remarks
35165
- * Recovery strategies: Retry nonce retrieval after brief delay, check wallet connection
35166
- * and account status, or use manual nonce specification if supported by the operation.
35812
+ * This error occurs when the SDK cannot retrieve the user's current nonce from
35813
+ * smart contracts, preventing gasless transaction submission. Nonces are critical
35814
+ * for preventing replay attacks in signed transactions.
35815
+ *
35816
+ * Recovery strategies:
35817
+ * - Retry nonce retrieval after brief delay
35818
+ * - Check wallet connection and account status
35819
+ * - Use manual nonce specification if supported by the operation
35820
+ * - Switch to direct transactions as fallback
35821
+ *
35822
+ * @example
35823
+ * ```typescript
35824
+ * try {
35825
+ * await vana.permissions.grant({ grantee: '0x...' });
35826
+ * } catch (error) {
35827
+ * if (error instanceof NonceError) {
35828
+ * // Wait and retry
35829
+ * await delay(1000);
35830
+ * await vana.permissions.grant({ grantee: '0x...' });
35831
+ * }
35832
+ * }
35833
+ * ```
35834
+ * @category Error Handling
35167
35835
  */
35168
35836
  declare class NonceError extends VanaError {
35169
35837
  constructor(message: string);
35170
35838
  }
35171
35839
  /**
35172
- * Error thrown when a personal server operation fails.
35840
+ * Thrown when personal server operations fail or cannot be completed.
35173
35841
  *
35174
35842
  * @remarks
35175
- * Recovery strategies: Verify server URL accessibility, check server trust status via
35176
- * `vana.permissions.getUserTrustedServers()`, or retry after server becomes available.
35843
+ * This error occurs during interactions with personal servers for computation
35844
+ * requests, identity retrieval, or operation status checks. Common causes include
35845
+ * server unavailability, untrusted server status, or invalid permission grants.
35846
+ *
35847
+ * Recovery strategies:
35848
+ * - Verify server URL accessibility
35849
+ * - Check server trust status via `vana.permissions.getTrustedServers()`
35850
+ * - Ensure valid permissions exist for the operation
35851
+ * - Retry after server becomes available
35852
+ *
35853
+ * @example
35854
+ * ```typescript
35855
+ * try {
35856
+ * const result = await vana.server.createOperation({ permissionId: 123 });
35857
+ * } catch (error) {
35858
+ * if (error instanceof PersonalServerError) {
35859
+ * // Check if server is trusted
35860
+ * const trustedServers = await vana.permissions.getTrustedServers();
35861
+ * if (!trustedServers.includes(serverId)) {
35862
+ * await vana.permissions.trustServer({ serverId });
35863
+ * }
35864
+ * }
35865
+ * }
35866
+ * ```
35867
+ * @category Error Handling
35177
35868
  */
35178
35869
  declare class PersonalServerError extends VanaError {
35179
35870
  readonly originalError?: Error | undefined;
35180
35871
  constructor(message: string, originalError?: Error | undefined);
35181
35872
  }
35182
35873
  /**
35183
- * Error thrown when trying to register a server with a URL that doesn't match the existing registration.
35874
+ * Thrown when attempting to register a server with a URL different from its existing registration.
35875
+ *
35876
+ * @remarks
35877
+ * This error occurs when trying to add or trust a server that's already registered
35878
+ * on-chain with a different URL. Server URLs are immutable once registered to
35879
+ * maintain consistency and security. Applications should use the existing URL
35880
+ * or register a new server with a different ID.
35881
+ *
35882
+ * @example
35883
+ * ```typescript
35884
+ * try {
35885
+ * await vana.permissions.addAndTrustServer({
35886
+ * serverId: 1,
35887
+ * serverUrl: 'https://new-url.com',
35888
+ * publicKey: '0x...'
35889
+ * });
35890
+ * } catch (error) {
35891
+ * if (error instanceof ServerUrlMismatchError) {
35892
+ * console.log(`Server already registered with: ${error.existingUrl}`);
35893
+ * // Use existing URL or register new server
35894
+ * }
35895
+ * }
35896
+ * ```
35897
+ * @category Error Handling
35184
35898
  */
35185
35899
  declare class ServerUrlMismatchError extends VanaError {
35186
35900
  constructor(existingUrl: string, providedUrl: string, serverId: string);
@@ -35189,7 +35903,25 @@ declare class ServerUrlMismatchError extends VanaError {
35189
35903
  readonly serverId: string;
35190
35904
  }
35191
35905
  /**
35192
- * Error thrown when a permission operation fails.
35906
+ * Thrown when permission grant, revoke, or validation operations fail.
35907
+ *
35908
+ * @remarks
35909
+ * This error occurs during permission management operations including grants,
35910
+ * revocations, and permission validation checks. Common causes include invalid
35911
+ * grantee addresses, expired permissions, or insufficient privileges.
35912
+ *
35913
+ * @example
35914
+ * ```typescript
35915
+ * try {
35916
+ * await vana.permissions.revoke({ permissionId: 999999 });
35917
+ * } catch (error) {
35918
+ * if (error instanceof PermissionError) {
35919
+ * console.error('Permission operation failed:', error.message);
35920
+ * // Permission may not exist or user may not be owner
35921
+ * }
35922
+ * }
35923
+ * ```
35924
+ * @category Error Handling
35193
35925
  */
35194
35926
  declare class PermissionError extends VanaError {
35195
35927
  readonly originalError?: Error | undefined;
@@ -36155,12 +36887,12 @@ declare class SignatureCache {
36155
36887
  * Generate a deterministic hash of a message object for cache key generation
36156
36888
  *
36157
36889
  * @remarks
36158
- * Creates a consistent hash from complex objects including EIP-712 typed data.
36159
- * Handles BigInt serialization and produces a 32-character hash that balances
36160
- * uniqueness with key length constraints.
36890
+ * Creates a cryptographically secure hash from complex objects including EIP-712 typed data.
36891
+ * Uses SHA-256 for collision resistance and deterministic key generation.
36892
+ * Handles BigInt serialization and sorts object keys for consistency.
36161
36893
  *
36162
36894
  * @param message - The message object to hash (typically EIP-712 typed data)
36163
- * @returns A 32-character hash string suitable for cache keys
36895
+ * @returns A hex string hash (SHA-256) suitable for cache keys
36164
36896
  * @example
36165
36897
  * ```typescript
36166
36898
  * const typedData = {
@@ -36169,19 +36901,19 @@ declare class SignatureCache {
36169
36901
  * };
36170
36902
  *
36171
36903
  * const hash = SignatureCache.hashMessage(typedData);
36172
- * // Returns something like: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
36904
+ * // Returns SHA-256 hash like: "a1b2c3d4e5f6..."
36173
36905
  * ```
36174
36906
  */
36175
36907
  static hashMessage(message: object): string;
36176
36908
  /**
36177
- * Custom JSON replacer that converts BigInt values to strings for serialization
36178
- * This ensures deterministic cache key generation for EIP-712 typed data
36909
+ * Deterministic JSON replacer that handles BigInt values and sorts object keys
36910
+ * This ensures consistent cache key generation for EIP-712 typed data
36179
36911
  *
36180
36912
  * @param _key - The object key being serialized (unused)
36181
36913
  * @param value - The value to serialize
36182
- * @returns The serialized value
36914
+ * @returns The serialized value with sorted keys for objects
36183
36915
  */
36184
- private static bigIntReplacer;
36916
+ private static deterministicReplacer;
36185
36917
  }
36186
36918
  /**
36187
36919
  * Wrapper function to cache signature operations
@@ -36197,21 +36929,53 @@ declare function withSignatureCache(cache: VanaCacheAdapter, walletAddress: stri
36197
36929
 
36198
36930
  declare const CONTRACT_ADDRESSES: Record<number, Record<string, string>>;
36199
36931
  /**
36200
- * Retrieves the deployed contract address for a specific contract on a given chain.
36932
+ * Retrieves the deployed contract address for a specific Vana protocol contract on a given chain.
36201
36933
  *
36202
- * @param chainId - The chain ID to look up the contract on
36203
- * @param contract - The contract name to get the address for
36204
- * @returns The contract address as a hex string
36205
- * @throws {Error} When contract address not found for the specified contract and chain
36934
+ * @remarks
36935
+ * This function provides type-safe access to contract addresses across all supported Vana networks.
36936
+ * It automatically searches both current and legacy contract registries to ensure backwards
36937
+ * compatibility while providing clear error messages for unsupported combinations.
36938
+ *
36939
+ * The function validates that both the chain ID and contract name are supported before
36940
+ * attempting address lookup, helping developers identify deployment or configuration issues
36941
+ * early in the development process.
36942
+ *
36943
+ * **Supported Chains:**
36944
+ * - 14800: Vana Mainnet
36945
+ * - 1480: Moksha Testnet
36946
+ *
36947
+ * **Contract Categories:**
36948
+ * - Data Management: DataRegistry, DataRefinerRegistry
36949
+ * - Permissions: DataPortabilityPermissions, DataPortabilityServers, DataPortabilityGrantees
36950
+ * - Computing: TeePoolPhala, TeePoolDedicatedGpu, etc.
36951
+ * - Token & Governance: DATImplementation, VanaPoolStaking, etc.
36952
+ *
36953
+ * @param chainId - The chain ID to look up the contract on (14800 for mainnet, 1480 for testnet)
36954
+ * @param contract - The contract name to get the address for (use TypeScript autocomplete for available options)
36955
+ * @returns The contract address as a checksummed hex string (0x...)
36956
+ * @throws {Error} When contract address not found for the specified contract and chain combination.
36957
+ * This typically indicates the contract is not deployed on the requested network.
36206
36958
  * @example
36207
36959
  * ```typescript
36960
+ * // Get core protocol contract addresses
36961
+ * const dataRegistry = getContractAddress(14800, 'DataRegistry');
36962
+ * const permissions = getContractAddress(14800, 'DataPortabilityPermissions');
36963
+ * const trustedServers = getContractAddress(14800, 'DataPortabilityServers');
36964
+ *
36965
+ * // Handle unsupported combinations gracefully
36208
36966
  * try {
36209
- * const dataRegistryAddress = getContractAddress(1480, 'DataRegistry');
36210
- * console.log('DataRegistry address:', dataRegistryAddress);
36967
+ * const address = getContractAddress(1480, 'DataRegistry');
36968
+ * console.log('DataRegistry testnet address:', address);
36211
36969
  * } catch (error) {
36212
- * console.error('Contract not deployed on this chain:', error.message);
36970
+ * console.error('Contract not available on testnet:', error.message);
36971
+ * // Fallback to mainnet or show user-friendly error
36213
36972
  * }
36973
+ *
36974
+ * // TypeScript provides autocomplete for contract names
36975
+ * const poolAddress = getContractAddress(14800, 'TeePoolPhala'); // ✅ Valid
36976
+ * // const invalid = getContractAddress(14800, 'InvalidContract'); // ❌ TypeScript error
36214
36977
  * ```
36978
+ * @category Configuration
36215
36979
  */
36216
36980
  declare const getContractAddress: (chainId: keyof typeof CONTRACT_ADDRESSES, contract: VanaContract) => `0x${string}`;
36217
36981
 
@@ -36381,27 +37145,317 @@ declare class CircuitBreaker {
36381
37145
  reset(): void;
36382
37146
  }
36383
37147
 
37148
+ /**
37149
+ * Browser implementation of the Vana Platform Adapter using Uint8Array
37150
+ *
37151
+ * This implementation uses browser-compatible libraries and native APIs
37152
+ * without requiring Buffer or other Node.js polyfills.
37153
+ */
37154
+
37155
+ /**
37156
+ * Browser implementation of crypto operations using Uint8Array
37157
+ */
37158
+ declare class BrowserCryptoAdapter implements VanaCryptoAdapter {
37159
+ private eciesProvider;
37160
+ private walletKeyEncryptionService;
37161
+ encryptWithPublicKey(data: string, publicKeyHex: string): Promise<string>;
37162
+ decryptWithPrivateKey(encryptedData: string, privateKeyHex: string): Promise<string>;
37163
+ encryptWithWalletPublicKey(data: string, publicKey: string): Promise<string>;
37164
+ decryptWithWalletPrivateKey(encryptedData: string, privateKey: string): Promise<string>;
37165
+ generateKeyPair(): Promise<{
37166
+ privateKey: string;
37167
+ publicKey: string;
37168
+ }>;
37169
+ encryptWithPassword(data: Uint8Array, password: string): Promise<Uint8Array>;
37170
+ decryptWithPassword(encryptedData: Uint8Array, password: string): Promise<Uint8Array>;
37171
+ }
37172
+ /**
37173
+ * Browser implementation of PGP operations
37174
+ */
37175
+ declare class BrowserPGPAdapter implements VanaPGPAdapter {
37176
+ encrypt(data: string, publicKeyArmored: string): Promise<string>;
37177
+ decrypt(encryptedData: string, privateKeyArmored: string): Promise<string>;
37178
+ generateKeyPair(options?: {
37179
+ name?: string;
37180
+ email?: string;
37181
+ passphrase?: string;
37182
+ }): Promise<{
37183
+ publicKey: string;
37184
+ privateKey: string;
37185
+ }>;
37186
+ }
37187
+ /**
37188
+ * Browser implementation of HTTP operations using Fetch API
37189
+ */
37190
+ declare class BrowserHttpAdapter implements VanaHttpAdapter {
37191
+ fetch(url: string, options?: RequestInit): Promise<Response>;
37192
+ }
37193
+ /**
37194
+ * Browser implementation of caching using sessionStorage for security
37195
+ * SessionStorage is cleared when the tab closes, making it more secure for signature caching
37196
+ */
37197
+ declare class BrowserCacheAdapter implements VanaCacheAdapter {
37198
+ private readonly prefix;
37199
+ get(key: string): string | null;
37200
+ set(key: string, value: string): void;
37201
+ delete(key: string): void;
37202
+ clear(): void;
37203
+ }
36384
37204
  /**
36385
37205
  * Browser implementation of the Vana Platform Adapter
36386
37206
  *
36387
- * This implementation uses browser-compatible libraries and configurations
36388
- * to provide crypto, PGP, and HTTP functionality without Node.js dependencies.
37207
+ * This adapter provides all platform-specific functionality for browser environments
37208
+ * without requiring any Node.js polyfills.
37209
+ */
37210
+ declare class BrowserPlatformAdapter implements VanaPlatformAdapter {
37211
+ readonly crypto: BrowserCryptoAdapter;
37212
+ readonly pgp: BrowserPGPAdapter;
37213
+ readonly http: BrowserHttpAdapter;
37214
+ readonly cache: BrowserCacheAdapter;
37215
+ readonly platform: "browser";
37216
+ }
37217
+
37218
+ /**
37219
+ * ECIES (Elliptic Curve Integrated Encryption Scheme) Interface
36389
37220
  *
36390
- * WARNING: Dependencies that access globals during init
36391
- * MUST be dynamically imported to support Turbopack.
36392
- * See: https://github.com/vercel/next.js/issues/82632
37221
+ * @remarks
37222
+ * Defines the contract for platform-specific ECIES implementations.
37223
+ * All implementations maintain compatibility with the eccrypto format to ensure
37224
+ * backward compatibility with existing encrypted data.
37225
+ *
37226
+ * **Format specification:**
37227
+ * `[iv (16 bytes)][ephemPublicKey (65 bytes)][ciphertext (variable)][mac (32 bytes)]`
37228
+ *
37229
+ * @category Cryptography
37230
+ */
37231
+ /**
37232
+ * Represents ECIES encrypted data in eccrypto-compatible format.
37233
+ *
37234
+ * @remarks
37235
+ * This structure maintains backward compatibility with data encrypted using
37236
+ * the legacy eccrypto library.
37237
+ */
37238
+ interface ECIESEncrypted {
37239
+ /** Initialization vector (16 bytes) */
37240
+ iv: Uint8Array;
37241
+ /** Ephemeral public key (65 bytes uncompressed) */
37242
+ ephemPublicKey: Uint8Array;
37243
+ /** Encrypted data */
37244
+ ciphertext: Uint8Array;
37245
+ /** Message authentication code (32 bytes) */
37246
+ mac: Uint8Array;
37247
+ }
37248
+ /**
37249
+ * Provides ECIES encryption and decryption operations.
37250
+ *
37251
+ * @remarks
37252
+ * Platform-specific implementations handle the underlying cryptographic primitives
37253
+ * while maintaining consistent data format across environments.
37254
+ *
37255
+ * @category Cryptography
36393
37256
  */
37257
+ interface ECIESProvider {
37258
+ /**
37259
+ * Encrypts data using ECIES with secp256k1.
37260
+ *
37261
+ * @param publicKey - Recipient's public key (65 bytes uncompressed or 33 bytes compressed).
37262
+ * Obtain via `vana.server.getIdentity(userAddress).public_key`.
37263
+ * @param message - Data to encrypt.
37264
+ * @returns Encrypted data structure compatible with eccrypto format.
37265
+ * @throws {ECIESError} When public key is invalid.
37266
+ * Verify key format matches secp256k1 requirements.
37267
+ *
37268
+ * @example
37269
+ * ```typescript
37270
+ * const encrypted = await provider.encrypt(
37271
+ * hexToBytes(publicKey),
37272
+ * new TextEncoder().encode('sensitive data')
37273
+ * );
37274
+ * ```
37275
+ */
37276
+ encrypt(publicKey: Uint8Array, message: Uint8Array): Promise<ECIESEncrypted>;
37277
+ /**
37278
+ * Decrypts ECIES encrypted data.
37279
+ *
37280
+ * @param privateKey - Recipient's private key (32 bytes).
37281
+ * @param encrypted - Encrypted data structure from `encrypt()` or legacy eccrypto.
37282
+ * @returns Decrypted message as Uint8Array.
37283
+ * @throws {ECIESError} When MAC verification fails.
37284
+ * Ensure the private key matches the public key used for encryption.
37285
+ *
37286
+ * @example
37287
+ * ```typescript
37288
+ * const decrypted = await provider.decrypt(
37289
+ * hexToBytes(privateKey),
37290
+ * encrypted
37291
+ * );
37292
+ * const message = new TextDecoder().decode(decrypted);
37293
+ * ```
37294
+ */
37295
+ decrypt(privateKey: Uint8Array, encrypted: ECIESEncrypted): Promise<Uint8Array>;
37296
+ }
36394
37297
 
36395
37298
  /**
36396
- * Complete browser platform adapter implementation
37299
+ * Provides shared ECIES encryption logic across platforms using Uint8Array.
37300
+ *
37301
+ * @remarks
37302
+ * Platform implementations extend this class and provide crypto primitives.
37303
+ * The base class handles the ECIES protocol flow while maintaining
37304
+ * compatibility with the eccrypto data format.
37305
+ *
37306
+ * **Implementation details:**
37307
+ * - KDF: SHA-512(shared_secret) → encKey (32B) || macKey (32B)
37308
+ * - Cipher: AES-256-CBC with random 16-byte IV
37309
+ * - MAC: HMAC-SHA256(macKey, iv || ephemPublicKey || ciphertext)
37310
+ *
37311
+ * @category Cryptography
36397
37312
  */
36398
- declare class BrowserPlatformAdapter implements VanaPlatformAdapter {
36399
- crypto: VanaCryptoAdapter;
36400
- pgp: VanaPGPAdapter;
36401
- http: VanaHttpAdapter;
36402
- cache: VanaCacheAdapter;
36403
- platform: "browser";
36404
- constructor();
37313
+ declare abstract class BaseECIESUint8 implements ECIESProvider {
37314
+ private static readonly validatedKeys;
37315
+ /**
37316
+ * Generates cryptographically secure random bytes.
37317
+ *
37318
+ * @param length - Number of random bytes to generate.
37319
+ * @returns Random bytes array.
37320
+ */
37321
+ protected abstract generateRandomBytes(length: number): Uint8Array;
37322
+ /**
37323
+ * Verifies a private key is valid for secp256k1.
37324
+ *
37325
+ * @param privateKey - Private key to verify (32 bytes).
37326
+ * @returns `true` if valid private key.
37327
+ */
37328
+ protected abstract verifyPrivateKey(privateKey: Uint8Array): boolean;
37329
+ /**
37330
+ * Creates a public key from a private key.
37331
+ *
37332
+ * @param privateKey - Source private key (32 bytes).
37333
+ * @param compressed - Generate compressed (33B) or uncompressed (65B) format.
37334
+ * @returns Public key or `null` if creation failed.
37335
+ */
37336
+ protected abstract createPublicKey(privateKey: Uint8Array, compressed: boolean): Uint8Array | null;
37337
+ /**
37338
+ * Validates a public key on the secp256k1 curve.
37339
+ *
37340
+ * @param publicKey - Public key to validate.
37341
+ * @returns `true` if valid public key.
37342
+ */
37343
+ protected abstract validatePublicKey(publicKey: Uint8Array): boolean;
37344
+ /**
37345
+ * Decompresses a compressed public key.
37346
+ *
37347
+ * @param publicKey - Compressed public key (33 bytes).
37348
+ * @returns Uncompressed public key (65 bytes) or `null` if decompression failed.
37349
+ */
37350
+ protected abstract decompressPublicKey(publicKey: Uint8Array): Uint8Array | null;
37351
+ /**
37352
+ * Performs ECDH key agreement.
37353
+ *
37354
+ * @param publicKey - Other party's public key.
37355
+ * @param privateKey - Your private key.
37356
+ * @returns Raw X coordinate of shared point (32 bytes).
37357
+ */
37358
+ protected abstract performECDH(publicKey: Uint8Array, privateKey: Uint8Array): Uint8Array;
37359
+ /**
37360
+ * Computes SHA-512 hash.
37361
+ *
37362
+ * @param data - Data to hash.
37363
+ * @returns SHA-512 hash (64 bytes).
37364
+ */
37365
+ protected abstract sha512(data: Uint8Array): Uint8Array;
37366
+ /**
37367
+ * Computes HMAC-SHA256 authentication tag.
37368
+ *
37369
+ * @param key - HMAC key.
37370
+ * @param data - Data to authenticate.
37371
+ * @returns HMAC-SHA256 (32 bytes).
37372
+ */
37373
+ protected abstract hmacSha256(key: Uint8Array, data: Uint8Array): Uint8Array;
37374
+ /**
37375
+ * Encrypts data using AES-256-CBC.
37376
+ *
37377
+ * @param key - Encryption key (32 bytes).
37378
+ * @param iv - Initialization vector (16 bytes).
37379
+ * @param plaintext - Data to encrypt.
37380
+ * @returns Ciphertext with PKCS#7 padding.
37381
+ */
37382
+ protected abstract aesEncrypt(key: Uint8Array, iv: Uint8Array, plaintext: Uint8Array): Promise<Uint8Array>;
37383
+ /**
37384
+ * Decrypts data using AES-256-CBC.
37385
+ *
37386
+ * @param key - Decryption key (32 bytes).
37387
+ * @param iv - Initialization vector (16 bytes).
37388
+ * @param ciphertext - Data to decrypt.
37389
+ * @returns Plaintext with padding removed.
37390
+ */
37391
+ protected abstract aesDecrypt(key: Uint8Array, iv: Uint8Array, ciphertext: Uint8Array): Promise<Uint8Array>;
37392
+ /**
37393
+ * Normalizes a public key to uncompressed format.
37394
+ *
37395
+ * @param publicKey - Public key in any format.
37396
+ * @returns Uncompressed public key (65 bytes).
37397
+ * @throws {ECIESError} If key format is invalid.
37398
+ */
37399
+ protected normalizePublicKey(publicKey: Uint8Array): Uint8Array;
37400
+ /**
37401
+ * Encrypts data using ECIES.
37402
+ *
37403
+ * @param publicKey - The recipient's public key (compressed or uncompressed)
37404
+ * @param message - The data to encrypt
37405
+ * @returns Promise resolving to encrypted data structure
37406
+ */
37407
+ encrypt(publicKey: Uint8Array, message: Uint8Array): Promise<ECIESEncrypted>;
37408
+ /**
37409
+ * Decrypts ECIES encrypted data.
37410
+ *
37411
+ * @param privateKey - The recipient's private key (32 bytes)
37412
+ * @param encrypted - The encrypted data structure from encrypt()
37413
+ * @returns Promise resolving to the original plaintext
37414
+ */
37415
+ decrypt(privateKey: Uint8Array, encrypted: ECIESEncrypted): Promise<Uint8Array>;
37416
+ /**
37417
+ * Clears sensitive data from memory using multi-pass overwrite.
37418
+ *
37419
+ * @remarks
37420
+ * Uses multiple passes with different patterns to make it harder
37421
+ * for JIT compilers to optimize away the operation. While not
37422
+ * guaranteed in JavaScript, this is a best-effort approach to
37423
+ * clear sensitive data from memory.
37424
+ *
37425
+ * @param buffer - The buffer to clear
37426
+ */
37427
+ protected clearBuffer(buffer: Uint8Array): void;
37428
+ }
37429
+
37430
+ /**
37431
+ * Browser implementation of ECIES using @noble/secp256k1 with Uint8Array
37432
+ *
37433
+ * @remarks
37434
+ * Uses native browser crypto APIs and @noble/secp256k1 for elliptic curve operations.
37435
+ * This implementation is polyfill-free and works in all modern browsers.
37436
+ */
37437
+
37438
+ /**
37439
+ * Browser-specific ECIES provider using @noble/secp256k1
37440
+ *
37441
+ * @remarks
37442
+ * This implementation uses:
37443
+ * - Web Crypto API for AES operations
37444
+ * - @noble/secp256k1 for elliptic curve operations
37445
+ * - @noble/hashes for SHA and HMAC operations
37446
+ * - No Buffer or Node.js dependencies
37447
+ */
37448
+ declare class BrowserECIESUint8Provider extends BaseECIESUint8 {
37449
+ protected generateRandomBytes(length: number): Uint8Array;
37450
+ protected verifyPrivateKey(privateKey: Uint8Array): boolean;
37451
+ protected createPublicKey(privateKey: Uint8Array, compressed: boolean): Uint8Array | null;
37452
+ protected validatePublicKey(publicKey: Uint8Array): boolean;
37453
+ protected decompressPublicKey(publicKey: Uint8Array): Uint8Array | null;
37454
+ protected performECDH(publicKey: Uint8Array, privateKey: Uint8Array): Uint8Array;
37455
+ protected sha512(data: Uint8Array): Uint8Array;
37456
+ protected hmacSha256(key: Uint8Array, data: Uint8Array): Uint8Array;
37457
+ protected aesEncrypt(key: Uint8Array, iv: Uint8Array, plaintext: Uint8Array): Promise<Uint8Array>;
37458
+ protected aesDecrypt(key: Uint8Array, iv: Uint8Array, ciphertext: Uint8Array): Promise<Uint8Array>;
36405
37459
  }
36406
37460
 
36407
37461
  /**
@@ -36729,4 +37783,4 @@ declare function Vana(config: VanaConfig): VanaBrowserImpl;
36729
37783
  */
36730
37784
  type VanaInstance = VanaBrowserImpl;
36731
37785
 
36732
- 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, 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 TrustedServerQueryOptions, type UnencryptedUploadParams, type UntrustServerInput, type UntrustServerParams, type UntrustServerTypedData, type UpdateSchemaIdParams, type UpdateSchemaIdResult, type UploadEncryptedFileResult, type UploadFileParams, type UploadFileResult, type UploadParams, type UploadProgress, type UploadResult, type UserFile, UserRejectedRequestError, type ValidationErrorResponse, type ValidationResult, type Validator, Vana, VanaBrowserImpl, type VanaChain, type VanaChainConfig, type VanaChainId, type VanaConfig, type VanaConfigWithStorage, type VanaContract, type VanaContract as VanaContractAbi, type VanaContractInstance, type VanaContractName, VanaCore, VanaCoreFactory, VanaError, type VanaInstance, type VanaPlatformAdapter, type WalletConfig, type WalletConfigWithStorage, __contractCache, chains, checkGrantAccess, clearContractCache, type components, convertIpfsUrl, convertIpfsUrlWithFallbacks, createAndStoreGrant, createBrowserPlatformAdapter, createGrantFile, createPlatformAdapterSafe, createValidatedGrant, decryptBlobWithSignedKey, decryptWithPrivateKey, decryptWithWalletPrivateKey, Vana as default, detectPlatform, encryptBlobWithSignedKey, encryptFileKey, encryptWithWalletPublicKey, extractIpfsHash, fetchAndValidateSchema, fetchWithFallbacks, formatEth, formatNumber, formatToken, generateEncryptionKey, generateEncryptionKeyPair, generatePGPKeyPair, getAbi, getAllChains, getChainConfig, getContractAddress, getContractController, getContractInfo, getEncryptionParameters, getGatewayUrls, getGrantFileHash, getGrantTimeRemaining, getPlatformCapabilities, hasStorageConfig, isAPIResponse, isChainConfig, isGrantExpired, isIpfsUrl, isPlatformSupported, isReplicateAPIResponse, isVanaChain, isVanaChainId, isWalletConfig, moksha, mokshaTestnet, type operations, parseReplicateOutput, type paths, retrieveAndValidateGrant, retrieveGrantFile, safeParseJSON, schemaValidator, shortenAddress, storeGrantFile, summarizeGrant, validateDataAgainstSchema, validateDataSchema, validateGrant, validateGrantExpiry, validateGrantFile, validateGranteeAccess, validateOperationAccess, vanaMainnet, type webhooks, withSignatureCache };
37786
+ export { type $defs, type APIResponse, type AddAndTrustServerInput, type AddAndTrustServerParams, type AddAndTrustServerTypedData, type AddRefinerParams, type AddRefinerResult, type AddSchemaParams, type AddSchemaResult, type AllKeys, ApiClient, type ApiClientConfig, type ApiResponse, AsyncQueue, type AsyncResult, type AuthenticationErrorResponse, type Awaited, type BaseConfig, type BaseConfigWithStorage, BaseController, type BatchServerInfoResult, type BatchUploadParams, type BatchUploadResult, type BlockRange, BlockchainError, type BlockchainErrorResponse, type Brand, BrowserECIESUint8Provider as BrowserECIESProvider, BrowserPlatformAdapter, type Cache, type CacheConfig, CallbackStorage, type ChainConfig, type ChainConfigWithStorage, type CheckPermissionParams, CircuitBreaker, type CompleteSchema, type ComputeErrorResponse, type ConditionalOptional, type ConfigValidationOptions, type ConfigValidationResult, type ContractAddresses, type ContractCall, type ContractDeployment, ContractFactory, type ContractInfo, type ContractMethodParams, type ContractMethodReturnType, ContractNotFoundError, type Controller, type ControllerContext, type CreateOperationParams, type CreateOperationRequest, type CreateOperationResponse, type CreateSchemaParams, type CreateSchemaResult, DEFAULT_ENCRYPTION_SEED, DEFAULT_IPFS_GATEWAY, DataController, type DataSchema, type DecryptionErrorResponse, type DeepPartial, type DeepReadonly, type DeleteFileParams, type DeleteFileResult, type DownloadFileParams, type DownloadFileResult, type EncryptedUploadParams, type EncryptionInfo, type ErrorResponse, EventEmitter, type EventFilter, type EventLog, type Factory, type FileAccessErrorResponse, type FileAccessPermissions, type FileMetadata, type FilePermissionParams, type FileSharingConfig, type GasEstimate, type GenericRequest, type GenericResponse, type GenericTypedData, type GetFileParams, type GetOperationResponse, type GetUserFilesParams, type GetUserPermissionsOptions, type GetUserTrustedServersParams, GoogleDriveStorage, GrantExpiredError, type GrantFile, type GrantPermissionParams, GrantSchemaError, GrantValidationError, type GrantValidationErrorResponse, type GrantValidationOptions, type GrantValidationResult, type GrantedPermission, type Grantee, type GranteeInfo, GranteeMismatchError, type GranteeQueryOptions, type HttpMethod, IPFS_GATEWAYS, type IdentityResponseModel, type InitPersonalServerParams, type InternalServerErrorResponse, InvalidConfigurationError, IpfsStorage, type LegacyPermissionParams, type MaybeArray, type MaybePromise, MemoryCache, type Middleware, MiddlewarePipeline, NetworkError, type NetworkInfo, type Nominal, type NonNullable, NonceError, type NotFoundErrorResponse, type Observable, type Observer, type OmitByType, type OnChainPermissionGrant, type OperationErrorResponse, OperationNotAllowedError, type OptionalKeys, type PaginatedGrantees, type PaginatedTrustedServers, type PaginationParams, type PaginationResult, type PartialExcept, type Permission, type PermissionAnalytics, type PermissionCheckResult, PermissionError, type PermissionEvent, type PermissionGrantDomain, type PermissionGrantMessage, type PermissionGrantTypedData, type PermissionInfo, type PermissionInputMessage, type PermissionOperation, type PermissionQueryResult, type PermissionStatus, PermissionsController, PersonalServerError, type PersonalServerIdentity, type PersonalServerModel, type PickByType, type PinataListResponse, type PinataPin, PinataStorage, type PinataUploadResponse, type Plugin, type PostRequestParams, type PromiseResult, ProtocolController, type QueryPermissionsParams, type RateLimitInfo, RateLimiter, type RateLimiterConfig, type Refiner, type RegisterGranteeInput, type RegisterGranteeParams, type RegisterGranteeTypedData, type RelayerCallbacks, type RelayerConfig, RelayerError, type RelayerErrorResponse, type RelayerMetrics, type RelayerQueueInfo, type RelayerRequestOptions, type RelayerStatus, type RelayerStorageResponse, type RelayerStoreParams, type RelayerSubmitParams, type RelayerTransactionResponse, type RelayerTransactionStatus, type RelayerWebhookConfig, type RelayerWebhookPayload, type ReplicateAPIResponse, type ReplicateStatus, type Repository, type RequestOptions, type RequireKeys, type RequiredExcept, type RetryConfig, RetryUtility, type RevokePermissionInput, type RevokePermissionParams, type RuntimeConfig, type Schema, type SchemaMetadata, SchemaValidationError, SchemaValidator, SerializationError, type Server, type components as ServerComponents, ServerController, type $defs as ServerDefs, type ServerFilesAndPermissionParams, type ServerFilesAndPermissionTypedData, type ServerInfo, type operations as ServerOperations, type paths as ServerPaths, type ServerTrustStatus, ServerUrlMismatchError, type webhooks as ServerWebhooks, type Service, SignatureCache, SignatureError, type SimplifiedPermissionMessage, type StateMachine, type StatusInfo, type StorageCallbacks, type StorageConfig, type StorageDownloadOptions, StorageError, type StorageFile, type StorageListOptions, type StorageListResult, StorageManager, type StorageProvider, type StorageProviderConfig, type StorageRequiredMarker, type StorageUploadResult, type TimeRange, TransactionHandle, type TransactionOptions, type TransactionReceipt, type Transformer, type TrustServerInput, type TrustServerParams, type TrustServerTypedData, type TrustedServer, type TrustedServerInfo, type TrustedServerQueryOptions, type UnencryptedUploadParams, type UntrustServerInput, type UntrustServerParams, type UntrustServerTypedData, type UpdateSchemaIdParams, type UpdateSchemaIdResult, type UploadEncryptedFileResult, type UploadFileParams, type UploadFileResult, type UploadParams, type UploadProgress, type UploadResult, type UserFile, UserRejectedRequestError, type ValidationErrorResponse, type ValidationResult, type Validator, Vana, VanaBrowserImpl, type VanaChain, type VanaChainConfig, type VanaChainId, type VanaConfig, type VanaConfigWithStorage, type VanaContract, type VanaContract as VanaContractAbi, type VanaContractInstance, type VanaContractName, VanaCore, VanaCoreFactory, VanaError, type VanaInstance, type VanaPlatformAdapter, type WalletConfig, type WalletConfigWithStorage, __contractCache, chains, checkGrantAccess, clearContractCache, type components, convertIpfsUrl, convertIpfsUrlWithFallbacks, createAndStoreGrant, createBrowserPlatformAdapter, createGrantFile, createPlatformAdapterSafe, createValidatedGrant, decryptBlobWithSignedKey, decryptWithPrivateKey, decryptWithWalletPrivateKey, Vana as default, detectPlatform, encryptBlobWithSignedKey, encryptFileKey, encryptWithWalletPublicKey, extractIpfsHash, fetchAndValidateSchema, fetchWithFallbacks, formatEth, formatNumber, formatToken, generateEncryptionKey, generateEncryptionKeyPair, generatePGPKeyPair, getAbi, getAllChains, getChainConfig, getContractAddress, getContractController, getContractInfo, getEncryptionParameters, getGatewayUrls, getGrantFileHash, getGrantTimeRemaining, getPlatformCapabilities, hasStorageConfig, isAPIResponse, isChainConfig, isGrantExpired, isIpfsUrl, isPlatformSupported, isReplicateAPIResponse, isVanaChain, isVanaChainId, isWalletConfig, moksha, mokshaTestnet, type operations, parseReplicateOutput, type paths, retrieveAndValidateGrant, retrieveGrantFile, safeParseJSON, schemaValidator, shortenAddress, storeGrantFile, summarizeGrant, validateDataAgainstSchema, validateDataSchema, validateGrant, validateGrantExpiry, validateGrantFile, validateGranteeAccess, validateOperationAccess, vanaMainnet, type webhooks, withSignatureCache };