@opendatalabs/vana-sdk 0.1.0-alpha.1bbb6d4 → 0.1.0-alpha.273dc39

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
 
@@ -2182,8 +2182,8 @@ interface Schema {
2182
2182
  id: number;
2183
2183
  /** Schema name */
2184
2184
  name: string;
2185
- /** Schema type */
2186
- type: string;
2185
+ /** Schema dialect */
2186
+ dialect: string;
2187
2187
  /** URL containing the schema definition */
2188
2188
  definitionUrl: string;
2189
2189
  }
@@ -2214,8 +2214,8 @@ interface Refiner {
2214
2214
  interface AddSchemaParams {
2215
2215
  /** Schema name */
2216
2216
  name: string;
2217
- /** Schema type */
2218
- type: string;
2217
+ /** Schema dialect */
2218
+ dialect: string;
2219
2219
  /** URL containing the schema definition */
2220
2220
  definitionUrl: string;
2221
2221
  }
@@ -2290,13 +2290,7 @@ interface UpdateSchemaIdResult {
2290
2290
  transactionHash: Hash;
2291
2291
  }
2292
2292
  /**
2293
- * Query mode for trusted server retrieval
2294
- *
2295
- * @category Data Management
2296
- */
2297
- type TrustedServerQueryMode = "subgraph" | "rpc" | "auto";
2298
- /**
2299
- * Trusted server data structure (unified format for both subgraph and RPC modes)
2293
+ * Trusted server data structure
2300
2294
  *
2301
2295
  * @category Data Management
2302
2296
  */
@@ -2315,39 +2309,20 @@ interface TrustedServer {
2315
2309
  trustIndex?: number;
2316
2310
  }
2317
2311
  /**
2318
- * Parameters for getUserTrustedServers with dual-mode support
2312
+ * Parameters for getUserTrustedServers method
2319
2313
  *
2320
2314
  * @category Data Management
2321
2315
  */
2322
2316
  interface GetUserTrustedServersParams {
2323
- /** User address to query */
2317
+ /** User address to query trusted servers for */
2324
2318
  user: Address;
2325
- /** Query mode: 'subgraph' (fast, requires subgraph), 'rpc' (direct contract), or 'auto' (tries subgraph first) */
2326
- mode?: TrustedServerQueryMode;
2327
- /** Subgraph URL (required for subgraph mode) */
2319
+ /** Optional subgraph URL to override default */
2328
2320
  subgraphUrl?: string;
2329
- /** Pagination limit (applies to RPC mode) */
2321
+ /** Maximum number of results */
2330
2322
  limit?: number;
2331
- /** Pagination offset (applies to RPC mode) */
2323
+ /** Number of results to skip */
2332
2324
  offset?: number;
2333
2325
  }
2334
- /**
2335
- * Result of getUserTrustedServers query
2336
- *
2337
- * @category Data Management
2338
- */
2339
- interface GetUserTrustedServersResult {
2340
- /** Array of trusted servers */
2341
- servers: TrustedServer[];
2342
- /** Query mode that was actually used */
2343
- usedMode: TrustedServerQueryMode;
2344
- /** Total count (only available in RPC mode) */
2345
- total?: number;
2346
- /** Whether there are more servers (pagination info for RPC mode) */
2347
- hasMore?: boolean;
2348
- /** Any warnings or fallback information */
2349
- warnings?: string[];
2350
- }
2351
2326
 
2352
2327
  declare const contractAbis: {
2353
2328
  readonly DataPortabilityPermissions: readonly [{
@@ -28735,6 +28710,95 @@ type VanaContract = keyof ContractAbis;
28735
28710
  */
28736
28711
  declare function getAbi<T extends VanaContract>(contract: T): ContractAbis[T];
28737
28712
 
28713
+ /**
28714
+ * Comprehensive mapping of SDK transaction operations to blockchain events.
28715
+ * Used by the generic transaction parser to know which contract and event
28716
+ * to look for when parsing transaction results.
28717
+ */
28718
+ declare const EVENT_MAPPINGS: {
28719
+ readonly grant: {
28720
+ readonly contract: "DataPortabilityPermissions";
28721
+ readonly event: "PermissionAdded";
28722
+ };
28723
+ readonly revoke: {
28724
+ readonly contract: "DataPortabilityPermissions";
28725
+ readonly event: "PermissionRevoked";
28726
+ };
28727
+ readonly revokePermission: {
28728
+ readonly contract: "DataPortabilityPermissions";
28729
+ readonly event: "PermissionRevoked";
28730
+ };
28731
+ readonly addServerFilesAndPermissions: {
28732
+ readonly contract: "DataPortabilityPermissions";
28733
+ readonly event: "PermissionAdded";
28734
+ };
28735
+ readonly trustServer: {
28736
+ readonly contract: "DataPortabilityServers";
28737
+ readonly event: "ServerTrusted";
28738
+ };
28739
+ readonly untrustServer: {
28740
+ readonly contract: "DataPortabilityServers";
28741
+ readonly event: "ServerUntrusted";
28742
+ };
28743
+ readonly registerServer: {
28744
+ readonly contract: "DataPortabilityServers";
28745
+ readonly event: "ServerRegistered";
28746
+ };
28747
+ readonly updateServer: {
28748
+ readonly contract: "DataPortabilityServers";
28749
+ readonly event: "ServerUpdated";
28750
+ };
28751
+ readonly addAndTrustServer: {
28752
+ readonly contract: "DataPortabilityServers";
28753
+ readonly event: "ServerTrusted";
28754
+ };
28755
+ readonly addFile: {
28756
+ readonly contract: "DataRegistry";
28757
+ readonly event: "FileAdded";
28758
+ };
28759
+ readonly addFileWithPermissionsAndSchema: {
28760
+ readonly contract: "DataRegistry";
28761
+ readonly event: "FileAdded";
28762
+ };
28763
+ readonly addFileWithSchema: {
28764
+ readonly contract: "DataRegistry";
28765
+ readonly event: "FileAdded";
28766
+ };
28767
+ readonly addFileWithPermissions: {
28768
+ readonly contract: "DataRegistry";
28769
+ readonly event: "FileAdded";
28770
+ };
28771
+ readonly addRefinement: {
28772
+ readonly contract: "DataRegistry";
28773
+ readonly event: "RefinementAdded";
28774
+ };
28775
+ readonly addRefiner: {
28776
+ readonly contract: "DataRefinerRegistry";
28777
+ readonly event: "RefinerAdded";
28778
+ };
28779
+ readonly updateSchemaId: {
28780
+ readonly contract: "DataRefinerRegistry";
28781
+ readonly event: "SchemaAdded";
28782
+ };
28783
+ readonly addSchema: {
28784
+ readonly contract: "DataRefinerRegistry";
28785
+ readonly event: "SchemaAdded";
28786
+ };
28787
+ readonly updateRefinement: {
28788
+ readonly contract: "DataRegistry";
28789
+ readonly event: "RefinementUpdated";
28790
+ };
28791
+ readonly addFilePermission: {
28792
+ readonly contract: "DataRegistry";
28793
+ readonly event: "PermissionGranted";
28794
+ };
28795
+ readonly registerGrantee: {
28796
+ readonly contract: "DataPortabilityGrantees";
28797
+ readonly event: "GranteeRegistered";
28798
+ };
28799
+ };
28800
+ type TransactionOperation = keyof typeof EVENT_MAPPINGS;
28801
+
28738
28802
  /**
28739
28803
  * Base interface for all transaction results.
28740
28804
  * Contains the event data plus transaction metadata.
@@ -28772,6 +28836,62 @@ interface PermissionRevokeResult extends BaseTransactionResult {
28772
28836
  /** ID of the permission that was revoked */
28773
28837
  permissionId: bigint;
28774
28838
  }
28839
+ /**
28840
+ * Result of a successful server trust operation.
28841
+ * Contains data from the ServerTrusted blockchain event.
28842
+ */
28843
+ interface ServerTrustResult extends BaseTransactionResult {
28844
+ /** Address of the user who trusted the server */
28845
+ user: Address;
28846
+ /** Address/ID of the trusted server */
28847
+ serverId: Address;
28848
+ /** URL of the trusted server */
28849
+ serverUrl: string;
28850
+ }
28851
+ /**
28852
+ * Result of a successful server untrust operation.
28853
+ * Contains data from the ServerUntrusted blockchain event.
28854
+ */
28855
+ interface ServerUntrustResult extends BaseTransactionResult {
28856
+ /** Address of the user who untrusted the server */
28857
+ user: Address;
28858
+ /** Address/ID of the untrusted server */
28859
+ serverId: Address;
28860
+ }
28861
+ /**
28862
+ * Result of a successful server update operation.
28863
+ * Contains data from the ServerUpdated blockchain event.
28864
+ */
28865
+ interface ServerUpdateResult extends BaseTransactionResult {
28866
+ /** ID of the server that was updated */
28867
+ serverId: bigint;
28868
+ /** New URL of the server */
28869
+ url: string;
28870
+ }
28871
+ /**
28872
+ * Result of a successful grantee registration operation.
28873
+ * Contains data from the GranteeRegistered blockchain event.
28874
+ */
28875
+ interface GranteeRegisterResult extends BaseTransactionResult {
28876
+ /** Unique grantee ID assigned by the registry */
28877
+ granteeId: bigint;
28878
+ /** Address of the registered grantee */
28879
+ granteeAddress: Address;
28880
+ /** Display name of the grantee */
28881
+ name: string;
28882
+ }
28883
+ /**
28884
+ * Result of a successful file addition operation.
28885
+ * Contains data from the FileAdded blockchain event.
28886
+ */
28887
+ interface FileAddedResult extends BaseTransactionResult {
28888
+ /** Unique file ID assigned by the registry */
28889
+ fileId: bigint;
28890
+ /** Address of the file owner */
28891
+ ownerAddress: Address;
28892
+ /** URL where the file is stored */
28893
+ url: string;
28894
+ }
28775
28895
  /**
28776
28896
  * Result of a successful file permission addition operation.
28777
28897
  * Contains data from the FilePermissionAdded blockchain event.
@@ -28785,6 +28905,80 @@ interface FilePermissionResult extends BaseTransactionResult {
28785
28905
  encryptedKey: string;
28786
28906
  }
28787
28907
 
28908
+ /**
28909
+ * Provides a unified interface for blockchain transaction results with lazy-loaded event parsing.
28910
+ *
28911
+ * @remarks
28912
+ * TransactionHandle enables immediate access to transaction hashes while providing optional
28913
+ * lazy-loaded access to receipts and parsed event data. All transaction-submitting methods
28914
+ * in the SDK return this handle, allowing developers to choose between immediate hash access
28915
+ * or waiting for event data. Results are memoized to prevent redundant network calls.
28916
+ *
28917
+ * @category Transactions
28918
+ * @example
28919
+ * ```typescript
28920
+ * // Immediate hash access
28921
+ * const tx = await sdk.permissions.submitSignedGrant(typedData, signature);
28922
+ * console.log(`Transaction submitted: ${tx.hash}`);
28923
+ *
28924
+ * // Wait for and parse events
28925
+ * const eventData = await tx.waitForEvents();
28926
+ * console.log(`Permission ID: ${eventData.permissionId}`);
28927
+ *
28928
+ * // Check receipt for gas usage
28929
+ * const receipt = await tx.waitForReceipt();
28930
+ * console.log(`Gas used: ${receipt.gasUsed}`);
28931
+ * ```
28932
+ */
28933
+ declare class TransactionHandle<TEventData = unknown> {
28934
+ private readonly context;
28935
+ readonly hash: Hash;
28936
+ private readonly operation?;
28937
+ private _receipt?;
28938
+ private _eventData?;
28939
+ private _receiptPromise?;
28940
+ private _eventPromise?;
28941
+ constructor(context: ControllerContext$1, hash: Hash, operation?: TransactionOperation | undefined);
28942
+ /**
28943
+ * Waits for transaction confirmation and returns the receipt.
28944
+ * Results are memoized - multiple calls return the same promise.
28945
+ *
28946
+ * @param options Optional timeout configuration
28947
+ * @param options.timeout Timeout in milliseconds (default: 30000)
28948
+ * @returns Transaction receipt with gas usage, logs, and status
28949
+ */
28950
+ waitForReceipt(options?: {
28951
+ timeout?: number;
28952
+ }): Promise<TransactionReceipt$1>;
28953
+ /**
28954
+ * Waits for transaction confirmation and parses emitted events.
28955
+ * Results are memoized - multiple calls return the same promise.
28956
+ *
28957
+ * @returns Parsed event data with transaction metadata
28958
+ * @throws {Error} If no operation was specified for event parsing
28959
+ */
28960
+ waitForEvents(): Promise<TEventData>;
28961
+ /**
28962
+ * Enables string coercion for backwards compatibility.
28963
+ * Allows TransactionHandle to be used anywhere a Hash is expected.
28964
+ *
28965
+ * @example
28966
+ * ```typescript
28967
+ * const hash: Hash = tx; // Works via toString()
28968
+ * console.log(`Transaction: ${tx}`); // Prints hash
28969
+ * ```
28970
+ * @returns The transaction hash as a string
28971
+ */
28972
+ toString(): string;
28973
+ /**
28974
+ * JSON serialization support.
28975
+ * Returns the hash when serialized to JSON.
28976
+ *
28977
+ * @returns The transaction hash for JSON serialization
28978
+ */
28979
+ toJSON(): string;
28980
+ }
28981
+
28788
28982
  /**
28789
28983
  * Google Drive Storage Provider for Vana SDK
28790
28984
  *
@@ -29823,30 +30017,31 @@ declare class PermissionsController {
29823
30017
  */
29824
30018
  grant(params: GrantPermissionParams$1): Promise<PermissionGrantResult>;
29825
30019
  /**
29826
- * Submits a permission grant transaction and returns the transaction hash immediately.
30020
+ * Submits a permission grant transaction and returns a handle for flexible result access.
29827
30021
  *
29828
- * This is the lower-level method that provides maximum control over transaction timing.
29829
- * Use this when you want to handle transaction confirmation and event parsing separately,
29830
- * or when submitting multiple transactions in batch.
30022
+ * @remarks
30023
+ * This lower-level method provides maximum control over transaction timing.
30024
+ * Returns a TransactionHandle that allows immediate hash access or optional event parsing.
30025
+ * Use this when handling multiple transactions or when you need granular control.
29831
30026
  *
29832
30027
  * @param params - The permission grant configuration object
29833
- * @returns Promise that resolves to the transaction hash when successfully submitted
30028
+ * @returns Promise resolving to TransactionHandle with hash and event parsing capabilities
29834
30029
  * @throws {RelayerError} When gasless transaction submission fails
29835
30030
  * @throws {SignatureError} When user rejects the signature request
29836
30031
  * @throws {SerializationError} When grant data cannot be serialized
29837
30032
  * @throws {BlockchainError} When permission grant preparation fails
29838
30033
  * @example
29839
30034
  * ```typescript
29840
- * // Submit transaction and handle confirmation later
29841
- * const txHash = await vana.permissions.submitPermissionGrant(params);
29842
- * console.log(`Transaction submitted: ${txHash}`);
30035
+ * // Submit transaction and get immediate hash access
30036
+ * const tx = await vana.permissions.submitPermissionGrant(params);
30037
+ * console.log(`Transaction submitted: ${tx.hash}`);
29843
30038
  *
29844
- * // Later, when you need the permission data:
29845
- * const result = await parseTransactionResult(context, txHash, 'grant');
29846
- * console.log(`Permission ID: ${result.permissionId}`);
30039
+ * // Optionally wait for and parse events
30040
+ * const eventData = await tx.waitForEvents();
30041
+ * console.log(`Permission ID: ${eventData.permissionId}`);
29847
30042
  * ```
29848
30043
  */
29849
- submitPermissionGrant(params: GrantPermissionParams$1): Promise<Hash>;
30044
+ submitPermissionGrant(params: GrantPermissionParams$1): Promise<TransactionHandle<PermissionGrantResult>>;
29850
30045
  /**
29851
30046
  * Prepares a permission grant with preview before signing.
29852
30047
  *
@@ -29874,15 +30069,21 @@ declare class PermissionsController {
29874
30069
  */
29875
30070
  prepareGrant(params: GrantPermissionParams$1): Promise<{
29876
30071
  preview: GrantFile;
29877
- confirm: () => Promise<Hash>;
30072
+ confirm: () => Promise<TransactionHandle<PermissionGrantResult>>;
29878
30073
  }>;
29879
30074
  /**
29880
- * Internal method to complete the grant process after user confirmation.
29881
- * This is called by the confirm() function returned from prepareGrant().
30075
+ * Completes the grant process after user confirmation.
30076
+ *
30077
+ * @remarks
30078
+ * This internal method is called by the confirm() function returned from prepareGrant().
30079
+ * It handles IPFS upload, signature creation, and transaction submission.
29882
30080
  *
29883
30081
  * @param params - The permission grant parameters containing user and operation details
29884
30082
  * @param grantFile - The prepared grant file with permissions and metadata
29885
- * @returns Promise resolving to the transaction hash
30083
+ * @returns Promise resolving to TransactionHandle for flexible result access
30084
+ * @throws {BlockchainError} When permission grant confirmation fails
30085
+ * @throws {NetworkError} When IPFS upload fails
30086
+ * @throws {SignatureError} When user rejects the signature
29886
30087
  */
29887
30088
  private confirmGrantInternal;
29888
30089
  /**
@@ -29938,49 +30139,106 @@ declare class PermissionsController {
29938
30139
  * );
29939
30140
  * ```
29940
30141
  */
29941
- submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<Hash>;
30142
+ submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
29942
30143
  /**
29943
30144
  * Submits an already-signed trust server transaction to the blockchain.
30145
+ *
30146
+ * @remarks
29944
30147
  * This method extracts the trust server input from typed data and submits it directly.
30148
+ * Used internally by trust server methods after signature collection.
29945
30149
  *
29946
30150
  * @param typedData - The EIP-712 typed data for TrustServer
29947
- * @param signature - The user's signature
29948
- * @returns Promise resolving to the transaction hash
30151
+ * @param signature - The user's signature obtained via `signTypedData()`
30152
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30153
+ * @throws {BlockchainError} When contract submission fails
30154
+ * @throws {NetworkError} When blockchain communication fails
30155
+ * @example
30156
+ * ```typescript
30157
+ * const txHandle = await vana.permissions.submitSignedTrustServer(
30158
+ * typedData,
30159
+ * "0x1234..."
30160
+ * );
30161
+ * const result = await txHandle.waitForEvents();
30162
+ * ```
29949
30163
  */
29950
- submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<Hash>;
30164
+ submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
29951
30165
  /**
29952
30166
  * Submits an already-signed add and trust server transaction to the blockchain.
30167
+ *
30168
+ * @remarks
29953
30169
  * This method extracts the add and trust server input from typed data and submits it directly.
30170
+ * Combines server registration and trust operations in a single transaction.
29954
30171
  *
29955
30172
  * @param typedData - The EIP-712 typed data for AddAndTrustServer
29956
- * @param signature - The user's signature
29957
- * @returns Promise resolving to the transaction hash
30173
+ * @param signature - The user's signature obtained via `signTypedData()`
30174
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30175
+ * @throws {BlockchainError} When contract submission fails
30176
+ * @throws {NetworkError} When blockchain communication fails
30177
+ * @example
30178
+ * ```typescript
30179
+ * const txHandle = await vana.permissions.submitSignedAddAndTrustServer(
30180
+ * typedData,
30181
+ * "0x1234..."
30182
+ * );
30183
+ * const result = await txHandle.waitForEvents();
30184
+ * ```
29958
30185
  */
29959
- submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<Hash>;
30186
+ submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
29960
30187
  /**
29961
30188
  * Submits an already-signed permission revoke transaction to the blockchain.
30189
+ *
30190
+ * @remarks
29962
30191
  * This method handles the revocation of previously granted permissions.
30192
+ * Used internally by revocation methods after signature collection.
29963
30193
  *
29964
30194
  * @param typedData - The EIP-712 typed data for PermissionRevoke
29965
- * @param signature - The user's signature
29966
- * @returns Promise resolving to the transaction hash
30195
+ * @param signature - The user's signature obtained via `signTypedData()`
30196
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30197
+ * @throws {BlockchainError} When contract submission fails
30198
+ * @throws {NetworkError} When blockchain communication fails
30199
+ * @example
30200
+ * ```typescript
30201
+ * const txHandle = await vana.permissions.submitSignedRevoke(
30202
+ * typedData,
30203
+ * "0x1234..."
30204
+ * );
30205
+ * const result = await txHandle.waitForEvents();
30206
+ * ```
29967
30207
  */
29968
- submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30208
+ submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionRevokeResult>>;
29969
30209
  /**
29970
30210
  * Submits an already-signed untrust server transaction to the blockchain.
30211
+ *
30212
+ * @remarks
29971
30213
  * This method handles the removal of trusted servers.
30214
+ * Used internally by untrust server methods after signature collection.
29972
30215
  *
29973
30216
  * @param typedData - The EIP-712 typed data for UntrustServer
29974
- * @param signature - The user's signature
29975
- * @returns Promise resolving to the transaction hash
30217
+ * @param signature - The user's signature obtained via `signTypedData()`
30218
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30219
+ * @throws {BlockchainError} When contract submission fails
30220
+ * @throws {NetworkError} When blockchain communication fails
30221
+ * @example
30222
+ * ```typescript
30223
+ * const txHandle = await vana.permissions.submitSignedUntrustServer(
30224
+ * typedData,
30225
+ * "0x1234..."
30226
+ * );
30227
+ * const result = await txHandle.waitForEvents();
30228
+ * ```
29976
30229
  */
29977
- submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30230
+ submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<ServerUntrustResult>>;
29978
30231
  /**
29979
30232
  * Submits a signed transaction directly to the blockchain.
29980
30233
  *
30234
+ * @remarks
30235
+ * Internal method used when relayer callbacks are not available. Formats the signature
30236
+ * and submits the permission grant directly to the smart contract.
30237
+ *
29981
30238
  * @param typedData - The typed data structure for the permission grant
29982
30239
  * @param signature - The cryptographic signature authorizing the transaction
29983
30240
  * @returns Promise resolving to the transaction hash
30241
+ * @throws {BlockchainError} When contract submission fails
29984
30242
  */
29985
30243
  private submitDirectTransaction;
29986
30244
  /**
@@ -30027,19 +30285,33 @@ declare class PermissionsController {
30027
30285
  * console.log(`Revocation submitted: ${txHash}`);
30028
30286
  * ```
30029
30287
  */
30030
- submitPermissionRevoke(params: RevokePermissionParams): Promise<Hash>;
30288
+ submitPermissionRevoke(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
30031
30289
  /**
30032
- * Revokes a permission with a signature (gasless transaction).
30290
+ * Revokes a permission with a signature for gasless transactions.
30291
+ *
30292
+ * @remarks
30293
+ * This method creates an EIP-712 signature for permission revocation and submits
30294
+ * it either through relayer callbacks or directly to the blockchain. Provides
30295
+ * gasless revocation when relayer is configured.
30033
30296
  *
30034
30297
  * @param params - Parameters for revoking the permission
30035
- * @returns Promise resolving to transaction hash
30298
+ * @param params.permissionId - Permission identifier to revoke (accepts bigint, number, or string)
30299
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30036
30300
  * @throws {BlockchainError} When chain ID is not available
30037
30301
  * @throws {NonceError} When retrieving user nonce fails
30038
30302
  * @throws {SignatureError} When user rejects the signature request
30039
30303
  * @throws {RelayerError} When gasless submission fails
30040
30304
  * @throws {PermissionError} When revocation fails for any other reason
30305
+ * @example
30306
+ * ```typescript
30307
+ * const txHandle = await vana.permissions.submitRevokeWithSignature({
30308
+ * permissionId: 123n
30309
+ * });
30310
+ * const result = await txHandle.waitForEvents();
30311
+ * console.log(`Permission ${result.permissionId} revoked`);
30312
+ * ```
30041
30313
  */
30042
- submitRevokeWithSignature(params: RevokePermissionParams): Promise<Hash>;
30314
+ submitRevokeWithSignature(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
30043
30315
  /**
30044
30316
  * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30045
30317
  *
@@ -30064,6 +30336,18 @@ declare class PermissionsController {
30064
30336
  * const serversNonce = await this.getServersUserNonce();
30065
30337
  * ```
30066
30338
  */
30339
+ /**
30340
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30341
+ *
30342
+ * Retrieves the user's current nonce from the DataPortabilityServers contract.
30343
+ *
30344
+ * @remarks
30345
+ * This method is deprecated in favor of more specific nonce methods that target
30346
+ * the appropriate contract for the operation being performed.
30347
+ *
30348
+ * @returns Promise resolving to the user's current nonce as a bigint
30349
+ * @throws {NonceError} When retrieving the nonce fails
30350
+ */
30067
30351
  private getUserNonce;
30068
30352
  /**
30069
30353
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
@@ -30079,6 +30363,16 @@ declare class PermissionsController {
30079
30363
  * console.log(`Current servers nonce: ${nonce}`);
30080
30364
  * ```
30081
30365
  */
30366
+ /**
30367
+ * Retrieves the user's current nonce from the DataPortabilityServers contract.
30368
+ *
30369
+ * @remarks
30370
+ * Used for server-related operations (trust/untrust) to prevent replay attacks.
30371
+ * The nonce must be incremented with each server operation.
30372
+ *
30373
+ * @returns Promise resolving to the user's current nonce as a bigint
30374
+ * @throws {NonceError} When retrieving the nonce fails
30375
+ */
30082
30376
  private getServersUserNonce;
30083
30377
  /**
30084
30378
  * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
@@ -30094,6 +30388,16 @@ declare class PermissionsController {
30094
30388
  * console.log(`Current permissions nonce: ${nonce}`);
30095
30389
  * ```
30096
30390
  */
30391
+ /**
30392
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
30393
+ *
30394
+ * @remarks
30395
+ * Used for permission-related operations (grant/revoke) to prevent replay attacks.
30396
+ * The nonce must be incremented with each permission operation.
30397
+ *
30398
+ * @returns Promise resolving to the user's current nonce as a bigint
30399
+ * @throws {NonceError} When retrieving the nonce fails
30400
+ */
30097
30401
  private getPermissionsUserNonce;
30098
30402
  /**
30099
30403
  * Composes the EIP-712 typed data for PermissionGrant (new simplified format).
@@ -30220,7 +30524,7 @@ declare class PermissionsController {
30220
30524
  * console.log('Now trusting servers:', trustedServers);
30221
30525
  * ```
30222
30526
  */
30223
- addAndTrustServer(params: AddAndTrustServerParams): Promise<Hash>;
30527
+ addAndTrustServer(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30224
30528
  /**
30225
30529
  * Trusts a server for data processing (legacy method).
30226
30530
  *
@@ -30228,14 +30532,14 @@ declare class PermissionsController {
30228
30532
  * @returns Promise resolving to transaction hash
30229
30533
  * @deprecated Use addAndTrustServer instead
30230
30534
  */
30231
- submitTrustServer(params: TrustServerParams): Promise<Hash>;
30535
+ submitTrustServer(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30232
30536
  /**
30233
30537
  * Adds and trusts a server using a signature (gasless transaction).
30234
30538
  *
30235
30539
  * @param params - Parameters for adding and trusting the server
30236
- * @returns Promise resolving to transaction hash
30540
+ * @returns Promise resolving to TransactionHandle with ServerTrustResult event data
30237
30541
  */
30238
- submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<Hash>;
30542
+ submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30239
30543
  /**
30240
30544
  * Trusts a server using a signature (gasless transaction - legacy method).
30241
30545
  *
@@ -30249,13 +30553,24 @@ declare class PermissionsController {
30249
30553
  * @throws {ServerUrlMismatchError} When server URL doesn't match existing registration
30250
30554
  * @throws {BlockchainError} When trust operation fails for any other reason
30251
30555
  */
30252
- submitTrustServerWithSignature(params: TrustServerParams): Promise<Hash>;
30556
+ submitTrustServerWithSignature(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30253
30557
  /**
30254
30558
  * Submits a direct untrust server transaction (without signature).
30255
30559
  *
30256
30560
  * @param params - The untrust server parameters containing server details
30257
30561
  * @returns Promise resolving to the transaction hash
30258
30562
  */
30563
+ /**
30564
+ * Submits an untrust server transaction directly to the blockchain.
30565
+ *
30566
+ * @remarks
30567
+ * Internal method used for direct blockchain submission of untrust server operations
30568
+ * when relayer callbacks are not available.
30569
+ *
30570
+ * @param params - The untrust server parameters
30571
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30572
+ * @throws {BlockchainError} When contract submission fails
30573
+ */
30259
30574
  private submitDirectUntrustTransaction;
30260
30575
  /**
30261
30576
  * Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
@@ -30285,7 +30600,7 @@ declare class PermissionsController {
30285
30600
  * console.log('Still trusting servers:', trustedServers);
30286
30601
  * ```
30287
30602
  */
30288
- submitUntrustServer(params: UntrustServerParams): Promise<Hash>;
30603
+ submitUntrustServer(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
30289
30604
  /**
30290
30605
  * Untrusts a server using a signature (gasless transaction).
30291
30606
  *
@@ -30298,7 +30613,7 @@ declare class PermissionsController {
30298
30613
  * @throws {RelayerError} When gasless submission fails
30299
30614
  * @throws {BlockchainError} When untrust transaction fails
30300
30615
  */
30301
- submitUntrustServerWithSignature(params: UntrustServerParams): Promise<Hash>;
30616
+ submitUntrustServerWithSignature(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
30302
30617
  /**
30303
30618
  * Retrieves all servers trusted by a user from the DataPortabilityServers contract.
30304
30619
  *
@@ -30349,22 +30664,60 @@ declare class PermissionsController {
30349
30664
  /**
30350
30665
  * Gets server information for multiple servers efficiently.
30351
30666
  *
30352
- * @param serverIds - Array of server IDs to query
30353
- * @returns Promise resolving to batch result with successes and failures
30667
+ * @remarks
30668
+ * This method uses multicall to fetch information for multiple servers in a single
30669
+ * blockchain call, improving performance when querying many servers. Failed lookups
30670
+ * are returned separately for error handling.
30671
+ *
30672
+ * @param serverIds - Array of numeric server IDs to query
30673
+ * @returns Promise resolving to batch result containing successful lookups and failed IDs
30354
30674
  * @throws {BlockchainError} When reading from contract fails or chain is unavailable
30675
+ * @example
30676
+ * ```typescript
30677
+ * const result = await vana.permissions.getServerInfoBatch([1, 2, 3, 999]);
30678
+ *
30679
+ * // Process successful lookups
30680
+ * result.servers.forEach((server, id) => {
30681
+ * console.log(`Server ${id}: ${server.url}`);
30682
+ * });
30683
+ *
30684
+ * // Handle failed lookups
30685
+ * if (result.failed.length > 0) {
30686
+ * console.log(`Failed to fetch: ${result.failed.join(', ')}`);
30687
+ * }
30688
+ * ```
30355
30689
  */
30356
30690
  getServerInfoBatch(serverIds: number[]): Promise<BatchServerInfoResult>;
30357
30691
  /**
30358
30692
  * Checks whether a specific server is trusted by a user.
30359
30693
  *
30360
- * @param serverId - Server ID to check (numeric)
30694
+ * @remarks
30695
+ * This method queries the user's trusted server list and checks if the specified
30696
+ * server is present. Returns both the trust status and the index in the trust list
30697
+ * if trusted.
30698
+ *
30699
+ * @param serverId - Numeric server ID to check
30361
30700
  * @param userAddress - Optional user address (defaults to current user)
30362
- * @returns Promise resolving to server trust status
30701
+ * @returns Promise resolving to server trust status with trust index if applicable
30702
+ * @throws {BlockchainError} When reading from contract fails
30703
+ * @example
30704
+ * ```typescript
30705
+ * const status = await vana.permissions.checkServerTrustStatus(1);
30706
+ * if (status.isTrusted) {
30707
+ * console.log(`Server is trusted at index ${status.trustIndex}`);
30708
+ * } else {
30709
+ * console.log('Server is not trusted');
30710
+ * }
30711
+ * ```
30363
30712
  */
30364
30713
  checkServerTrustStatus(serverId: number, userAddress?: Address): Promise<ServerTrustStatus>;
30365
30714
  /**
30366
30715
  * Composes EIP-712 typed data for AddAndTrustServer.
30367
30716
  *
30717
+ * @remarks
30718
+ * Creates the complete typed data structure required for EIP-712 signature generation
30719
+ * when adding and trusting a new server in a single transaction.
30720
+ *
30368
30721
  * @param input - The add and trust server input data containing server details
30369
30722
  * @returns Promise resolving to the typed data structure for server add and trust
30370
30723
  */
@@ -30446,7 +30799,7 @@ declare class PermissionsController {
30446
30799
  * console.log(`Grantee registered in transaction: ${txHash}`);
30447
30800
  * ```
30448
30801
  */
30449
- submitRegisterGrantee(params: RegisterGranteeParams): Promise<Hash>;
30802
+ submitRegisterGrantee(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
30450
30803
  /**
30451
30804
  * Registers a grantee with a signature (gasless transaction)
30452
30805
  *
@@ -30462,7 +30815,7 @@ declare class PermissionsController {
30462
30815
  * });
30463
30816
  * ```
30464
30817
  */
30465
- submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<Hash>;
30818
+ submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
30466
30819
  /**
30467
30820
  * Submits a signed register grantee transaction via relayer
30468
30821
  *
@@ -30475,7 +30828,7 @@ declare class PermissionsController {
30475
30828
  * const result = await vana.permissions.submitSignedRegisterGrantee(typedData, signature);
30476
30829
  * ```
30477
30830
  */
30478
- submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<Hash>;
30831
+ submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<TransactionHandle<GranteeRegisterResult>>;
30479
30832
  /**
30480
30833
  * Retrieves all registered grantees from the DataPortabilityGrantees contract.
30481
30834
  *
@@ -30762,7 +31115,7 @@ declare class PermissionsController {
30762
31115
  * @param url - New URL for the server
30763
31116
  * @returns Promise resolving to transaction hash
30764
31117
  */
30765
- submitUpdateServer(serverId: bigint, url: string): Promise<Hash>;
31118
+ submitUpdateServer(serverId: bigint, url: string): Promise<TransactionHandle<ServerUpdateResult>>;
30766
31119
  /**
30767
31120
  * Get all permission IDs for a user
30768
31121
  *
@@ -30802,19 +31155,19 @@ declare class PermissionsController {
30802
31155
  * @throws {BlockchainError} When permission addition fails
30803
31156
  * @throws {NetworkError} When network communication fails
30804
31157
  */
30805
- submitAddPermission(params: ServerFilesAndPermissionParams): Promise<Hash>;
31158
+ submitAddPermission(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
30806
31159
  /**
30807
31160
  * Submits an already-signed add permission transaction to the blockchain.
30808
31161
  * This method supports both relayer-based gasless transactions and direct transactions.
30809
31162
  *
30810
31163
  * @param typedData - The EIP-712 typed data for AddPermission
30811
31164
  * @param signature - The user's signature
30812
- * @returns Promise resolving to the transaction hash
31165
+ * @returns Promise resolving to TransactionHandle with PermissionGrantResult event data
30813
31166
  * @throws {RelayerError} When gasless transaction submission fails
30814
31167
  * @throws {BlockchainError} When permission addition fails
30815
31168
  * @throws {NetworkError} When network communication fails
30816
31169
  */
30817
- submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
31170
+ submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
30818
31171
  /**
30819
31172
  * Submit server files and permissions with signature to the blockchain (supports gasless transactions)
30820
31173
  *
@@ -30825,26 +31178,43 @@ declare class PermissionsController {
30825
31178
  * @throws {BlockchainError} When server files and permissions addition fails
30826
31179
  * @throws {NetworkError} When network communication fails
30827
31180
  */
30828
- submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<Hash>;
31181
+ submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
30829
31182
  /**
30830
31183
  * Submits an already-signed add server files and permissions transaction to the blockchain.
30831
- * This method supports both relayer-based gasless transactions and direct transactions.
31184
+ *
31185
+ * @remarks
31186
+ * This method returns a TransactionHandle that provides immediate access to the transaction hash
31187
+ * while allowing lazy-loaded access to parsed event data. Use `waitForEvents()` to retrieve
31188
+ * the permission ID and other event details after transaction confirmation.
30832
31189
  *
30833
31190
  * @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
30834
31191
  * @param signature - The user's signature
30835
- * @returns Promise resolving to the transaction hash
31192
+ * @returns TransactionHandle with immediate hash access and optional event parsing
30836
31193
  * @throws {RelayerError} When gasless transaction submission fails
30837
31194
  * @throws {BlockchainError} When server files and permissions addition fails
30838
31195
  * @throws {NetworkError} When network communication fails
31196
+ *
31197
+ * @example
31198
+ * ```typescript
31199
+ * const tx = await vana.permissions.submitSignedAddServerFilesAndPermissions(
31200
+ * typedData,
31201
+ * signature
31202
+ * );
31203
+ * console.log(`Transaction submitted: ${tx.hash}`);
31204
+ *
31205
+ * // Wait for confirmation and get the permission ID
31206
+ * const { permissionId } = await tx.waitForEvents();
31207
+ * console.log(`Permission created with ID: ${permissionId}`);
31208
+ * ```
30839
31209
  */
30840
- submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<Hash>;
31210
+ submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
30841
31211
  /**
30842
31212
  * Submit permission revocation with signature to the blockchain
30843
31213
  *
30844
31214
  * @param permissionId - Permission ID to revoke
30845
31215
  * @returns Promise resolving to transaction hash
30846
31216
  */
30847
- submitRevokePermission(permissionId: bigint): Promise<Hash>;
31217
+ submitRevokePermission(permissionId: bigint): Promise<TransactionHandle<PermissionRevokeResult>>;
30848
31218
  /**
30849
31219
  * Submits a signed add permission transaction directly to the blockchain.
30850
31220
  *
@@ -30986,33 +31356,52 @@ declare class SchemaController {
30986
31356
  * Retrieves a schema by its ID.
30987
31357
  *
30988
31358
  * @param schemaId - The ID of the schema to retrieve
31359
+ * @param options - Optional parameters
31360
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
30989
31361
  * @returns Promise resolving to the schema object
30990
31362
  * @throws {Error} When the schema is not found or chain is unavailable
30991
31363
  * @example
30992
31364
  * ```typescript
30993
31365
  * const schema = await vana.schemas.get(1);
30994
31366
  * console.log(`Schema: ${schema.name} (${schema.type})`);
31367
+ *
31368
+ * // With custom subgraph
31369
+ * const schema = await vana.schemas.get(1, {
31370
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
31371
+ * });
30995
31372
  * ```
30996
31373
  */
30997
- get(schemaId: number): Promise<Schema>;
31374
+ get(schemaId: number, options?: {
31375
+ subgraphUrl?: string;
31376
+ }): Promise<Schema>;
30998
31377
  /**
30999
31378
  * Gets the total number of schemas registered on the network.
31000
31379
  *
31380
+ * @param options - Optional parameters
31381
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
31001
31382
  * @returns Promise resolving to the total schema count
31002
31383
  * @throws {Error} When the count cannot be retrieved
31003
31384
  * @example
31004
31385
  * ```typescript
31005
31386
  * const count = await vana.schemas.count();
31006
31387
  * console.log(`Total schemas: ${count}`);
31388
+ *
31389
+ * // With custom subgraph
31390
+ * const count = await vana.schemas.count({
31391
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
31392
+ * });
31007
31393
  * ```
31008
31394
  */
31009
- count(): Promise<number>;
31395
+ count(options?: {
31396
+ subgraphUrl?: string;
31397
+ }): Promise<number>;
31010
31398
  /**
31011
31399
  * Lists all schemas with pagination.
31012
31400
  *
31013
31401
  * @param options - Optional parameters for listing schemas
31014
31402
  * @param options.limit - Maximum number of schemas to return
31015
31403
  * @param options.offset - Number of schemas to skip
31404
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
31016
31405
  * @returns Promise resolving to an array of schemas
31017
31406
  * @example
31018
31407
  * ```typescript
@@ -31021,11 +31410,19 @@ declare class SchemaController {
31021
31410
  *
31022
31411
  * // Get schemas with pagination
31023
31412
  * const schemas = await vana.schemas.list({ limit: 10, offset: 0 });
31413
+ *
31414
+ * // With custom subgraph
31415
+ * const schemas = await vana.schemas.list({
31416
+ * limit: 10,
31417
+ * offset: 0,
31418
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
31419
+ * });
31024
31420
  * ```
31025
31421
  */
31026
31422
  list(options?: {
31027
31423
  limit?: number;
31028
31424
  offset?: number;
31425
+ subgraphUrl?: string;
31029
31426
  }): Promise<Schema[]>;
31030
31427
  /**
31031
31428
  * Adds a schema using the legacy method (low-level API).
@@ -31035,6 +31432,36 @@ declare class SchemaController {
31035
31432
  * @returns Promise resolving to the add schema result
31036
31433
  */
31037
31434
  addSchema(params: AddSchemaParams): Promise<AddSchemaResult>;
31435
+ /**
31436
+ * Internal method: Query schema via subgraph
31437
+ *
31438
+ * @param params - Query parameters
31439
+ * @param params.schemaId - The ID of the schema to retrieve
31440
+ * @param params.subgraphUrl - The subgraph URL to query
31441
+ * @returns Promise resolving to the schema object
31442
+ * @private
31443
+ */
31444
+ private _getSchemaViaSubgraph;
31445
+ /**
31446
+ * Internal method: List schemas via subgraph
31447
+ *
31448
+ * @param params - Query parameters
31449
+ * @param params.limit - Maximum number of schemas to return
31450
+ * @param params.offset - Number of schemas to skip
31451
+ * @param params.subgraphUrl - The subgraph URL to query
31452
+ * @returns Promise resolving to an array of schemas
31453
+ * @private
31454
+ */
31455
+ private _listSchemasViaSubgraph;
31456
+ /**
31457
+ * Internal method: Count schemas via subgraph
31458
+ *
31459
+ * @param params - Query parameters
31460
+ * @param params.subgraphUrl - The subgraph URL to query
31461
+ * @returns Promise resolving to the total schema count
31462
+ * @private
31463
+ */
31464
+ private _countSchemasViaSubgraph;
31038
31465
  /**
31039
31466
  * Gets the user's wallet address.
31040
31467
  *
@@ -33683,19 +34110,18 @@ declare class DataController {
33683
34110
  subgraphUrl?: string;
33684
34111
  }): Promise<UserFile$1[]>;
33685
34112
  /**
33686
- * Retrieves a list of permissions granted by a user using the new subgraph entities.
34113
+ * Retrieves a list of permissions granted by a user.
33687
34114
  *
33688
- * This method queries the Vana subgraph to find permissions directly granted by the user
33689
- * using the new Permission entity. It efficiently handles millions of permissions by:
33690
- * 1. Querying the subgraph for user's directly granted permissions
33691
- * 2. Returning complete permission information from subgraph
33692
- * 3. No need for additional contract calls as all data comes from subgraph
34115
+ * This method supports automatic fallback between subgraph and RPC modes:
34116
+ * - If subgraph URL is available, tries subgraph query first
34117
+ * - Falls back to direct contract queries via RPC if subgraph fails
34118
+ * - RPC mode uses gasAwareMulticall for efficient batch queries
33693
34119
  *
33694
34120
  * @param params - Object containing the user address and optional subgraph URL
33695
34121
  * @param params.user - The wallet address of the user to query permissions for
33696
34122
  * @param params.subgraphUrl - Optional subgraph URL to override the default
33697
34123
  * @returns Promise resolving to an array of permission objects
33698
- * @throws Error if subgraph is unavailable or returns invalid data
34124
+ * @throws Error if both subgraph and RPC queries fail
33699
34125
  */
33700
34126
  getUserPermissions(params: {
33701
34127
  user: Address;
@@ -33711,43 +34137,59 @@ declare class DataController {
33711
34137
  user: Address;
33712
34138
  }>>;
33713
34139
  /**
33714
- * Retrieves a list of trusted servers for a user using the new subgraph entities.
34140
+ * Internal method: Query user permissions via subgraph
33715
34141
  *
33716
- * This method queries the Vana subgraph to find trusted servers directly associated with the user
33717
- * with support for both subgraph and direct RPC queries.
34142
+ * @param params - Query parameters object
34143
+ * @param params.user - The user address to query permissions for
34144
+ * @param params.subgraphUrl - The subgraph URL endpoint to query
34145
+ * @returns Promise resolving to an array of permission objects
34146
+ */
34147
+ private _getUserPermissionsViaSubgraph;
34148
+ /**
34149
+ * Internal method: Query user permissions via direct RPC
34150
+ *
34151
+ * @param params - Query parameters object
34152
+ * @param params.user - The user address to query permissions for
34153
+ * @returns Promise resolving to an array of permission objects
34154
+ */
34155
+ private _getUserPermissionsViaRpc;
34156
+ /**
34157
+ * Retrieves a list of trusted servers for a user.
33718
34158
  *
33719
- * This method supports multiple query modes:
33720
- * - 'subgraph': Fast query via subgraph (requires subgraphUrl)
33721
- * - 'rpc': Direct contract queries (slower but no external dependencies)
33722
- * - 'auto': Try subgraph first, fallback to RPC if unavailable
34159
+ * This method supports automatic fallback between subgraph and RPC modes:
34160
+ * - If subgraph URL is available, tries subgraph query first for fast results
34161
+ * - Falls back to direct contract queries via RPC if subgraph fails
34162
+ * - RPC mode uses gasAwareMulticall for efficient batch queries
33723
34163
  *
33724
- * @param params - Query parameters including user address and mode selection
33725
- * @returns Promise resolving to trusted servers with metadata about the query
33726
- * @throws Error if query fails in both modes (when using 'auto')
34164
+ * @param params - Query parameters including user address and optional pagination
34165
+ * @param params.user - The wallet address of the user to query trusted servers for
34166
+ * @param params.subgraphUrl - Optional subgraph URL to override the default
34167
+ * @param params.limit - Maximum number of results to return (default: 50)
34168
+ * @param params.offset - Number of results to skip for pagination (default: 0)
34169
+ * @returns Promise resolving to an array of trusted server objects
34170
+ * @throws Error if both subgraph and RPC queries fail
33727
34171
  * @example
33728
34172
  * ```typescript
33729
- * // Use subgraph for fast queries
33730
- * const result = await vana.data.getUserTrustedServers({
33731
- * user: '0x...',
33732
- * mode: 'subgraph',
33733
- * subgraphUrl: 'https://...'
34173
+ * // Basic usage with automatic fallback
34174
+ * const servers = await vana.data.getUserTrustedServers({
34175
+ * user: '0x...'
33734
34176
  * });
33735
34177
  *
33736
- * // Use direct RPC (no external dependencies)
33737
- * const result = await vana.data.getUserTrustedServers({
34178
+ * // With pagination
34179
+ * const servers = await vana.data.getUserTrustedServers({
33738
34180
  * user: '0x...',
33739
- * mode: 'rpc',
33740
- * limit: 10
34181
+ * limit: 10,
34182
+ * offset: 20
33741
34183
  * });
33742
34184
  *
33743
- * // Auto-fallback mode
33744
- * const result = await vana.data.getUserTrustedServers({
34185
+ * // With custom subgraph URL
34186
+ * const servers = await vana.data.getUserTrustedServers({
33745
34187
  * user: '0x...',
33746
- * mode: 'auto' // tries subgraph first, falls back to RPC
34188
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
33747
34189
  * });
33748
34190
  * ```
33749
34191
  */
33750
- getUserTrustedServers(params: GetUserTrustedServersParams): Promise<GetUserTrustedServersResult>;
34192
+ getUserTrustedServers(params: GetUserTrustedServersParams): Promise<TrustedServer[]>;
33751
34193
  /**
33752
34194
  * Internal method: Query trusted servers via subgraph
33753
34195
  *
@@ -33815,12 +34257,25 @@ declare class DataController {
33815
34257
  /**
33816
34258
  * Registers a file URL directly on the blockchain with a schema ID.
33817
34259
  *
33818
- * @param url - The URL of the file to register
34260
+ * @remarks
34261
+ * This method registers an existing file URL on the DataRegistry contract
34262
+ * with a schema ID, without uploading any data. Useful when you have already
34263
+ * uploaded content to storage and just need to register it on-chain.
34264
+ *
34265
+ * @param url - The URL of the file to register (IPFS or HTTP/HTTPS)
33819
34266
  * @param schemaId - The schema ID to associate with the file
33820
34267
  * @returns Promise resolving to the file ID and transaction hash
33821
- *
33822
- * This method registers an existing file URL on the DataRegistry
33823
- * contract with a schema ID, without uploading any data.
34268
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34269
+ * @throws {Error} When wallet address is unavailable - "No addresses available"
34270
+ * @throws {Error} When transaction fails - "Failed to register file with schema"
34271
+ * @example
34272
+ * ```typescript
34273
+ * const { fileId, transactionHash } = await vana.data.registerFileWithSchema(
34274
+ * "ipfs://QmXxx...",
34275
+ * 1
34276
+ * );
34277
+ * console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
34278
+ * ```
33824
34279
  */
33825
34280
  registerFileWithSchema(url: string, schemaId: number): Promise<{
33826
34281
  fileId: number;
@@ -33880,35 +34335,112 @@ declare class DataController {
33880
34335
  /**
33881
34336
  * Adds a new refiner to the DataRefinerRegistry.
33882
34337
  *
33883
- * @param params - Refiner parameters including DLP ID, name, schema ID, and instruction URL
34338
+ * @remarks
34339
+ * Refiners are data processing templates that define how raw data should be
34340
+ * transformed into structured formats. Each refiner is associated with a DLP
34341
+ * (Data Liquidity Pool), has a specific schema for output, and includes
34342
+ * instructions for the refinement process.
34343
+ *
34344
+ * @param params - Refiner configuration parameters
34345
+ * @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
34346
+ * @param params.name - Human-readable name for the refiner
34347
+ * @param params.schemaId - Schema ID that defines the output format
34348
+ * @param params.refinementInstructionUrl - URL containing processing instructions
33884
34349
  * @returns Promise resolving to the new refiner ID and transaction hash
34350
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34351
+ * @throws {Error} When transaction fails - "Failed to add refiner: {error}"
34352
+ * @example
34353
+ * ```typescript
34354
+ * const result = await vana.data.addRefiner({
34355
+ * dlpId: 1,
34356
+ * name: "Social Media Sentiment Analyzer",
34357
+ * schemaId: 42,
34358
+ * refinementInstructionUrl: "ipfs://QmXxx..."
34359
+ * });
34360
+ * console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
34361
+ * ```
33885
34362
  */
33886
34363
  addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
33887
34364
  /**
33888
34365
  * Retrieves a refiner by its ID.
33889
34366
  *
33890
- * @param refinerId - The refiner ID to retrieve
33891
- * @returns Promise resolving to the refiner information
34367
+ * @remarks
34368
+ * Queries the DataRefinerRegistry contract to get complete information about
34369
+ * a specific refiner including its DLP association, schema, and instructions.
34370
+ *
34371
+ * @param refinerId - The numeric refiner ID to retrieve
34372
+ * @returns Promise resolving to the refiner information object
34373
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34374
+ * @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
34375
+ * @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
34376
+ * @example
34377
+ * ```typescript
34378
+ * const refiner = await vana.data.getRefiner(1);
34379
+ * console.log({
34380
+ * name: refiner.name,
34381
+ * dlp: refiner.dlpId,
34382
+ * schema: refiner.schemaId,
34383
+ * instructions: refiner.refinementInstructionUrl
34384
+ * });
34385
+ * ```
33892
34386
  */
33893
34387
  getRefiner(refinerId: number): Promise<Refiner>;
33894
34388
  /**
33895
34389
  * Validates if a schema ID exists in the registry.
33896
34390
  *
33897
- * @param schemaId - The schema ID to validate
33898
- * @returns Promise resolving to boolean indicating if the schema ID is valid
34391
+ * @remarks
34392
+ * Checks the DataRefinerRegistry contract to determine if a given schema ID
34393
+ * has been registered and is available for use.
34394
+ *
34395
+ * @param schemaId - The numeric schema ID to validate
34396
+ * @returns Promise resolving to true if schema exists, false otherwise
34397
+ * @example
34398
+ * ```typescript
34399
+ * const isValid = await vana.data.isValidSchemaId(42);
34400
+ * if (isValid) {
34401
+ * console.log('Schema 42 is available for use');
34402
+ * } else {
34403
+ * console.log('Schema 42 does not exist');
34404
+ * }
34405
+ * ```
33899
34406
  */
33900
34407
  isValidSchemaId(schemaId: number): Promise<boolean>;
33901
34408
  /**
33902
34409
  * Gets the total number of refiners in the registry.
33903
34410
  *
34411
+ * @remarks
34412
+ * Queries the DataRefinerRegistry contract to get the total count of all
34413
+ * registered refiners across all DLPs.
34414
+ *
33904
34415
  * @returns Promise resolving to the total refiner count
34416
+ * @example
34417
+ * ```typescript
34418
+ * const count = await vana.data.getRefinersCount();
34419
+ * console.log(`Total refiners registered: ${count}`);
34420
+ * ```
33905
34421
  */
33906
34422
  getRefinersCount(): Promise<number>;
33907
34423
  /**
33908
34424
  * Updates the schema ID for an existing refiner.
33909
34425
  *
33910
- * @param params - Parameters including refiner ID and new schema ID
34426
+ * @remarks
34427
+ * Allows the owner of a refiner to update its associated schema ID.
34428
+ * This is useful when refiner output format needs to change.
34429
+ *
34430
+ * @param params - Update parameters
34431
+ * @param params.refinerId - The refiner ID to update
34432
+ * @param params.newSchemaId - The new schema ID to set
33911
34433
  * @returns Promise resolving to the transaction hash
34434
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34435
+ * @throws {Error} When transaction fails - "Failed to update schema ID: {error}"
34436
+ * @example
34437
+ * ```typescript
34438
+ * const result = await vana.data.updateSchemaId({
34439
+ * refinerId: 1,
34440
+ * newSchemaId: 55
34441
+ * });
34442
+ * console.log(`Schema updated in tx ${result.transactionHash}`);
34443
+ * ```
33912
34444
  */
33913
34445
  updateSchemaId(params: UpdateSchemaIdParams): Promise<UpdateSchemaIdResult>;
33914
34446
  /**
@@ -33967,7 +34499,7 @@ declare class DataController {
33967
34499
  * console.log(`Transaction: ${result.transactionHash}`);
33968
34500
  * ```
33969
34501
  */
33970
- addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<FilePermissionResult>;
34502
+ addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
33971
34503
  /**
33972
34504
  * Submits a file permission transaction and returns the transaction hash immediately.
33973
34505
  *
@@ -33984,7 +34516,7 @@ declare class DataController {
33984
34516
  * console.log(`Transaction submitted: ${txHash}`);
33985
34517
  * ```
33986
34518
  */
33987
- submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<Hash>;
34519
+ submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
33988
34520
  /**
33989
34521
  * Gets the encrypted key for a specific account's permission to access a file.
33990
34522
  *
@@ -34371,6 +34903,31 @@ interface Chains {
34371
34903
  }
34372
34904
  declare const chains: Chains;
34373
34905
 
34906
+ /**
34907
+ * Creates or retrieves a cached public client for blockchain read operations.
34908
+ *
34909
+ * @remarks
34910
+ * This function provides an optimized way to access blockchain data by maintaining
34911
+ * a cached client instance per chain. The client is used for reading contract state,
34912
+ * querying events, and other read-only blockchain operations. It automatically
34913
+ * handles HTTP transport configuration and chain switching.
34914
+ *
34915
+ * @param chainId - The chain ID to connect to (defaults to Moksha testnet)
34916
+ * @returns A public client configured for the specified chain with caching optimization
34917
+ * @throws {Error} When the specified chain ID is not supported by the SDK
34918
+ * @example
34919
+ * ```typescript
34920
+ * // Get client for default chain (Moksha testnet)
34921
+ * const client = createClient();
34922
+ *
34923
+ * // Get client for specific chain
34924
+ * const mainnetClient = createClient(14800);
34925
+ *
34926
+ * // Use client for blockchain reads
34927
+ * const blockNumber = await client.getBlockNumber();
34928
+ * ```
34929
+ * @category Blockchain
34930
+ */
34374
34931
  declare const createClient: (chainId?: keyof typeof chains) => PublicClient & {
34375
34932
  chain: Chain;
34376
34933
  };
@@ -35089,51 +35646,157 @@ declare class SerializationError extends VanaError {
35089
35646
  constructor(message: string);
35090
35647
  }
35091
35648
  /**
35092
- * Error thrown when a signature operation fails.
35649
+ * Thrown when a signature operation fails or cannot be completed.
35093
35650
  *
35094
35651
  * @remarks
35095
- * Recovery strategies: Check wallet connection and account unlock status,
35096
- * retry operation with explicit user interaction, or for gasless operations
35097
- * consider switching to direct transactions.
35652
+ * This error occurs when wallet signature operations fail due to disconnection,
35653
+ * locked accounts, or other wallet-related issues. It preserves the original
35654
+ * error for debugging while providing consistent error handling across the SDK.
35655
+ *
35656
+ * Recovery strategies:
35657
+ * - Check wallet connection and account unlock status
35658
+ * - Retry operation with explicit user interaction
35659
+ * - For gasless operations, consider switching to direct transactions
35660
+ *
35661
+ * @example
35662
+ * ```typescript
35663
+ * try {
35664
+ * await vana.permissions.grant({ grantee: '0x...' });
35665
+ * } catch (error) {
35666
+ * if (error instanceof SignatureError) {
35667
+ * // Prompt user to unlock wallet
35668
+ * await promptWalletUnlock();
35669
+ * // Retry operation
35670
+ * }
35671
+ * }
35672
+ * ```
35673
+ * @category Error Handling
35098
35674
  */
35099
35675
  declare class SignatureError extends VanaError {
35100
35676
  readonly originalError?: Error | undefined;
35101
35677
  constructor(message: string, originalError?: Error | undefined);
35102
35678
  }
35103
35679
  /**
35104
- * Error thrown when a network operation fails.
35680
+ * Thrown when network communication fails during API calls or blockchain interactions.
35105
35681
  *
35106
35682
  * @remarks
35107
- * Recovery strategies: Check network connectivity, retry with exponential backoff,
35108
- * verify API endpoints are accessible, or switch to alternative network providers.
35683
+ * This error encompasses network connectivity issues, API unavailability,
35684
+ * timeout errors, and CORS restrictions. It's commonly encountered during
35685
+ * IPFS operations, subgraph queries, or RPC calls.
35686
+ *
35687
+ * Recovery strategies:
35688
+ * - Check network connectivity
35689
+ * - Retry with exponential backoff
35690
+ * - Verify API endpoints are accessible
35691
+ * - Switch to alternative network providers or gateways
35692
+ *
35693
+ * @example
35694
+ * ```typescript
35695
+ * try {
35696
+ * const files = await vana.data.getUserFiles({ owner: '0x...' });
35697
+ * } catch (error) {
35698
+ * if (error instanceof NetworkError) {
35699
+ * // Implement retry with exponential backoff
35700
+ * await retryWithBackoff(() => vana.data.getUserFiles({ owner: '0x...' }));
35701
+ * }
35702
+ * }
35703
+ * ```
35704
+ * @category Error Handling
35109
35705
  */
35110
35706
  declare class NetworkError extends VanaError {
35111
35707
  readonly originalError?: Error | undefined;
35112
35708
  constructor(message: string, originalError?: Error | undefined);
35113
35709
  }
35114
35710
  /**
35115
- * Error thrown when the nonce retrieval fails.
35711
+ * Thrown when transaction nonce retrieval fails during gasless operations.
35116
35712
  *
35117
35713
  * @remarks
35118
- * Recovery strategies: Retry nonce retrieval after brief delay, check wallet connection
35119
- * and account status, or use manual nonce specification if supported by the operation.
35714
+ * This error occurs when the SDK cannot retrieve the user's current nonce from
35715
+ * smart contracts, preventing gasless transaction submission. Nonces are critical
35716
+ * for preventing replay attacks in signed transactions.
35717
+ *
35718
+ * Recovery strategies:
35719
+ * - Retry nonce retrieval after brief delay
35720
+ * - Check wallet connection and account status
35721
+ * - Use manual nonce specification if supported by the operation
35722
+ * - Switch to direct transactions as fallback
35723
+ *
35724
+ * @example
35725
+ * ```typescript
35726
+ * try {
35727
+ * await vana.permissions.grant({ grantee: '0x...' });
35728
+ * } catch (error) {
35729
+ * if (error instanceof NonceError) {
35730
+ * // Wait and retry
35731
+ * await delay(1000);
35732
+ * await vana.permissions.grant({ grantee: '0x...' });
35733
+ * }
35734
+ * }
35735
+ * ```
35736
+ * @category Error Handling
35120
35737
  */
35121
35738
  declare class NonceError extends VanaError {
35122
35739
  constructor(message: string);
35123
35740
  }
35124
35741
  /**
35125
- * Error thrown when a personal server operation fails.
35742
+ * Thrown when personal server operations fail or cannot be completed.
35126
35743
  *
35127
35744
  * @remarks
35128
- * Recovery strategies: Verify server URL accessibility, check server trust status via
35129
- * `vana.permissions.getUserTrustedServers()`, or retry after server becomes available.
35745
+ * This error occurs during interactions with personal servers for computation
35746
+ * requests, identity retrieval, or operation status checks. Common causes include
35747
+ * server unavailability, untrusted server status, or invalid permission grants.
35748
+ *
35749
+ * Recovery strategies:
35750
+ * - Verify server URL accessibility
35751
+ * - Check server trust status via `vana.permissions.getTrustedServers()`
35752
+ * - Ensure valid permissions exist for the operation
35753
+ * - Retry after server becomes available
35754
+ *
35755
+ * @example
35756
+ * ```typescript
35757
+ * try {
35758
+ * const result = await vana.server.createOperation({ permissionId: 123 });
35759
+ * } catch (error) {
35760
+ * if (error instanceof PersonalServerError) {
35761
+ * // Check if server is trusted
35762
+ * const trustedServers = await vana.permissions.getTrustedServers();
35763
+ * if (!trustedServers.includes(serverId)) {
35764
+ * await vana.permissions.trustServer({ serverId });
35765
+ * }
35766
+ * }
35767
+ * }
35768
+ * ```
35769
+ * @category Error Handling
35130
35770
  */
35131
35771
  declare class PersonalServerError extends VanaError {
35132
35772
  readonly originalError?: Error | undefined;
35133
35773
  constructor(message: string, originalError?: Error | undefined);
35134
35774
  }
35135
35775
  /**
35136
- * Error thrown when trying to register a server with a URL that doesn't match the existing registration.
35776
+ * Thrown when attempting to register a server with a URL different from its existing registration.
35777
+ *
35778
+ * @remarks
35779
+ * This error occurs when trying to add or trust a server that's already registered
35780
+ * on-chain with a different URL. Server URLs are immutable once registered to
35781
+ * maintain consistency and security. Applications should use the existing URL
35782
+ * or register a new server with a different ID.
35783
+ *
35784
+ * @example
35785
+ * ```typescript
35786
+ * try {
35787
+ * await vana.permissions.addAndTrustServer({
35788
+ * serverId: 1,
35789
+ * serverUrl: 'https://new-url.com',
35790
+ * publicKey: '0x...'
35791
+ * });
35792
+ * } catch (error) {
35793
+ * if (error instanceof ServerUrlMismatchError) {
35794
+ * console.log(`Server already registered with: ${error.existingUrl}`);
35795
+ * // Use existing URL or register new server
35796
+ * }
35797
+ * }
35798
+ * ```
35799
+ * @category Error Handling
35137
35800
  */
35138
35801
  declare class ServerUrlMismatchError extends VanaError {
35139
35802
  constructor(existingUrl: string, providedUrl: string, serverId: string);
@@ -35142,7 +35805,25 @@ declare class ServerUrlMismatchError extends VanaError {
35142
35805
  readonly serverId: string;
35143
35806
  }
35144
35807
  /**
35145
- * Error thrown when a permission operation fails.
35808
+ * Thrown when permission grant, revoke, or validation operations fail.
35809
+ *
35810
+ * @remarks
35811
+ * This error occurs during permission management operations including grants,
35812
+ * revocations, and permission validation checks. Common causes include invalid
35813
+ * grantee addresses, expired permissions, or insufficient privileges.
35814
+ *
35815
+ * @example
35816
+ * ```typescript
35817
+ * try {
35818
+ * await vana.permissions.revoke({ permissionId: 999999 });
35819
+ * } catch (error) {
35820
+ * if (error instanceof PermissionError) {
35821
+ * console.error('Permission operation failed:', error.message);
35822
+ * // Permission may not exist or user may not be owner
35823
+ * }
35824
+ * }
35825
+ * ```
35826
+ * @category Error Handling
35146
35827
  */
35147
35828
  declare class PermissionError extends VanaError {
35148
35829
  readonly originalError?: Error | undefined;
@@ -36150,21 +36831,53 @@ declare function withSignatureCache(cache: VanaCacheAdapter, walletAddress: stri
36150
36831
 
36151
36832
  declare const CONTRACT_ADDRESSES: Record<number, Record<string, string>>;
36152
36833
  /**
36153
- * Retrieves the deployed contract address for a specific contract on a given chain.
36834
+ * Retrieves the deployed contract address for a specific Vana protocol contract on a given chain.
36154
36835
  *
36155
- * @param chainId - The chain ID to look up the contract on
36156
- * @param contract - The contract name to get the address for
36157
- * @returns The contract address as a hex string
36158
- * @throws {Error} When contract address not found for the specified contract and chain
36836
+ * @remarks
36837
+ * This function provides type-safe access to contract addresses across all supported Vana networks.
36838
+ * It automatically searches both current and legacy contract registries to ensure backwards
36839
+ * compatibility while providing clear error messages for unsupported combinations.
36840
+ *
36841
+ * The function validates that both the chain ID and contract name are supported before
36842
+ * attempting address lookup, helping developers identify deployment or configuration issues
36843
+ * early in the development process.
36844
+ *
36845
+ * **Supported Chains:**
36846
+ * - 14800: Vana Mainnet
36847
+ * - 1480: Moksha Testnet
36848
+ *
36849
+ * **Contract Categories:**
36850
+ * - Data Management: DataRegistry, DataRefinerRegistry
36851
+ * - Permissions: DataPortabilityPermissions, DataPortabilityServers, DataPortabilityGrantees
36852
+ * - Computing: TeePoolPhala, TeePoolDedicatedGpu, etc.
36853
+ * - Token & Governance: DATImplementation, VanaPoolStaking, etc.
36854
+ *
36855
+ * @param chainId - The chain ID to look up the contract on (14800 for mainnet, 1480 for testnet)
36856
+ * @param contract - The contract name to get the address for (use TypeScript autocomplete for available options)
36857
+ * @returns The contract address as a checksummed hex string (0x...)
36858
+ * @throws {Error} When contract address not found for the specified contract and chain combination.
36859
+ * This typically indicates the contract is not deployed on the requested network.
36159
36860
  * @example
36160
36861
  * ```typescript
36862
+ * // Get core protocol contract addresses
36863
+ * const dataRegistry = getContractAddress(14800, 'DataRegistry');
36864
+ * const permissions = getContractAddress(14800, 'DataPortabilityPermissions');
36865
+ * const trustedServers = getContractAddress(14800, 'DataPortabilityServers');
36866
+ *
36867
+ * // Handle unsupported combinations gracefully
36161
36868
  * try {
36162
- * const dataRegistryAddress = getContractAddress(1480, 'DataRegistry');
36163
- * console.log('DataRegistry address:', dataRegistryAddress);
36869
+ * const address = getContractAddress(1480, 'DataRegistry');
36870
+ * console.log('DataRegistry testnet address:', address);
36164
36871
  * } catch (error) {
36165
- * console.error('Contract not deployed on this chain:', error.message);
36872
+ * console.error('Contract not available on testnet:', error.message);
36873
+ * // Fallback to mainnet or show user-friendly error
36166
36874
  * }
36875
+ *
36876
+ * // TypeScript provides autocomplete for contract names
36877
+ * const poolAddress = getContractAddress(14800, 'TeePoolPhala'); // ✅ Valid
36878
+ * // const invalid = getContractAddress(14800, 'InvalidContract'); // ❌ TypeScript error
36167
36879
  * ```
36880
+ * @category Configuration
36168
36881
  */
36169
36882
  declare const getContractAddress: (chainId: keyof typeof CONTRACT_ADDRESSES, contract: VanaContract) => `0x${string}`;
36170
36883
 
@@ -36334,6 +37047,8 @@ declare class CircuitBreaker {
36334
37047
  reset(): void;
36335
37048
  }
36336
37049
 
37050
+ /** Union type of all possible transaction results from relayer operations */
37051
+ type RelayerTransactionResult = PermissionGrantResult | PermissionRevokeResult | ServerTrustResult | ServerUntrustResult | GranteeRegisterResult | FileAddedResult;
36337
37052
  /**
36338
37053
  * Payload structure for relayer requests.
36339
37054
  * Contains the EIP-712 typed data, signature, and optional expected user address for security verification.
@@ -36355,7 +37070,7 @@ interface RelayerRequestPayload {
36355
37070
  * 1. Verifies the signature against the typed data
36356
37071
  * 2. Optionally checks the signer matches the expected user address
36357
37072
  * 3. Routes to the appropriate SDK method based on primaryType
36358
- * 4. Returns the resulting transaction hash
37073
+ * 4. Returns the transaction handle with hash and event parsing capability
36359
37074
  *
36360
37075
  * Supported transaction types:
36361
37076
  * - Permission: Permission grants
@@ -36368,7 +37083,7 @@ interface RelayerRequestPayload {
36368
37083
  *
36369
37084
  * @param sdk - Initialized Vana SDK instance
36370
37085
  * @param payload - Request payload containing typed data, signature, and optional security check
36371
- * @returns Promise resolving to the transaction hash
37086
+ * @returns Promise resolving to TransactionHandle with hash and event parsing capability
36372
37087
  * @throws {SignatureError} When signature verification fails or signer mismatch occurs
36373
37088
  * @throws {Error} When primaryType is unsupported or SDK operations fail
36374
37089
  * @category Server
@@ -36382,15 +37097,24 @@ interface RelayerRequestPayload {
36382
37097
  * const body = await request.json();
36383
37098
  * const vana = await createRelayerVana();
36384
37099
  *
36385
- * const txHash = await handleRelayerRequest(vana, {
37100
+ * const tx = await handleRelayerRequest(vana, {
36386
37101
  * typedData: body.typedData,
36387
37102
  * signature: body.signature,
36388
37103
  * expectedUserAddress: body.expectedUserAddress
36389
37104
  * });
36390
37105
  *
37106
+ * // Option 1: Return just the hash immediately
37107
+ * return NextResponse.json({
37108
+ * success: true,
37109
+ * transactionHash: tx.hash
37110
+ * });
37111
+ *
37112
+ * // Option 2: Wait for transaction confirmation and return event data
37113
+ * const eventData = await tx.waitForEvents();
36391
37114
  * return NextResponse.json({
36392
37115
  * success: true,
36393
- * transactionHash: txHash
37116
+ * transactionHash: tx.hash,
37117
+ * ...eventData // Include parsed event data like permissionId, fileId, etc.
36394
37118
  * });
36395
37119
  * } catch (error) {
36396
37120
  * return NextResponse.json({
@@ -36401,7 +37125,7 @@ interface RelayerRequestPayload {
36401
37125
  * }
36402
37126
  * ```
36403
37127
  */
36404
- declare function handleRelayerRequest(sdk: VanaInstance, payload: RelayerRequestPayload): Promise<Hash>;
37128
+ declare function handleRelayerRequest(sdk: VanaInstance, payload: RelayerRequestPayload): Promise<TransactionHandle<RelayerTransactionResult>>;
36405
37129
 
36406
37130
  /**
36407
37131
  * Node.js implementation of the Vana Platform Adapter
@@ -36820,4 +37544,4 @@ declare function Vana(config: VanaConfig): VanaNodeImpl;
36820
37544
  */
36821
37545
  type VanaInstance = VanaNodeImpl;
36822
37546
 
36823
- export { type $defs, type APIResponse, type AddAndTrustServerInput, type AddAndTrustServerParams, type AddAndTrustServerTypedData, type AddRefinerParams, type AddRefinerResult, type AddSchemaParams, type AddSchemaResult, type AllKeys, ApiClient, type ApiClientConfig, type ApiResponse, AsyncQueue, type AsyncResult, type AuthenticationErrorResponse, type Awaited, type BaseConfig, type BaseConfigWithStorage, BaseController, type BatchServerInfoResult, type BatchUploadParams, type BatchUploadResult, type BlockRange, BlockchainError, type BlockchainErrorResponse, type Brand, BrowserPlatformAdapter, type Cache, type CacheConfig, CallbackStorage, type ChainConfig, type ChainConfigWithStorage, type CheckPermissionParams, CircuitBreaker, type ComputeErrorResponse, type ConditionalOptional, type ConfigValidationOptions, type ConfigValidationResult, type ContractAddresses, type ContractCall, type ContractDeployment, ContractFactory, type ContractInfo, type ContractMethodParams, type ContractMethodReturnType, ContractNotFoundError, type Controller, type ControllerContext, type CreateOperationParams, type CreateOperationRequest, type CreateOperationResponse, type CreateSchemaParams, type CreateSchemaResult, DEFAULT_ENCRYPTION_SEED, DEFAULT_IPFS_GATEWAY, DataController, type DataSchema, type DecryptionErrorResponse, type DeepPartial, type DeepReadonly, type DeleteFileParams, type DeleteFileResult, type DownloadFileParams, type DownloadFileResult, type EncryptedUploadParams, type EncryptionInfo, type ErrorResponse, EventEmitter, type EventFilter, type EventLog, type Factory, type FileAccessErrorResponse, type FileAccessPermissions, type FileMetadata, type FilePermissionParams, type FileSharingConfig, type GasEstimate, type GenericRequest, type GenericResponse, type GenericTypedData, type GetFileParams, type GetOperationResponse, type GetUserFilesParams, type GetUserPermissionsOptions, type GetUserTrustedServersParams, type GetUserTrustedServersResult, GoogleDriveStorage, GrantExpiredError, type GrantFile, type GrantPermissionParams, GrantSchemaError, GrantValidationError, type GrantValidationErrorResponse, type GrantValidationOptions, type GrantValidationResult, type GrantedPermission, type Grantee, type GranteeInfo, GranteeMismatchError, type GranteeQueryOptions, type HttpMethod, IPFS_GATEWAYS, type IdentityResponseModel, type InitPersonalServerParams, type InternalServerErrorResponse, InvalidConfigurationError, IpfsStorage, type LegacyPermissionParams, type MaybeArray, type MaybePromise, MemoryCache, type Middleware, MiddlewarePipeline, NetworkError, type NetworkInfo, NodePlatformAdapter, type Nominal, type NonNullable, NonceError, type NotFoundErrorResponse, type Observable, type Observer, type OmitByType, type OnChainPermissionGrant, type OperationErrorResponse, OperationNotAllowedError, type OptionalKeys, type PaginatedGrantees, type PaginatedTrustedServers, type PaginationParams, type PaginationResult, type PartialExcept, type Permission, type PermissionAnalytics, type PermissionCheckResult, PermissionError, type PermissionEvent, type PermissionGrantDomain, type PermissionGrantMessage, type PermissionGrantTypedData, type PermissionInfo, type PermissionInputMessage, type PermissionOperation, type PermissionQueryResult, type PermissionStatus, PermissionsController, PersonalServerError, type PersonalServerIdentity, type PersonalServerModel, type PickByType, type PinataListResponse, type PinataPin, PinataStorage, type PinataUploadResponse, type Plugin, type PostRequestParams, type PromiseResult, ProtocolController, type QueryPermissionsParams, type RateLimitInfo, RateLimiter, type RateLimiterConfig, type Refiner, type RegisterGranteeInput, type RegisterGranteeParams, type RegisterGranteeTypedData, type RelayerCallbacks, type RelayerConfig, RelayerError, type RelayerErrorResponse, type RelayerMetrics, type RelayerQueueInfo, type RelayerRequestOptions, type RelayerRequestPayload, type RelayerStatus, type RelayerStorageResponse, type RelayerStoreParams, type RelayerSubmitParams, type RelayerTransactionResponse, type RelayerTransactionStatus, type RelayerWebhookConfig, type RelayerWebhookPayload, type ReplicateAPIResponse, type ReplicateStatus, type Repository, type RequestOptions, type RequireKeys, type RequiredExcept, type RetryConfig, RetryUtility, type RevokePermissionInput, type RevokePermissionParams, type RuntimeConfig, type Schema, SchemaController, SchemaValidationError, SchemaValidator, SerializationError, type Server, type components as ServerComponents, ServerController, type $defs as ServerDefs, type ServerFilesAndPermissionParams, type ServerFilesAndPermissionTypedData, type ServerInfo, type operations as ServerOperations, type paths as ServerPaths, type ServerTrustStatus, ServerUrlMismatchError, type webhooks as ServerWebhooks, type Service, SignatureCache, SignatureError, type SimplifiedPermissionMessage, type StateMachine, type StatusInfo, type StorageCallbacks, type StorageConfig, type StorageDownloadOptions, StorageError, type StorageFile, type StorageListOptions, type StorageListResult, StorageManager, type StorageProvider, type StorageProviderConfig, type StorageRequiredMarker, type StorageUploadResult, type TimeRange, type TransactionOptions, type TransactionReceipt, type Transformer, type TrustServerInput, type TrustServerParams, type TrustServerTypedData, type TrustedServer, type TrustedServerInfo, type TrustedServerQueryMode, type TrustedServerQueryOptions, type UnencryptedUploadParams, type UntrustServerInput, type UntrustServerParams, type UntrustServerTypedData, type UpdateSchemaIdParams, type UpdateSchemaIdResult, type UploadEncryptedFileResult, type UploadFileParams, type UploadFileResult, type UploadParams, type UploadProgress, type UploadResult, type UserFile, UserRejectedRequestError, type ValidationErrorResponse, type ValidationResult, type Validator, Vana, type VanaChain, type VanaChainConfig, type VanaChainId, type VanaConfig, type VanaConfigWithStorage, type VanaContract, type VanaContract as VanaContractAbi, type VanaContractInstance, type VanaContractName, VanaCore, VanaCoreFactory, VanaError, type VanaInstance, VanaNodeImpl, type VanaPlatformAdapter, type WalletConfig, type WalletConfigWithStorage, __contractCache, chains, checkGrantAccess, clearContractCache, type components, convertIpfsUrl, convertIpfsUrlWithFallbacks, createAndStoreGrant, createBrowserPlatformAdapter, createGrantFile, createNodePlatformAdapter, createPlatformAdapter, createPlatformAdapterFor, createPlatformAdapterSafe, createValidatedGrant, decryptBlobWithSignedKey, decryptWithPrivateKey, decryptWithWalletPrivateKey, Vana as default, detectPlatform, encryptBlobWithSignedKey, encryptFileKey, encryptWithWalletPublicKey, extractIpfsHash, fetchAndValidateSchema, fetchWithFallbacks, formatEth, formatNumber, formatToken, generateEncryptionKey, generateEncryptionKeyPair, generatePGPKeyPair, getAbi, getAllChains, getChainConfig, getContractAddress, getContractController, getContractInfo, getEncryptionParameters, getGatewayUrls, getGrantFileHash, getGrantTimeRemaining, getPlatformCapabilities, handleRelayerRequest, hasStorageConfig, isAPIResponse, isChainConfig, isGrantExpired, isIpfsUrl, isPlatformSupported, isReplicateAPIResponse, isVanaChain, isVanaChainId, isWalletConfig, moksha, mokshaTestnet, type operations, parseReplicateOutput, type paths, retrieveAndValidateGrant, retrieveGrantFile, safeParseJSON, schemaValidator, shortenAddress, storeGrantFile, summarizeGrant, validateDataAgainstSchema, validateDataSchema, validateGrant, validateGrantExpiry, validateGrantFile, validateGranteeAccess, validateOperationAccess, vanaMainnet, type webhooks, withSignatureCache };
37547
+ 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, NodePlatformAdapter, type Nominal, type NonNullable, NonceError, type NotFoundErrorResponse, type Observable, type Observer, type OmitByType, type OnChainPermissionGrant, type OperationErrorResponse, OperationNotAllowedError, type OptionalKeys, type PaginatedGrantees, type PaginatedTrustedServers, type PaginationParams, type PaginationResult, type PartialExcept, type Permission, type PermissionAnalytics, type PermissionCheckResult, PermissionError, type PermissionEvent, type PermissionGrantDomain, type PermissionGrantMessage, type PermissionGrantTypedData, type PermissionInfo, type PermissionInputMessage, type PermissionOperation, type PermissionQueryResult, type PermissionStatus, PermissionsController, PersonalServerError, type PersonalServerIdentity, type PersonalServerModel, type PickByType, type PinataListResponse, type PinataPin, PinataStorage, type PinataUploadResponse, type Plugin, type PostRequestParams, type PromiseResult, ProtocolController, type QueryPermissionsParams, type RateLimitInfo, RateLimiter, type RateLimiterConfig, type Refiner, type RegisterGranteeInput, type RegisterGranteeParams, type RegisterGranteeTypedData, type RelayerCallbacks, type RelayerConfig, RelayerError, type RelayerErrorResponse, type RelayerMetrics, type RelayerQueueInfo, type RelayerRequestOptions, type RelayerRequestPayload, type RelayerStatus, type RelayerStorageResponse, type RelayerStoreParams, type RelayerSubmitParams, type RelayerTransactionResponse, type RelayerTransactionStatus, type RelayerWebhookConfig, type RelayerWebhookPayload, type ReplicateAPIResponse, type ReplicateStatus, type Repository, type RequestOptions, type RequireKeys, type RequiredExcept, type RetryConfig, RetryUtility, type RevokePermissionInput, type RevokePermissionParams, type RuntimeConfig, type Schema, SchemaController, SchemaValidationError, SchemaValidator, SerializationError, type Server, type components as ServerComponents, ServerController, type $defs as ServerDefs, type ServerFilesAndPermissionParams, type ServerFilesAndPermissionTypedData, type ServerInfo, type operations as ServerOperations, type paths as ServerPaths, type ServerTrustStatus, ServerUrlMismatchError, type webhooks as ServerWebhooks, type Service, SignatureCache, SignatureError, type SimplifiedPermissionMessage, type StateMachine, type StatusInfo, type StorageCallbacks, type StorageConfig, type StorageDownloadOptions, StorageError, type StorageFile, type StorageListOptions, type StorageListResult, StorageManager, type StorageProvider, type StorageProviderConfig, type StorageRequiredMarker, type StorageUploadResult, type TimeRange, TransactionHandle, type TransactionOptions, type TransactionReceipt, type Transformer, type TrustServerInput, type TrustServerParams, type TrustServerTypedData, type TrustedServer, type TrustedServerInfo, type TrustedServerQueryOptions, type UnencryptedUploadParams, type UntrustServerInput, type UntrustServerParams, type UntrustServerTypedData, type UpdateSchemaIdParams, type UpdateSchemaIdResult, type UploadEncryptedFileResult, type UploadFileParams, type UploadFileResult, type UploadParams, type UploadProgress, type UploadResult, type UserFile, UserRejectedRequestError, type ValidationErrorResponse, type ValidationResult, type Validator, Vana, type VanaChain, type VanaChainConfig, type VanaChainId, type VanaConfig, type VanaConfigWithStorage, type VanaContract, type VanaContract as VanaContractAbi, type VanaContractInstance, type VanaContractName, VanaCore, VanaCoreFactory, VanaError, type VanaInstance, VanaNodeImpl, type VanaPlatformAdapter, type WalletConfig, type WalletConfigWithStorage, __contractCache, chains, checkGrantAccess, clearContractCache, type components, convertIpfsUrl, convertIpfsUrlWithFallbacks, createAndStoreGrant, createBrowserPlatformAdapter, createGrantFile, createNodePlatformAdapter, createPlatformAdapter, createPlatformAdapterFor, createPlatformAdapterSafe, createValidatedGrant, decryptBlobWithSignedKey, decryptWithPrivateKey, decryptWithWalletPrivateKey, Vana as default, detectPlatform, encryptBlobWithSignedKey, encryptFileKey, encryptWithWalletPublicKey, extractIpfsHash, fetchAndValidateSchema, fetchWithFallbacks, formatEth, formatNumber, formatToken, generateEncryptionKey, generateEncryptionKeyPair, generatePGPKeyPair, getAbi, getAllChains, getChainConfig, getContractAddress, getContractController, getContractInfo, getEncryptionParameters, getGatewayUrls, getGrantFileHash, getGrantTimeRemaining, getPlatformCapabilities, handleRelayerRequest, hasStorageConfig, isAPIResponse, isChainConfig, isGrantExpired, isIpfsUrl, isPlatformSupported, isReplicateAPIResponse, isVanaChain, isVanaChainId, isWalletConfig, moksha, mokshaTestnet, type operations, parseReplicateOutput, type paths, retrieveAndValidateGrant, retrieveGrantFile, safeParseJSON, schemaValidator, shortenAddress, storeGrantFile, summarizeGrant, validateDataAgainstSchema, validateDataSchema, validateGrant, validateGrantExpiry, validateGrantFile, validateGranteeAccess, validateOperationAccess, vanaMainnet, type webhooks, withSignatureCache };