@opendatalabs/vana-sdk 0.1.0-alpha.dd95ac2 → 0.1.0-alpha.e569cae

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +42 -0
  2. package/dist/browser-DY8XDblx.d.ts +241 -0
  3. package/dist/browser.d.ts +1 -0
  4. package/dist/browser.js +309 -0
  5. package/dist/browser.js.map +1 -0
  6. package/dist/chains.browser.cjs +2 -2
  7. package/dist/chains.browser.cjs.map +1 -1
  8. package/dist/chains.browser.js +2 -2
  9. package/dist/chains.browser.js.map +1 -1
  10. package/dist/chains.cjs +2 -2
  11. package/dist/chains.cjs.map +1 -1
  12. package/dist/chains.js +2 -2
  13. package/dist/chains.js.map +1 -1
  14. package/dist/chains.node.cjs +2 -2
  15. package/dist/chains.node.cjs.map +1 -1
  16. package/dist/chains.node.js +2 -2
  17. package/dist/chains.node.js.map +1 -1
  18. package/dist/index.browser.d.ts +1061 -307
  19. package/dist/index.browser.js +33714 -32310
  20. package/dist/index.browser.js.map +1 -1
  21. package/dist/index.node.cjs +33932 -32527
  22. package/dist/index.node.cjs.map +1 -1
  23. package/dist/index.node.d.cts +1095 -314
  24. package/dist/index.node.d.ts +1095 -314
  25. package/dist/index.node.js +33774 -32371
  26. package/dist/index.node.js.map +1 -1
  27. package/dist/node-D9-F9uEP.d.cts +238 -0
  28. package/dist/node-D9-F9uEP.d.ts +238 -0
  29. package/dist/node.cjs +348 -0
  30. package/dist/node.cjs.map +1 -0
  31. package/dist/node.d.cts +1 -0
  32. package/dist/node.d.ts +1 -0
  33. package/dist/node.js +311 -0
  34. package/dist/node.js.map +1 -0
  35. package/dist/platform.browser.d.ts +3 -236
  36. package/dist/platform.browser.js +31 -8
  37. package/dist/platform.browser.js.map +1 -1
  38. package/dist/platform.cjs +72 -62
  39. package/dist/platform.cjs.map +1 -1
  40. package/dist/platform.d.cts +2 -1
  41. package/dist/platform.d.ts +2 -1
  42. package/dist/platform.js +72 -62
  43. package/dist/platform.js.map +1 -1
  44. package/dist/platform.node.cjs +72 -62
  45. package/dist/platform.node.cjs.map +1 -1
  46. package/dist/platform.node.d.cts +7 -236
  47. package/dist/platform.node.d.ts +7 -236
  48. package/dist/platform.node.js +72 -62
  49. package/dist/platform.node.js.map +1 -1
  50. package/package.json +17 -12
@@ -1,4 +1,4 @@
1
- import { Chain, Address, Hash, WalletClient, Account, Abi, GetContractReturnType, PublicClient } from 'viem';
1
+ import { Chain, Address, Hash, WalletClient, Account, Abi, GetContractReturnType, TransactionReceipt as TransactionReceipt$1, PublicClient } from 'viem';
2
2
  export { Abi, Account, Address, Chain, GetContractReturnType, Hash, PublicClient, WalletClient } from 'viem';
3
3
  import { Abi as Abi$1 } from 'abitype';
4
4
 
@@ -157,6 +157,14 @@ declare class StorageError extends Error {
157
157
  });
158
158
  }
159
159
 
160
+ /**
161
+ * Base interface for types that need to be compatible with Record<string, unknown>
162
+ *
163
+ * @category Permissions
164
+ */
165
+ interface RecordCompatible {
166
+ [key: string]: unknown;
167
+ }
160
168
  /**
161
169
  * Represents on-chain permission grant data without expensive off-chain resolution.
162
170
  *
@@ -355,7 +363,7 @@ interface PermissionGrantMessage {
355
363
  *
356
364
  * @category Permissions
357
365
  */
358
- interface PermissionInputMessage {
366
+ interface PermissionInputMessage extends RecordCompatible {
359
367
  /** Nonce */
360
368
  nonce: bigint;
361
369
  /** Grantee ID */
@@ -370,7 +378,7 @@ interface PermissionInputMessage {
370
378
  *
371
379
  * @category Permissions
372
380
  */
373
- interface RevokePermissionInput {
381
+ interface RevokePermissionInput extends RecordCompatible {
374
382
  /** Nonce */
375
383
  nonce: bigint;
376
384
  /** Permission ID to revoke */
@@ -451,9 +459,7 @@ interface GrantFile {
451
459
  *
452
460
  * @category Permissions
453
461
  */
454
- interface PermissionGrantTypedData {
455
- /** EIP-712 domain */
456
- domain: PermissionGrantDomain;
462
+ interface PermissionGrantTypedData extends GenericTypedData {
457
463
  /** EIP-712 types */
458
464
  types: {
459
465
  Permission: Array<{
@@ -471,7 +477,7 @@ interface PermissionGrantTypedData {
471
477
  *
472
478
  * @category Permissions
473
479
  */
474
- interface GenericTypedData {
480
+ interface GenericTypedData extends RecordCompatible {
475
481
  /** EIP-712 domain */
476
482
  domain: PermissionGrantDomain;
477
483
  /** EIP-712 types */
@@ -634,8 +640,6 @@ interface ServerInfo {
634
640
  * @category Permissions
635
641
  */
636
642
  interface AddAndTrustServerParams {
637
- /** Server owner address */
638
- owner: Address;
639
643
  /** Server address */
640
644
  serverAddress: Address;
641
645
  /** Server URL */
@@ -667,11 +671,9 @@ interface UntrustServerParams {
667
671
  *
668
672
  * @category Permissions
669
673
  */
670
- interface AddAndTrustServerInput {
674
+ interface AddAndTrustServerInput extends RecordCompatible {
671
675
  /** User nonce */
672
676
  nonce: bigint;
673
- /** Server owner address */
674
- owner: Address;
675
677
  /** Server address */
676
678
  serverAddress: Address;
677
679
  /** Server URL */
@@ -685,7 +687,7 @@ interface AddAndTrustServerInput {
685
687
  * @category Permissions
686
688
  * @deprecated Use AddAndTrustServerInput instead
687
689
  */
688
- interface TrustServerInput {
690
+ interface TrustServerInput extends RecordCompatible {
689
691
  /** User nonce */
690
692
  nonce: bigint;
691
693
  /** Server ID (numeric) */
@@ -696,7 +698,7 @@ interface TrustServerInput {
696
698
  *
697
699
  * @category Permissions
698
700
  */
699
- interface UntrustServerInput {
701
+ interface UntrustServerInput extends RecordCompatible {
700
702
  /** User nonce */
701
703
  nonce: bigint;
702
704
  /** Server ID (numeric) */
@@ -707,18 +709,16 @@ interface UntrustServerInput {
707
709
  *
708
710
  * @category Permissions
709
711
  */
710
- interface AddAndTrustServerTypedData {
711
- /** EIP-712 domain */
712
- domain: PermissionGrantDomain;
712
+ interface AddAndTrustServerTypedData extends GenericTypedData {
713
713
  /** EIP-712 types */
714
714
  types: {
715
- AddAndTrustServer: Array<{
715
+ AddServer: Array<{
716
716
  name: string;
717
717
  type: string;
718
718
  }>;
719
719
  };
720
720
  /** Primary type */
721
- primaryType: "AddAndTrustServer";
721
+ primaryType: "AddServer";
722
722
  /** Message to sign */
723
723
  message: AddAndTrustServerInput;
724
724
  }
@@ -728,9 +728,7 @@ interface AddAndTrustServerTypedData {
728
728
  * @category Permissions
729
729
  * @deprecated Use AddAndTrustServerTypedData instead
730
730
  */
731
- interface TrustServerTypedData {
732
- /** EIP-712 domain */
733
- domain: PermissionGrantDomain;
731
+ interface TrustServerTypedData extends GenericTypedData {
734
732
  /** EIP-712 types */
735
733
  types: {
736
734
  TrustServer: Array<{
@@ -748,9 +746,7 @@ interface TrustServerTypedData {
748
746
  *
749
747
  * @category Permissions
750
748
  */
751
- interface UntrustServerTypedData {
752
- /** EIP-712 domain */
753
- domain: PermissionGrantDomain;
749
+ interface UntrustServerTypedData extends GenericTypedData {
754
750
  /** EIP-712 types */
755
751
  types: {
756
752
  UntrustServer: Array<{
@@ -907,7 +903,7 @@ interface RegisterGranteeParams {
907
903
  *
908
904
  * @category Permissions
909
905
  */
910
- interface RegisterGranteeInput extends Record<string, unknown> {
906
+ interface RegisterGranteeInput extends RecordCompatible {
911
907
  /** User nonce */
912
908
  nonce: bigint;
913
909
  /** Grantee owner address */
@@ -922,9 +918,7 @@ interface RegisterGranteeInput extends Record<string, unknown> {
922
918
  *
923
919
  * @category Permissions
924
920
  */
925
- interface RegisterGranteeTypedData {
926
- /** EIP-712 domain */
927
- domain: PermissionGrantDomain;
921
+ interface RegisterGranteeTypedData extends GenericTypedData {
928
922
  /** EIP-712 types */
929
923
  types: {
930
924
  RegisterGrantee: Array<{
@@ -990,6 +984,8 @@ interface ServerFilesAndPermissionParams {
990
984
  grant: string;
991
985
  /** File URLs */
992
986
  fileUrls: string[];
987
+ /** Schema IDs for each file - use 0 for files without schema validation */
988
+ schemaIds: number[];
993
989
  /** Server address */
994
990
  serverAddress: Address;
995
991
  /** Server URL */
@@ -1015,6 +1011,8 @@ interface ServerFilesAndPermissionTypedData extends GenericTypedData {
1015
1011
  grant: string;
1016
1012
  /** File URLs */
1017
1013
  fileUrls: string[];
1014
+ /** Schema IDs for each file - use 0 for files without schema validation */
1015
+ schemaIds: bigint[];
1018
1016
  /** Server address */
1019
1017
  serverAddress: Address;
1020
1018
  /** Server URL */
@@ -1143,6 +1141,22 @@ interface RelayerCallbacks {
1143
1141
  * @returns Promise resolving to the transaction hash
1144
1142
  */
1145
1143
  submitAddAndTrustServer?: (typedData: AddAndTrustServerTypedData, signature: Hash) => Promise<Hash>;
1144
+ /**
1145
+ * Submit a signed permission addition transaction for relay
1146
+ *
1147
+ * @param typedData - The EIP-712 typed data that was signed
1148
+ * @param signature - The user's signature
1149
+ * @returns Promise resolving to the transaction hash
1150
+ */
1151
+ submitAddPermission?: (typedData: GenericTypedData, signature: Hash) => Promise<Hash>;
1152
+ /**
1153
+ * Submit a signed server files and permissions transaction for relay
1154
+ *
1155
+ * @param typedData - The EIP-712 typed data that was signed
1156
+ * @param signature - The user's signature
1157
+ * @returns Promise resolving to the transaction hash
1158
+ */
1159
+ submitAddServerFilesAndPermissions?: (typedData: ServerFilesAndPermissionTypedData, signature: Hash) => Promise<Hash>;
1146
1160
  /**
1147
1161
  * Submit a file addition for relay
1148
1162
  *
@@ -2172,8 +2186,8 @@ interface Schema {
2172
2186
  id: number;
2173
2187
  /** Schema name */
2174
2188
  name: string;
2175
- /** Schema type */
2176
- type: string;
2189
+ /** Schema dialect */
2190
+ dialect: string;
2177
2191
  /** URL containing the schema definition */
2178
2192
  definitionUrl: string;
2179
2193
  }
@@ -2204,8 +2218,8 @@ interface Refiner {
2204
2218
  interface AddSchemaParams {
2205
2219
  /** Schema name */
2206
2220
  name: string;
2207
- /** Schema type */
2208
- type: string;
2221
+ /** Schema dialect */
2222
+ dialect: string;
2209
2223
  /** URL containing the schema definition */
2210
2224
  definitionUrl: string;
2211
2225
  }
@@ -2280,13 +2294,7 @@ interface UpdateSchemaIdResult {
2280
2294
  transactionHash: Hash;
2281
2295
  }
2282
2296
  /**
2283
- * Query mode for trusted server retrieval
2284
- *
2285
- * @category Data Management
2286
- */
2287
- type TrustedServerQueryMode = "subgraph" | "rpc" | "auto";
2288
- /**
2289
- * Trusted server data structure (unified format for both subgraph and RPC modes)
2297
+ * Trusted server data structure
2290
2298
  *
2291
2299
  * @category Data Management
2292
2300
  */
@@ -2305,39 +2313,20 @@ interface TrustedServer {
2305
2313
  trustIndex?: number;
2306
2314
  }
2307
2315
  /**
2308
- * Parameters for getUserTrustedServers with dual-mode support
2316
+ * Parameters for getUserTrustedServers method
2309
2317
  *
2310
2318
  * @category Data Management
2311
2319
  */
2312
2320
  interface GetUserTrustedServersParams {
2313
- /** User address to query */
2321
+ /** User address to query trusted servers for */
2314
2322
  user: Address;
2315
- /** Query mode: 'subgraph' (fast, requires subgraph), 'rpc' (direct contract), or 'auto' (tries subgraph first) */
2316
- mode?: TrustedServerQueryMode;
2317
- /** Subgraph URL (required for subgraph mode) */
2323
+ /** Optional subgraph URL to override default */
2318
2324
  subgraphUrl?: string;
2319
- /** Pagination limit (applies to RPC mode) */
2325
+ /** Maximum number of results */
2320
2326
  limit?: number;
2321
- /** Pagination offset (applies to RPC mode) */
2327
+ /** Number of results to skip */
2322
2328
  offset?: number;
2323
2329
  }
2324
- /**
2325
- * Result of getUserTrustedServers query
2326
- *
2327
- * @category Data Management
2328
- */
2329
- interface GetUserTrustedServersResult {
2330
- /** Array of trusted servers */
2331
- servers: TrustedServer[];
2332
- /** Query mode that was actually used */
2333
- usedMode: TrustedServerQueryMode;
2334
- /** Total count (only available in RPC mode) */
2335
- total?: number;
2336
- /** Whether there are more servers (pagination info for RPC mode) */
2337
- hasMore?: boolean;
2338
- /** Any warnings or fallback information */
2339
- warnings?: string[];
2340
- }
2341
2330
 
2342
2331
  declare const contractAbis: {
2343
2332
  readonly DataPortabilityPermissions: readonly [{
@@ -2456,6 +2445,18 @@ declare const contractAbis: {
2456
2445
  }];
2457
2446
  readonly name: "InvalidPermissionsLength";
2458
2447
  readonly type: "error";
2448
+ }, {
2449
+ readonly inputs: readonly [{
2450
+ readonly internalType: "uint256";
2451
+ readonly name: "filesLength";
2452
+ readonly type: "uint256";
2453
+ }, {
2454
+ readonly internalType: "uint256";
2455
+ readonly name: "schemaIdsLength";
2456
+ readonly type: "uint256";
2457
+ }];
2458
+ readonly name: "InvalidSchemaIdsLength";
2459
+ readonly type: "error";
2459
2460
  }, {
2460
2461
  readonly inputs: readonly [];
2461
2462
  readonly name: "InvalidSignature";
@@ -2732,6 +2733,10 @@ declare const contractAbis: {
2732
2733
  readonly internalType: "string[]";
2733
2734
  readonly name: "fileUrls";
2734
2735
  readonly type: "string[]";
2736
+ }, {
2737
+ readonly internalType: "uint256[]";
2738
+ readonly name: "schemaIds";
2739
+ readonly type: "uint256[]";
2735
2740
  }, {
2736
2741
  readonly internalType: "address";
2737
2742
  readonly name: "serverAddress";
@@ -3714,7 +3719,7 @@ declare const contractAbis: {
3714
3719
  readonly name: "addServerInput";
3715
3720
  readonly type: "tuple";
3716
3721
  }];
3717
- readonly name: "addAndTrustServerOnBehalf";
3722
+ readonly name: "addAndTrustServerByManager";
3718
3723
  readonly outputs: readonly [];
3719
3724
  readonly stateMutability: "nonpayable";
3720
3725
  readonly type: "function";
@@ -4102,6 +4107,20 @@ declare const contractAbis: {
4102
4107
  readonly outputs: readonly [];
4103
4108
  readonly stateMutability: "nonpayable";
4104
4109
  readonly type: "function";
4110
+ }, {
4111
+ readonly inputs: readonly [{
4112
+ readonly internalType: "address";
4113
+ readonly name: "userAddress";
4114
+ readonly type: "address";
4115
+ }, {
4116
+ readonly internalType: "uint256";
4117
+ readonly name: "serverId";
4118
+ readonly type: "uint256";
4119
+ }];
4120
+ readonly name: "trustServerByManager";
4121
+ readonly outputs: readonly [];
4122
+ readonly stateMutability: "nonpayable";
4123
+ readonly type: "function";
4105
4124
  }, {
4106
4125
  readonly inputs: readonly [{
4107
4126
  readonly components: readonly [{
@@ -28725,6 +28744,95 @@ type VanaContract = keyof ContractAbis;
28725
28744
  */
28726
28745
  declare function getAbi<T extends VanaContract>(contract: T): ContractAbis[T];
28727
28746
 
28747
+ /**
28748
+ * Comprehensive mapping of SDK transaction operations to blockchain events.
28749
+ * Used by the generic transaction parser to know which contract and event
28750
+ * to look for when parsing transaction results.
28751
+ */
28752
+ declare const EVENT_MAPPINGS: {
28753
+ readonly grant: {
28754
+ readonly contract: "DataPortabilityPermissions";
28755
+ readonly event: "PermissionAdded";
28756
+ };
28757
+ readonly revoke: {
28758
+ readonly contract: "DataPortabilityPermissions";
28759
+ readonly event: "PermissionRevoked";
28760
+ };
28761
+ readonly revokePermission: {
28762
+ readonly contract: "DataPortabilityPermissions";
28763
+ readonly event: "PermissionRevoked";
28764
+ };
28765
+ readonly addServerFilesAndPermissions: {
28766
+ readonly contract: "DataPortabilityPermissions";
28767
+ readonly event: "PermissionAdded";
28768
+ };
28769
+ readonly trustServer: {
28770
+ readonly contract: "DataPortabilityServers";
28771
+ readonly event: "ServerTrusted";
28772
+ };
28773
+ readonly untrustServer: {
28774
+ readonly contract: "DataPortabilityServers";
28775
+ readonly event: "ServerUntrusted";
28776
+ };
28777
+ readonly registerServer: {
28778
+ readonly contract: "DataPortabilityServers";
28779
+ readonly event: "ServerRegistered";
28780
+ };
28781
+ readonly updateServer: {
28782
+ readonly contract: "DataPortabilityServers";
28783
+ readonly event: "ServerUpdated";
28784
+ };
28785
+ readonly addAndTrustServer: {
28786
+ readonly contract: "DataPortabilityServers";
28787
+ readonly event: "ServerTrusted";
28788
+ };
28789
+ readonly addFile: {
28790
+ readonly contract: "DataRegistry";
28791
+ readonly event: "FileAdded";
28792
+ };
28793
+ readonly addFileWithPermissionsAndSchema: {
28794
+ readonly contract: "DataRegistry";
28795
+ readonly event: "FileAdded";
28796
+ };
28797
+ readonly addFileWithSchema: {
28798
+ readonly contract: "DataRegistry";
28799
+ readonly event: "FileAdded";
28800
+ };
28801
+ readonly addFileWithPermissions: {
28802
+ readonly contract: "DataRegistry";
28803
+ readonly event: "FileAdded";
28804
+ };
28805
+ readonly addRefinement: {
28806
+ readonly contract: "DataRegistry";
28807
+ readonly event: "RefinementAdded";
28808
+ };
28809
+ readonly addRefiner: {
28810
+ readonly contract: "DataRefinerRegistry";
28811
+ readonly event: "RefinerAdded";
28812
+ };
28813
+ readonly updateSchemaId: {
28814
+ readonly contract: "DataRefinerRegistry";
28815
+ readonly event: "SchemaAdded";
28816
+ };
28817
+ readonly addSchema: {
28818
+ readonly contract: "DataRefinerRegistry";
28819
+ readonly event: "SchemaAdded";
28820
+ };
28821
+ readonly updateRefinement: {
28822
+ readonly contract: "DataRegistry";
28823
+ readonly event: "RefinementUpdated";
28824
+ };
28825
+ readonly addFilePermission: {
28826
+ readonly contract: "DataRegistry";
28827
+ readonly event: "PermissionGranted";
28828
+ };
28829
+ readonly registerGrantee: {
28830
+ readonly contract: "DataPortabilityGrantees";
28831
+ readonly event: "GranteeRegistered";
28832
+ };
28833
+ };
28834
+ type TransactionOperation = keyof typeof EVENT_MAPPINGS;
28835
+
28728
28836
  /**
28729
28837
  * Base interface for all transaction results.
28730
28838
  * Contains the event data plus transaction metadata.
@@ -28762,6 +28870,62 @@ interface PermissionRevokeResult extends BaseTransactionResult {
28762
28870
  /** ID of the permission that was revoked */
28763
28871
  permissionId: bigint;
28764
28872
  }
28873
+ /**
28874
+ * Result of a successful server trust operation.
28875
+ * Contains data from the ServerTrusted blockchain event.
28876
+ */
28877
+ interface ServerTrustResult extends BaseTransactionResult {
28878
+ /** Address of the user who trusted the server */
28879
+ user: Address;
28880
+ /** Address/ID of the trusted server */
28881
+ serverId: Address;
28882
+ /** URL of the trusted server */
28883
+ serverUrl: string;
28884
+ }
28885
+ /**
28886
+ * Result of a successful server untrust operation.
28887
+ * Contains data from the ServerUntrusted blockchain event.
28888
+ */
28889
+ interface ServerUntrustResult extends BaseTransactionResult {
28890
+ /** Address of the user who untrusted the server */
28891
+ user: Address;
28892
+ /** Address/ID of the untrusted server */
28893
+ serverId: Address;
28894
+ }
28895
+ /**
28896
+ * Result of a successful server update operation.
28897
+ * Contains data from the ServerUpdated blockchain event.
28898
+ */
28899
+ interface ServerUpdateResult extends BaseTransactionResult {
28900
+ /** ID of the server that was updated */
28901
+ serverId: bigint;
28902
+ /** New URL of the server */
28903
+ url: string;
28904
+ }
28905
+ /**
28906
+ * Result of a successful grantee registration operation.
28907
+ * Contains data from the GranteeRegistered blockchain event.
28908
+ */
28909
+ interface GranteeRegisterResult extends BaseTransactionResult {
28910
+ /** Unique grantee ID assigned by the registry */
28911
+ granteeId: bigint;
28912
+ /** Address of the registered grantee */
28913
+ granteeAddress: Address;
28914
+ /** Display name of the grantee */
28915
+ name: string;
28916
+ }
28917
+ /**
28918
+ * Result of a successful file addition operation.
28919
+ * Contains data from the FileAdded blockchain event.
28920
+ */
28921
+ interface FileAddedResult extends BaseTransactionResult {
28922
+ /** Unique file ID assigned by the registry */
28923
+ fileId: bigint;
28924
+ /** Address of the file owner */
28925
+ ownerAddress: Address;
28926
+ /** URL where the file is stored */
28927
+ url: string;
28928
+ }
28765
28929
  /**
28766
28930
  * Result of a successful file permission addition operation.
28767
28931
  * Contains data from the FilePermissionAdded blockchain event.
@@ -28775,6 +28939,80 @@ interface FilePermissionResult extends BaseTransactionResult {
28775
28939
  encryptedKey: string;
28776
28940
  }
28777
28941
 
28942
+ /**
28943
+ * Provides a unified interface for blockchain transaction results with lazy-loaded event parsing.
28944
+ *
28945
+ * @remarks
28946
+ * TransactionHandle enables immediate access to transaction hashes while providing optional
28947
+ * lazy-loaded access to receipts and parsed event data. All transaction-submitting methods
28948
+ * in the SDK return this handle, allowing developers to choose between immediate hash access
28949
+ * or waiting for event data. Results are memoized to prevent redundant network calls.
28950
+ *
28951
+ * @category Transactions
28952
+ * @example
28953
+ * ```typescript
28954
+ * // Immediate hash access
28955
+ * const tx = await sdk.permissions.submitSignedGrant(typedData, signature);
28956
+ * console.log(`Transaction submitted: ${tx.hash}`);
28957
+ *
28958
+ * // Wait for and parse events
28959
+ * const eventData = await tx.waitForEvents();
28960
+ * console.log(`Permission ID: ${eventData.permissionId}`);
28961
+ *
28962
+ * // Check receipt for gas usage
28963
+ * const receipt = await tx.waitForReceipt();
28964
+ * console.log(`Gas used: ${receipt.gasUsed}`);
28965
+ * ```
28966
+ */
28967
+ declare class TransactionHandle<TEventData = unknown> {
28968
+ private readonly context;
28969
+ readonly hash: Hash;
28970
+ private readonly operation?;
28971
+ private _receipt?;
28972
+ private _eventData?;
28973
+ private _receiptPromise?;
28974
+ private _eventPromise?;
28975
+ constructor(context: ControllerContext$1, hash: Hash, operation?: TransactionOperation | undefined);
28976
+ /**
28977
+ * Waits for transaction confirmation and returns the receipt.
28978
+ * Results are memoized - multiple calls return the same promise.
28979
+ *
28980
+ * @param options Optional timeout configuration
28981
+ * @param options.timeout Timeout in milliseconds (default: 30000)
28982
+ * @returns Transaction receipt with gas usage, logs, and status
28983
+ */
28984
+ waitForReceipt(options?: {
28985
+ timeout?: number;
28986
+ }): Promise<TransactionReceipt$1>;
28987
+ /**
28988
+ * Waits for transaction confirmation and parses emitted events.
28989
+ * Results are memoized - multiple calls return the same promise.
28990
+ *
28991
+ * @returns Parsed event data with transaction metadata
28992
+ * @throws {Error} If no operation was specified for event parsing
28993
+ */
28994
+ waitForEvents(): Promise<TEventData>;
28995
+ /**
28996
+ * Enables string coercion for backwards compatibility.
28997
+ * Allows TransactionHandle to be used anywhere a Hash is expected.
28998
+ *
28999
+ * @example
29000
+ * ```typescript
29001
+ * const hash: Hash = tx; // Works via toString()
29002
+ * console.log(`Transaction: ${tx}`); // Prints hash
29003
+ * ```
29004
+ * @returns The transaction hash as a string
29005
+ */
29006
+ toString(): string;
29007
+ /**
29008
+ * JSON serialization support.
29009
+ * Returns the hash when serialized to JSON.
29010
+ *
29011
+ * @returns The transaction hash for JSON serialization
29012
+ */
29013
+ toJSON(): string;
29014
+ }
29015
+
28778
29016
  /**
28779
29017
  * Google Drive Storage Provider for Vana SDK
28780
29018
  *
@@ -29813,30 +30051,31 @@ declare class PermissionsController {
29813
30051
  */
29814
30052
  grant(params: GrantPermissionParams$1): Promise<PermissionGrantResult>;
29815
30053
  /**
29816
- * Submits a permission grant transaction and returns the transaction hash immediately.
30054
+ * Submits a permission grant transaction and returns a handle for flexible result access.
29817
30055
  *
29818
- * This is the lower-level method that provides maximum control over transaction timing.
29819
- * Use this when you want to handle transaction confirmation and event parsing separately,
29820
- * or when submitting multiple transactions in batch.
30056
+ * @remarks
30057
+ * This lower-level method provides maximum control over transaction timing.
30058
+ * Returns a TransactionHandle that allows immediate hash access or optional event parsing.
30059
+ * Use this when handling multiple transactions or when you need granular control.
29821
30060
  *
29822
30061
  * @param params - The permission grant configuration object
29823
- * @returns Promise that resolves to the transaction hash when successfully submitted
30062
+ * @returns Promise resolving to TransactionHandle with hash and event parsing capabilities
29824
30063
  * @throws {RelayerError} When gasless transaction submission fails
29825
30064
  * @throws {SignatureError} When user rejects the signature request
29826
30065
  * @throws {SerializationError} When grant data cannot be serialized
29827
30066
  * @throws {BlockchainError} When permission grant preparation fails
29828
30067
  * @example
29829
30068
  * ```typescript
29830
- * // Submit transaction and handle confirmation later
29831
- * const txHash = await vana.permissions.submitPermissionGrant(params);
29832
- * console.log(`Transaction submitted: ${txHash}`);
30069
+ * // Submit transaction and get immediate hash access
30070
+ * const tx = await vana.permissions.submitPermissionGrant(params);
30071
+ * console.log(`Transaction submitted: ${tx.hash}`);
29833
30072
  *
29834
- * // Later, when you need the permission data:
29835
- * const result = await parseTransactionResult(context, txHash, 'grant');
29836
- * console.log(`Permission ID: ${result.permissionId}`);
30073
+ * // Optionally wait for and parse events
30074
+ * const eventData = await tx.waitForEvents();
30075
+ * console.log(`Permission ID: ${eventData.permissionId}`);
29837
30076
  * ```
29838
30077
  */
29839
- submitPermissionGrant(params: GrantPermissionParams$1): Promise<Hash>;
30078
+ submitPermissionGrant(params: GrantPermissionParams$1): Promise<TransactionHandle<PermissionGrantResult>>;
29840
30079
  /**
29841
30080
  * Prepares a permission grant with preview before signing.
29842
30081
  *
@@ -29864,15 +30103,21 @@ declare class PermissionsController {
29864
30103
  */
29865
30104
  prepareGrant(params: GrantPermissionParams$1): Promise<{
29866
30105
  preview: GrantFile;
29867
- confirm: () => Promise<Hash>;
30106
+ confirm: () => Promise<TransactionHandle<PermissionGrantResult>>;
29868
30107
  }>;
29869
30108
  /**
29870
- * Internal method to complete the grant process after user confirmation.
29871
- * This is called by the confirm() function returned from prepareGrant().
30109
+ * Completes the grant process after user confirmation.
30110
+ *
30111
+ * @remarks
30112
+ * This internal method is called by the confirm() function returned from prepareGrant().
30113
+ * It handles IPFS upload, signature creation, and transaction submission.
29872
30114
  *
29873
30115
  * @param params - The permission grant parameters containing user and operation details
29874
30116
  * @param grantFile - The prepared grant file with permissions and metadata
29875
- * @returns Promise resolving to the transaction hash
30117
+ * @returns Promise resolving to TransactionHandle for flexible result access
30118
+ * @throws {BlockchainError} When permission grant confirmation fails
30119
+ * @throws {NetworkError} When IPFS upload fails
30120
+ * @throws {SignatureError} When user rejects the signature
29876
30121
  */
29877
30122
  private confirmGrantInternal;
29878
30123
  /**
@@ -29928,49 +30173,106 @@ declare class PermissionsController {
29928
30173
  * );
29929
30174
  * ```
29930
30175
  */
29931
- submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<Hash>;
30176
+ submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
29932
30177
  /**
29933
30178
  * Submits an already-signed trust server transaction to the blockchain.
30179
+ *
30180
+ * @remarks
29934
30181
  * This method extracts the trust server input from typed data and submits it directly.
30182
+ * Used internally by trust server methods after signature collection.
29935
30183
  *
29936
30184
  * @param typedData - The EIP-712 typed data for TrustServer
29937
- * @param signature - The user's signature
29938
- * @returns Promise resolving to the transaction hash
30185
+ * @param signature - The user's signature obtained via `signTypedData()`
30186
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30187
+ * @throws {BlockchainError} When contract submission fails
30188
+ * @throws {NetworkError} When blockchain communication fails
30189
+ * @example
30190
+ * ```typescript
30191
+ * const txHandle = await vana.permissions.submitSignedTrustServer(
30192
+ * typedData,
30193
+ * "0x1234..."
30194
+ * );
30195
+ * const result = await txHandle.waitForEvents();
30196
+ * ```
29939
30197
  */
29940
- submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<Hash>;
30198
+ submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
29941
30199
  /**
29942
30200
  * Submits an already-signed add and trust server transaction to the blockchain.
30201
+ *
30202
+ * @remarks
29943
30203
  * This method extracts the add and trust server input from typed data and submits it directly.
30204
+ * Combines server registration and trust operations in a single transaction.
29944
30205
  *
29945
30206
  * @param typedData - The EIP-712 typed data for AddAndTrustServer
29946
- * @param signature - The user's signature
29947
- * @returns Promise resolving to the transaction hash
30207
+ * @param signature - The user's signature obtained via `signTypedData()`
30208
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30209
+ * @throws {BlockchainError} When contract submission fails
30210
+ * @throws {NetworkError} When blockchain communication fails
30211
+ * @example
30212
+ * ```typescript
30213
+ * const txHandle = await vana.permissions.submitSignedAddAndTrustServer(
30214
+ * typedData,
30215
+ * "0x1234..."
30216
+ * );
30217
+ * const result = await txHandle.waitForEvents();
30218
+ * ```
29948
30219
  */
29949
- submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<Hash>;
30220
+ submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
29950
30221
  /**
29951
30222
  * Submits an already-signed permission revoke transaction to the blockchain.
30223
+ *
30224
+ * @remarks
29952
30225
  * This method handles the revocation of previously granted permissions.
30226
+ * Used internally by revocation methods after signature collection.
29953
30227
  *
29954
30228
  * @param typedData - The EIP-712 typed data for PermissionRevoke
29955
- * @param signature - The user's signature
29956
- * @returns Promise resolving to the transaction hash
30229
+ * @param signature - The user's signature obtained via `signTypedData()`
30230
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30231
+ * @throws {BlockchainError} When contract submission fails
30232
+ * @throws {NetworkError} When blockchain communication fails
30233
+ * @example
30234
+ * ```typescript
30235
+ * const txHandle = await vana.permissions.submitSignedRevoke(
30236
+ * typedData,
30237
+ * "0x1234..."
30238
+ * );
30239
+ * const result = await txHandle.waitForEvents();
30240
+ * ```
29957
30241
  */
29958
- submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30242
+ submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionRevokeResult>>;
29959
30243
  /**
29960
30244
  * Submits an already-signed untrust server transaction to the blockchain.
30245
+ *
30246
+ * @remarks
29961
30247
  * This method handles the removal of trusted servers.
30248
+ * Used internally by untrust server methods after signature collection.
29962
30249
  *
29963
30250
  * @param typedData - The EIP-712 typed data for UntrustServer
29964
- * @param signature - The user's signature
29965
- * @returns Promise resolving to the transaction hash
30251
+ * @param signature - The user's signature obtained via `signTypedData()`
30252
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30253
+ * @throws {BlockchainError} When contract submission fails
30254
+ * @throws {NetworkError} When blockchain communication fails
30255
+ * @example
30256
+ * ```typescript
30257
+ * const txHandle = await vana.permissions.submitSignedUntrustServer(
30258
+ * typedData,
30259
+ * "0x1234..."
30260
+ * );
30261
+ * const result = await txHandle.waitForEvents();
30262
+ * ```
29966
30263
  */
29967
- submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30264
+ submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<ServerUntrustResult>>;
29968
30265
  /**
29969
30266
  * Submits a signed transaction directly to the blockchain.
29970
30267
  *
30268
+ * @remarks
30269
+ * Internal method used when relayer callbacks are not available. Formats the signature
30270
+ * and submits the permission grant directly to the smart contract.
30271
+ *
29971
30272
  * @param typedData - The typed data structure for the permission grant
29972
30273
  * @param signature - The cryptographic signature authorizing the transaction
29973
30274
  * @returns Promise resolving to the transaction hash
30275
+ * @throws {BlockchainError} When contract submission fails
29974
30276
  */
29975
30277
  private submitDirectTransaction;
29976
30278
  /**
@@ -30017,21 +30319,38 @@ declare class PermissionsController {
30017
30319
  * console.log(`Revocation submitted: ${txHash}`);
30018
30320
  * ```
30019
30321
  */
30020
- submitPermissionRevoke(params: RevokePermissionParams): Promise<Hash>;
30322
+ submitPermissionRevoke(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
30021
30323
  /**
30022
- * Revokes a permission with a signature (gasless transaction).
30324
+ * Revokes a permission with a signature for gasless transactions.
30325
+ *
30326
+ * @remarks
30327
+ * This method creates an EIP-712 signature for permission revocation and submits
30328
+ * it either through relayer callbacks or directly to the blockchain. Provides
30329
+ * gasless revocation when relayer is configured.
30023
30330
  *
30024
30331
  * @param params - Parameters for revoking the permission
30025
- * @returns Promise resolving to transaction hash
30332
+ * @param params.permissionId - Permission identifier to revoke (accepts bigint, number, or string)
30333
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30026
30334
  * @throws {BlockchainError} When chain ID is not available
30027
30335
  * @throws {NonceError} When retrieving user nonce fails
30028
30336
  * @throws {SignatureError} When user rejects the signature request
30029
30337
  * @throws {RelayerError} When gasless submission fails
30030
30338
  * @throws {PermissionError} When revocation fails for any other reason
30339
+ * @example
30340
+ * ```typescript
30341
+ * const txHandle = await vana.permissions.submitRevokeWithSignature({
30342
+ * permissionId: 123n
30343
+ * });
30344
+ * const result = await txHandle.waitForEvents();
30345
+ * console.log(`Permission ${result.permissionId} revoked`);
30346
+ * ```
30031
30347
  */
30032
- submitRevokeWithSignature(params: RevokePermissionParams): Promise<Hash>;
30348
+ submitRevokeWithSignature(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
30033
30349
  /**
30350
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30351
+ *
30034
30352
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
30353
+ * This method is deprecated in favor of more specific nonce methods.
30035
30354
  *
30036
30355
  * The nonce is used to prevent replay attacks in signed transactions and must
30037
30356
  * be incremented with each transaction to maintain security.
@@ -30043,25 +30362,77 @@ declare class PermissionsController {
30043
30362
  * @private
30044
30363
  * @example
30045
30364
  * ```typescript
30365
+ * // Deprecated - use specific methods instead
30046
30366
  * const nonce = await this.getUserNonce();
30047
- * console.log(`Current nonce: ${nonce}`);
30367
+ *
30368
+ * // Use these instead:
30369
+ * const permissionsNonce = await this.getPermissionsUserNonce();
30370
+ * const serversNonce = await this.getServersUserNonce();
30048
30371
  * ```
30049
30372
  */
30373
+ /**
30374
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30375
+ *
30376
+ * Retrieves the user's current nonce from the DataPortabilityServers contract.
30377
+ *
30378
+ * @remarks
30379
+ * This method is deprecated in favor of more specific nonce methods that target
30380
+ * the appropriate contract for the operation being performed.
30381
+ *
30382
+ * @returns Promise resolving to the user's current nonce as a bigint
30383
+ * @throws {NonceError} When retrieving the nonce fails
30384
+ */
30050
30385
  private getUserNonce;
30051
30386
  /**
30052
30387
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
30053
30388
  * This nonce is used for server-related operations (AddAndTrustServer, TrustServer, UntrustServer).
30054
30389
  *
30055
- * @returns Promise resolving to the current nonce
30390
+ * @returns Promise resolving to the current servers nonce
30391
+ * @throws {NonceError} When reading nonce from contract fails
30392
+ * @private
30393
+ *
30394
+ * @example
30395
+ * ```typescript
30396
+ * const nonce = await this.getServersUserNonce();
30397
+ * console.log(`Current servers nonce: ${nonce}`);
30398
+ * ```
30399
+ */
30400
+ /**
30401
+ * Retrieves the user's current nonce from the DataPortabilityServers contract.
30402
+ *
30403
+ * @remarks
30404
+ * Used for server-related operations (trust/untrust) to prevent replay attacks.
30405
+ * The nonce must be incremented with each server operation.
30406
+ *
30407
+ * @returns Promise resolving to the user's current nonce as a bigint
30408
+ * @throws {NonceError} When retrieving the nonce fails
30409
+ */
30410
+ private getServersUserNonce;
30411
+ /**
30412
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
30413
+ * This nonce is used for permission-related operations (addPermission, addServerFilesAndPermissions).
30414
+ *
30415
+ * @returns Promise resolving to the current permissions nonce
30416
+ * @throws {NonceError} When reading nonce from contract fails
30056
30417
  * @private
30057
30418
  *
30058
30419
  * @example
30059
30420
  * ```typescript
30060
- * const nonce = await this.getServerNonce();
30061
- * console.log(`Current server nonce: ${nonce}`);
30421
+ * const nonce = await this.getPermissionsUserNonce();
30422
+ * console.log(`Current permissions nonce: ${nonce}`);
30062
30423
  * ```
30063
30424
  */
30064
- private getServerNonce;
30425
+ /**
30426
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
30427
+ *
30428
+ * @remarks
30429
+ * Used for permission-related operations (grant/revoke) to prevent replay attacks.
30430
+ * The nonce must be incremented with each permission operation.
30431
+ *
30432
+ * @returns Promise resolving to the user's current nonce as a bigint
30433
+ * @throws {NonceError} When retrieving the nonce fails
30434
+ */
30435
+ private getPermissionsUserNonce;
30065
30436
  /**
30066
30437
  * Composes the EIP-712 typed data for PermissionGrant (new simplified format).
30067
30438
  *
@@ -30082,6 +30453,7 @@ declare class PermissionsController {
30082
30453
  * @param params.granteeId - Grantee ID
30083
30454
  * @param params.grant - Grant URL or grant data
30084
30455
  * @param params.fileUrls - Array of file URLs
30456
+ * @param params.schemaIds - Schema IDs for each file
30085
30457
  * @param params.serverAddress - Server address
30086
30458
  * @param params.serverUrl - Server URL
30087
30459
  * @param params.serverPublicKey - Server public key
@@ -30187,7 +30559,7 @@ declare class PermissionsController {
30187
30559
  * console.log('Now trusting servers:', trustedServers);
30188
30560
  * ```
30189
30561
  */
30190
- addAndTrustServer(params: AddAndTrustServerParams): Promise<Hash>;
30562
+ addAndTrustServer(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30191
30563
  /**
30192
30564
  * Trusts a server for data processing (legacy method).
30193
30565
  *
@@ -30195,14 +30567,14 @@ declare class PermissionsController {
30195
30567
  * @returns Promise resolving to transaction hash
30196
30568
  * @deprecated Use addAndTrustServer instead
30197
30569
  */
30198
- submitTrustServer(params: TrustServerParams): Promise<Hash>;
30570
+ submitTrustServer(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30199
30571
  /**
30200
30572
  * Adds and trusts a server using a signature (gasless transaction).
30201
30573
  *
30202
30574
  * @param params - Parameters for adding and trusting the server
30203
- * @returns Promise resolving to transaction hash
30575
+ * @returns Promise resolving to TransactionHandle with ServerTrustResult event data
30204
30576
  */
30205
- submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<Hash>;
30577
+ submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30206
30578
  /**
30207
30579
  * Trusts a server using a signature (gasless transaction - legacy method).
30208
30580
  *
@@ -30216,13 +30588,24 @@ declare class PermissionsController {
30216
30588
  * @throws {ServerUrlMismatchError} When server URL doesn't match existing registration
30217
30589
  * @throws {BlockchainError} When trust operation fails for any other reason
30218
30590
  */
30219
- submitTrustServerWithSignature(params: TrustServerParams): Promise<Hash>;
30591
+ submitTrustServerWithSignature(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30220
30592
  /**
30221
30593
  * Submits a direct untrust server transaction (without signature).
30222
30594
  *
30223
30595
  * @param params - The untrust server parameters containing server details
30224
30596
  * @returns Promise resolving to the transaction hash
30225
30597
  */
30598
+ /**
30599
+ * Submits an untrust server transaction directly to the blockchain.
30600
+ *
30601
+ * @remarks
30602
+ * Internal method used for direct blockchain submission of untrust server operations
30603
+ * when relayer callbacks are not available.
30604
+ *
30605
+ * @param params - The untrust server parameters
30606
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30607
+ * @throws {BlockchainError} When contract submission fails
30608
+ */
30226
30609
  private submitDirectUntrustTransaction;
30227
30610
  /**
30228
30611
  * Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
@@ -30252,7 +30635,7 @@ declare class PermissionsController {
30252
30635
  * console.log('Still trusting servers:', trustedServers);
30253
30636
  * ```
30254
30637
  */
30255
- submitUntrustServer(params: UntrustServerParams): Promise<Hash>;
30638
+ submitUntrustServer(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
30256
30639
  /**
30257
30640
  * Untrusts a server using a signature (gasless transaction).
30258
30641
  *
@@ -30265,7 +30648,7 @@ declare class PermissionsController {
30265
30648
  * @throws {RelayerError} When gasless submission fails
30266
30649
  * @throws {BlockchainError} When untrust transaction fails
30267
30650
  */
30268
- submitUntrustServerWithSignature(params: UntrustServerParams): Promise<Hash>;
30651
+ submitUntrustServerWithSignature(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
30269
30652
  /**
30270
30653
  * Retrieves all servers trusted by a user from the DataPortabilityServers contract.
30271
30654
  *
@@ -30316,22 +30699,60 @@ declare class PermissionsController {
30316
30699
  /**
30317
30700
  * Gets server information for multiple servers efficiently.
30318
30701
  *
30319
- * @param serverIds - Array of server IDs to query
30320
- * @returns Promise resolving to batch result with successes and failures
30702
+ * @remarks
30703
+ * This method uses multicall to fetch information for multiple servers in a single
30704
+ * blockchain call, improving performance when querying many servers. Failed lookups
30705
+ * are returned separately for error handling.
30706
+ *
30707
+ * @param serverIds - Array of numeric server IDs to query
30708
+ * @returns Promise resolving to batch result containing successful lookups and failed IDs
30321
30709
  * @throws {BlockchainError} When reading from contract fails or chain is unavailable
30710
+ * @example
30711
+ * ```typescript
30712
+ * const result = await vana.permissions.getServerInfoBatch([1, 2, 3, 999]);
30713
+ *
30714
+ * // Process successful lookups
30715
+ * result.servers.forEach((server, id) => {
30716
+ * console.log(`Server ${id}: ${server.url}`);
30717
+ * });
30718
+ *
30719
+ * // Handle failed lookups
30720
+ * if (result.failed.length > 0) {
30721
+ * console.log(`Failed to fetch: ${result.failed.join(', ')}`);
30722
+ * }
30723
+ * ```
30322
30724
  */
30323
30725
  getServerInfoBatch(serverIds: number[]): Promise<BatchServerInfoResult>;
30324
30726
  /**
30325
30727
  * Checks whether a specific server is trusted by a user.
30326
30728
  *
30327
- * @param serverId - Server ID to check (numeric)
30729
+ * @remarks
30730
+ * This method queries the user's trusted server list and checks if the specified
30731
+ * server is present. Returns both the trust status and the index in the trust list
30732
+ * if trusted.
30733
+ *
30734
+ * @param serverId - Numeric server ID to check
30328
30735
  * @param userAddress - Optional user address (defaults to current user)
30329
- * @returns Promise resolving to server trust status
30736
+ * @returns Promise resolving to server trust status with trust index if applicable
30737
+ * @throws {BlockchainError} When reading from contract fails
30738
+ * @example
30739
+ * ```typescript
30740
+ * const status = await vana.permissions.checkServerTrustStatus(1);
30741
+ * if (status.isTrusted) {
30742
+ * console.log(`Server is trusted at index ${status.trustIndex}`);
30743
+ * } else {
30744
+ * console.log('Server is not trusted');
30745
+ * }
30746
+ * ```
30330
30747
  */
30331
30748
  checkServerTrustStatus(serverId: number, userAddress?: Address): Promise<ServerTrustStatus>;
30332
30749
  /**
30333
30750
  * Composes EIP-712 typed data for AddAndTrustServer.
30334
30751
  *
30752
+ * @remarks
30753
+ * Creates the complete typed data structure required for EIP-712 signature generation
30754
+ * when adding and trusting a new server in a single transaction.
30755
+ *
30335
30756
  * @param input - The add and trust server input data containing server details
30336
30757
  * @returns Promise resolving to the typed data structure for server add and trust
30337
30758
  */
@@ -30413,7 +30834,7 @@ declare class PermissionsController {
30413
30834
  * console.log(`Grantee registered in transaction: ${txHash}`);
30414
30835
  * ```
30415
30836
  */
30416
- submitRegisterGrantee(params: RegisterGranteeParams): Promise<Hash>;
30837
+ submitRegisterGrantee(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
30417
30838
  /**
30418
30839
  * Registers a grantee with a signature (gasless transaction)
30419
30840
  *
@@ -30429,7 +30850,7 @@ declare class PermissionsController {
30429
30850
  * });
30430
30851
  * ```
30431
30852
  */
30432
- submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<Hash>;
30853
+ submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
30433
30854
  /**
30434
30855
  * Submits a signed register grantee transaction via relayer
30435
30856
  *
@@ -30442,7 +30863,7 @@ declare class PermissionsController {
30442
30863
  * const result = await vana.permissions.submitSignedRegisterGrantee(typedData, signature);
30443
30864
  * ```
30444
30865
  */
30445
- submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<Hash>;
30866
+ submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<TransactionHandle<GranteeRegisterResult>>;
30446
30867
  /**
30447
30868
  * Retrieves all registered grantees from the DataPortabilityGrantees contract.
30448
30869
  *
@@ -30729,7 +31150,7 @@ declare class PermissionsController {
30729
31150
  * @param url - New URL for the server
30730
31151
  * @returns Promise resolving to transaction hash
30731
31152
  */
30732
- submitUpdateServer(serverId: bigint, url: string): Promise<Hash>;
31153
+ submitUpdateServer(serverId: bigint, url: string): Promise<TransactionHandle<ServerUpdateResult>>;
30733
31154
  /**
30734
31155
  * Get all permission IDs for a user
30735
31156
  *
@@ -30760,26 +31181,131 @@ declare class PermissionsController {
30760
31181
  */
30761
31182
  getPermissions(permissionId: bigint): Promise<PermissionInfo>;
30762
31183
  /**
30763
- * Submit permission with signature to the blockchain
31184
+ * Submit permission with signature to the blockchain (supports gasless transactions)
30764
31185
  *
30765
31186
  * @param params - Parameters for adding permission
30766
31187
  * @returns Promise resolving to transaction hash
31188
+ * @throws {RelayerError} When gasless transaction submission fails
31189
+ * @throws {SignatureError} When user rejects the signature request
31190
+ * @throws {BlockchainError} When permission addition fails
31191
+ * @throws {NetworkError} When network communication fails
30767
31192
  */
30768
- submitAddPermission(params: ServerFilesAndPermissionParams): Promise<Hash>;
31193
+ submitAddPermission(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
30769
31194
  /**
30770
- * Submit server files and permissions with signature to the blockchain
31195
+ * Submits an already-signed add permission transaction to the blockchain.
31196
+ * This method supports both relayer-based gasless transactions and direct transactions.
31197
+ *
31198
+ * @param typedData - The EIP-712 typed data for AddPermission
31199
+ * @param signature - The user's signature
31200
+ * @returns Promise resolving to TransactionHandle with PermissionGrantResult event data
31201
+ * @throws {RelayerError} When gasless transaction submission fails
31202
+ * @throws {BlockchainError} When permission addition fails
31203
+ * @throws {NetworkError} When network communication fails
31204
+ */
31205
+ submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
31206
+ /**
31207
+ * Submits server files and permissions with signature to the blockchain, supporting schema validation and gasless transactions.
31208
+ *
31209
+ * @remarks
31210
+ * This method validates files against their specified schemas before submission.
31211
+ * Schema validation ensures data conforms to expected formats before on-chain registration.
31212
+ * Files with schemaId = 0 bypass validation. The method supports atomic batch operations
31213
+ * where all files and permissions are registered in a single transaction.
30771
31214
  *
30772
31215
  * @param params - Parameters for adding server files and permissions
30773
- * @returns Promise resolving to transaction hash
31216
+ * @param params.granteeId - The ID of the permission grantee
31217
+ * @param params.grant - Grant URL containing permission parameters (typically IPFS)
31218
+ * @param params.fileUrls - Array of file URLs to register
31219
+ * @param params.schemaIds - Schema IDs for each file. Use 0 for files without schema validation.
31220
+ * Array length must match fileUrls length.
31221
+ * @param params.serverAddress - Server wallet address for decryption permissions
31222
+ * @param params.serverUrl - Server endpoint URL
31223
+ * @param params.serverPublicKey - Server's public key for encryption.
31224
+ * Obtain via `vana.server.getIdentity(userAddress).public_key`.
31225
+ * @param params.filePermissions - Nested array of permissions for each file
31226
+ * @returns TransactionHandle with immediate hash access and event parsing capability
31227
+ * @throws {Error} When schemaIds array length doesn't match fileUrls array length
31228
+ * @throws {SchemaValidationError} When file data doesn't match the specified schema.
31229
+ * Verify data structure matches schema definition from `vana.schemas.get(schemaId)`.
31230
+ * @throws {RelayerError} When gasless transaction submission fails.
31231
+ * Retry without relayer configuration to submit direct transaction.
31232
+ * @throws {SignatureError} When user rejects the signature request
31233
+ * @throws {BlockchainError} When server files and permissions addition fails
31234
+ * @throws {NetworkError} When network communication fails.
31235
+ * Check network connection or configure alternative gateways.
31236
+ *
31237
+ * @example
31238
+ * ```typescript
31239
+ * const result = await vana.permissions.submitAddServerFilesAndPermissions({
31240
+ * granteeId: BigInt(1),
31241
+ * grant: "ipfs://QmXxx...",
31242
+ * fileUrls: ["https://storage.example.com/data.json"],
31243
+ * schemaIds: [123], // LinkedIn profile schema ID
31244
+ * serverAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
31245
+ * serverUrl: "https://server.example.com",
31246
+ * serverPublicKey: serverInfo.public_key,
31247
+ * filePermissions: [[{
31248
+ * account: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
31249
+ * key: encryptedKey
31250
+ * }]]
31251
+ * });
31252
+ * const events = await result.waitForEvents();
31253
+ * console.log(`Permission ID: ${events.permissionId}`);
31254
+ * ```
31255
+ */
31256
+ submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
31257
+ /**
31258
+ * Submits an already-signed add server files and permissions transaction to the blockchain.
31259
+ *
31260
+ * @remarks
31261
+ * This method returns a TransactionHandle that provides immediate access to the transaction hash
31262
+ * while allowing lazy-loaded access to parsed event data. Use `waitForEvents()` to retrieve
31263
+ * the permission ID and other event details after transaction confirmation.
31264
+ *
31265
+ * @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
31266
+ * @param signature - The user's signature
31267
+ * @returns TransactionHandle with immediate hash access and optional event parsing
31268
+ * @throws {RelayerError} When gasless transaction submission fails
31269
+ * @throws {BlockchainError} When server files and permissions addition fails
31270
+ * @throws {NetworkError} When network communication fails
31271
+ *
31272
+ * @example
31273
+ * ```typescript
31274
+ * const tx = await vana.permissions.submitSignedAddServerFilesAndPermissions(
31275
+ * typedData,
31276
+ * signature
31277
+ * );
31278
+ * console.log(`Transaction submitted: ${tx.hash}`);
31279
+ *
31280
+ * // Wait for confirmation and get the permission ID
31281
+ * const { permissionId } = await tx.waitForEvents();
31282
+ * console.log(`Permission created with ID: ${permissionId}`);
31283
+ * ```
30774
31284
  */
30775
- submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<Hash>;
31285
+ submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
30776
31286
  /**
30777
31287
  * Submit permission revocation with signature to the blockchain
30778
31288
  *
30779
31289
  * @param permissionId - Permission ID to revoke
30780
31290
  * @returns Promise resolving to transaction hash
30781
31291
  */
30782
- submitRevokePermission(permissionId: bigint): Promise<Hash>;
31292
+ submitRevokePermission(permissionId: bigint): Promise<TransactionHandle<PermissionRevokeResult>>;
31293
+ /**
31294
+ * Submits a signed add permission transaction directly to the blockchain.
31295
+ *
31296
+ * @param typedData - The typed data structure for the permission addition
31297
+ * @param signature - The cryptographic signature authorizing the transaction
31298
+ * @returns Promise resolving to the transaction hash
31299
+ */
31300
+ private submitDirectAddPermissionTransaction;
31301
+ /**
31302
+ * Submits a signed add server files and permissions transaction directly to the blockchain.
31303
+ *
31304
+ * @param typedData - The typed data structure for the server files and permissions addition
31305
+ * @param signature - The cryptographic signature authorizing the transaction
31306
+ * @returns Promise resolving to the transaction hash
31307
+ */
31308
+ private submitDirectAddServerFilesAndPermissionsTransaction;
30783
31309
  }
30784
31310
 
30785
31311
  /**
@@ -30905,33 +31431,52 @@ declare class SchemaController {
30905
31431
  * Retrieves a schema by its ID.
30906
31432
  *
30907
31433
  * @param schemaId - The ID of the schema to retrieve
31434
+ * @param options - Optional parameters
31435
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
30908
31436
  * @returns Promise resolving to the schema object
30909
31437
  * @throws {Error} When the schema is not found or chain is unavailable
30910
31438
  * @example
30911
31439
  * ```typescript
30912
31440
  * const schema = await vana.schemas.get(1);
30913
31441
  * console.log(`Schema: ${schema.name} (${schema.type})`);
31442
+ *
31443
+ * // With custom subgraph
31444
+ * const schema = await vana.schemas.get(1, {
31445
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
31446
+ * });
30914
31447
  * ```
30915
31448
  */
30916
- get(schemaId: number): Promise<Schema>;
31449
+ get(schemaId: number, options?: {
31450
+ subgraphUrl?: string;
31451
+ }): Promise<Schema>;
30917
31452
  /**
30918
31453
  * Gets the total number of schemas registered on the network.
30919
31454
  *
31455
+ * @param options - Optional parameters
31456
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
30920
31457
  * @returns Promise resolving to the total schema count
30921
31458
  * @throws {Error} When the count cannot be retrieved
30922
31459
  * @example
30923
31460
  * ```typescript
30924
31461
  * const count = await vana.schemas.count();
30925
31462
  * console.log(`Total schemas: ${count}`);
31463
+ *
31464
+ * // With custom subgraph
31465
+ * const count = await vana.schemas.count({
31466
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
31467
+ * });
30926
31468
  * ```
30927
31469
  */
30928
- count(): Promise<number>;
31470
+ count(options?: {
31471
+ subgraphUrl?: string;
31472
+ }): Promise<number>;
30929
31473
  /**
30930
31474
  * Lists all schemas with pagination.
30931
31475
  *
30932
31476
  * @param options - Optional parameters for listing schemas
30933
31477
  * @param options.limit - Maximum number of schemas to return
30934
31478
  * @param options.offset - Number of schemas to skip
31479
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
30935
31480
  * @returns Promise resolving to an array of schemas
30936
31481
  * @example
30937
31482
  * ```typescript
@@ -30940,11 +31485,19 @@ declare class SchemaController {
30940
31485
  *
30941
31486
  * // Get schemas with pagination
30942
31487
  * const schemas = await vana.schemas.list({ limit: 10, offset: 0 });
31488
+ *
31489
+ * // With custom subgraph
31490
+ * const schemas = await vana.schemas.list({
31491
+ * limit: 10,
31492
+ * offset: 0,
31493
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
31494
+ * });
30943
31495
  * ```
30944
31496
  */
30945
31497
  list(options?: {
30946
31498
  limit?: number;
30947
31499
  offset?: number;
31500
+ subgraphUrl?: string;
30948
31501
  }): Promise<Schema[]>;
30949
31502
  /**
30950
31503
  * Adds a schema using the legacy method (low-level API).
@@ -30954,6 +31507,36 @@ declare class SchemaController {
30954
31507
  * @returns Promise resolving to the add schema result
30955
31508
  */
30956
31509
  addSchema(params: AddSchemaParams): Promise<AddSchemaResult>;
31510
+ /**
31511
+ * Internal method: Query schema via subgraph
31512
+ *
31513
+ * @param params - Query parameters
31514
+ * @param params.schemaId - The ID of the schema to retrieve
31515
+ * @param params.subgraphUrl - The subgraph URL to query
31516
+ * @returns Promise resolving to the schema object
31517
+ * @private
31518
+ */
31519
+ private _getSchemaViaSubgraph;
31520
+ /**
31521
+ * Internal method: List schemas via subgraph
31522
+ *
31523
+ * @param params - Query parameters
31524
+ * @param params.limit - Maximum number of schemas to return
31525
+ * @param params.offset - Number of schemas to skip
31526
+ * @param params.subgraphUrl - The subgraph URL to query
31527
+ * @returns Promise resolving to an array of schemas
31528
+ * @private
31529
+ */
31530
+ private _listSchemasViaSubgraph;
31531
+ /**
31532
+ * Internal method: Count schemas via subgraph
31533
+ *
31534
+ * @param params - Query parameters
31535
+ * @param params.subgraphUrl - The subgraph URL to query
31536
+ * @returns Promise resolving to the total schema count
31537
+ * @private
31538
+ */
31539
+ private _countSchemasViaSubgraph;
30957
31540
  /**
30958
31541
  * Gets the user's wallet address.
30959
31542
  *
@@ -33602,19 +34185,18 @@ declare class DataController {
33602
34185
  subgraphUrl?: string;
33603
34186
  }): Promise<UserFile$1[]>;
33604
34187
  /**
33605
- * Retrieves a list of permissions granted by a user using the new subgraph entities.
34188
+ * Retrieves a list of permissions granted by a user.
33606
34189
  *
33607
- * This method queries the Vana subgraph to find permissions directly granted by the user
33608
- * using the new Permission entity. It efficiently handles millions of permissions by:
33609
- * 1. Querying the subgraph for user's directly granted permissions
33610
- * 2. Returning complete permission information from subgraph
33611
- * 3. No need for additional contract calls as all data comes from subgraph
34190
+ * This method supports automatic fallback between subgraph and RPC modes:
34191
+ * - If subgraph URL is available, tries subgraph query first
34192
+ * - Falls back to direct contract queries via RPC if subgraph fails
34193
+ * - RPC mode uses gasAwareMulticall for efficient batch queries
33612
34194
  *
33613
34195
  * @param params - Object containing the user address and optional subgraph URL
33614
34196
  * @param params.user - The wallet address of the user to query permissions for
33615
34197
  * @param params.subgraphUrl - Optional subgraph URL to override the default
33616
34198
  * @returns Promise resolving to an array of permission objects
33617
- * @throws Error if subgraph is unavailable or returns invalid data
34199
+ * @throws Error if both subgraph and RPC queries fail
33618
34200
  */
33619
34201
  getUserPermissions(params: {
33620
34202
  user: Address;
@@ -33630,43 +34212,59 @@ declare class DataController {
33630
34212
  user: Address;
33631
34213
  }>>;
33632
34214
  /**
33633
- * Retrieves a list of trusted servers for a user using the new subgraph entities.
34215
+ * Internal method: Query user permissions via subgraph
33634
34216
  *
33635
- * This method queries the Vana subgraph to find trusted servers directly associated with the user
33636
- * with support for both subgraph and direct RPC queries.
34217
+ * @param params - Query parameters object
34218
+ * @param params.user - The user address to query permissions for
34219
+ * @param params.subgraphUrl - The subgraph URL endpoint to query
34220
+ * @returns Promise resolving to an array of permission objects
34221
+ */
34222
+ private _getUserPermissionsViaSubgraph;
34223
+ /**
34224
+ * Internal method: Query user permissions via direct RPC
33637
34225
  *
33638
- * This method supports multiple query modes:
33639
- * - 'subgraph': Fast query via subgraph (requires subgraphUrl)
33640
- * - 'rpc': Direct contract queries (slower but no external dependencies)
33641
- * - 'auto': Try subgraph first, fallback to RPC if unavailable
34226
+ * @param params - Query parameters object
34227
+ * @param params.user - The user address to query permissions for
34228
+ * @returns Promise resolving to an array of permission objects
34229
+ */
34230
+ private _getUserPermissionsViaRpc;
34231
+ /**
34232
+ * Retrieves a list of trusted servers for a user.
34233
+ *
34234
+ * This method supports automatic fallback between subgraph and RPC modes:
34235
+ * - If subgraph URL is available, tries subgraph query first for fast results
34236
+ * - Falls back to direct contract queries via RPC if subgraph fails
34237
+ * - RPC mode uses gasAwareMulticall for efficient batch queries
33642
34238
  *
33643
- * @param params - Query parameters including user address and mode selection
33644
- * @returns Promise resolving to trusted servers with metadata about the query
33645
- * @throws Error if query fails in both modes (when using 'auto')
34239
+ * @param params - Query parameters including user address and optional pagination
34240
+ * @param params.user - The wallet address of the user to query trusted servers for
34241
+ * @param params.subgraphUrl - Optional subgraph URL to override the default
34242
+ * @param params.limit - Maximum number of results to return (default: 50)
34243
+ * @param params.offset - Number of results to skip for pagination (default: 0)
34244
+ * @returns Promise resolving to an array of trusted server objects
34245
+ * @throws Error if both subgraph and RPC queries fail
33646
34246
  * @example
33647
34247
  * ```typescript
33648
- * // Use subgraph for fast queries
33649
- * const result = await vana.data.getUserTrustedServers({
33650
- * user: '0x...',
33651
- * mode: 'subgraph',
33652
- * subgraphUrl: 'https://...'
34248
+ * // Basic usage with automatic fallback
34249
+ * const servers = await vana.data.getUserTrustedServers({
34250
+ * user: '0x...'
33653
34251
  * });
33654
34252
  *
33655
- * // Use direct RPC (no external dependencies)
33656
- * const result = await vana.data.getUserTrustedServers({
34253
+ * // With pagination
34254
+ * const servers = await vana.data.getUserTrustedServers({
33657
34255
  * user: '0x...',
33658
- * mode: 'rpc',
33659
- * limit: 10
34256
+ * limit: 10,
34257
+ * offset: 20
33660
34258
  * });
33661
34259
  *
33662
- * // Auto-fallback mode
33663
- * const result = await vana.data.getUserTrustedServers({
34260
+ * // With custom subgraph URL
34261
+ * const servers = await vana.data.getUserTrustedServers({
33664
34262
  * user: '0x...',
33665
- * mode: 'auto' // tries subgraph first, falls back to RPC
34263
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
33666
34264
  * });
33667
34265
  * ```
33668
34266
  */
33669
- getUserTrustedServers(params: GetUserTrustedServersParams): Promise<GetUserTrustedServersResult>;
34267
+ getUserTrustedServers(params: GetUserTrustedServersParams): Promise<TrustedServer[]>;
33670
34268
  /**
33671
34269
  * Internal method: Query trusted servers via subgraph
33672
34270
  *
@@ -33731,75 +34329,28 @@ declare class DataController {
33731
34329
  * for specific files by ID.
33732
34330
  */
33733
34331
  getFileById(fileId: number): Promise<UserFile$1>;
33734
- /**
33735
- * Uploads an encrypted file to storage and registers it on the blockchain.
33736
- *
33737
- * @deprecated Since v2.0.0 - Use vana.data.upload() instead for the high-level API with automatic encryption
33738
- *
33739
- * Migration guide:
33740
- * ```typescript
33741
- * // Old way (deprecated):
33742
- * const encrypted = await encryptBlob(data, key);
33743
- * const result = await vana.data.uploadEncryptedFile(encrypted, filename);
33744
- *
33745
- * // New way:
33746
- * const result = await vana.data.upload({
33747
- * content: data,
33748
- * filename: filename,
33749
- * encrypt: true // Handles encryption automatically
33750
- * });
33751
- * ```
33752
- * @param encryptedFile - The encrypted file blob to upload
33753
- * @param filename - Optional filename for the upload
33754
- * @param providerName - Optional storage provider to use
33755
- * @returns Promise resolving to upload result with file ID and storage URL
33756
- *
33757
- * This method handles the complete flow of:
33758
- * 1. Uploading the encrypted file to the specified storage provider
33759
- * 2. Registering the file URL on the DataRegistry contract via relayer
33760
- * 3. Returning the assigned file ID and storage URL
33761
- */
33762
- uploadEncryptedFile(encryptedFile: Blob, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
33763
- /**
33764
- * Uploads an encrypted file to storage and registers it on the blockchain with a schema.
33765
- *
33766
- * @deprecated Since v2.0.0 - Use vana.data.upload() instead for the high-level API with automatic encryption and schema validation
33767
- *
33768
- * Migration guide:
33769
- * ```typescript
33770
- * // Old way (deprecated):
33771
- * const encrypted = await encryptBlob(data, key);
33772
- * const result = await vana.data.uploadEncryptedFileWithSchema(encrypted, schemaId, filename);
33773
- *
33774
- * // New way:
33775
- * const result = await vana.data.upload({
33776
- * content: data,
33777
- * filename: filename,
33778
- * schemaId: schemaId, // Automatic validation
33779
- * encrypt: true
33780
- * });
33781
- * ```
33782
- * @param encryptedFile - The encrypted file blob to upload
33783
- * @param schemaId - The schema ID to associate with the file
33784
- * @param filename - Optional filename for the upload
33785
- * @param providerName - Optional storage provider to use
33786
- * @returns Promise resolving to upload result with file ID and storage URL
33787
- *
33788
- * This method handles the complete flow of:
33789
- * 1. Uploading the encrypted file to the specified storage provider
33790
- * 2. Registering the file URL on the DataRegistry contract with a schema ID
33791
- * 3. Returning the assigned file ID and storage URL
33792
- */
33793
- uploadEncryptedFileWithSchema(encryptedFile: Blob, schemaId: number, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
33794
34332
  /**
33795
34333
  * Registers a file URL directly on the blockchain with a schema ID.
33796
34334
  *
33797
- * @param url - The URL of the file to register
34335
+ * @remarks
34336
+ * This method registers an existing file URL on the DataRegistry contract
34337
+ * with a schema ID, without uploading any data. Useful when you have already
34338
+ * uploaded content to storage and just need to register it on-chain.
34339
+ *
34340
+ * @param url - The URL of the file to register (IPFS or HTTP/HTTPS)
33798
34341
  * @param schemaId - The schema ID to associate with the file
33799
34342
  * @returns Promise resolving to the file ID and transaction hash
33800
- *
33801
- * This method registers an existing file URL on the DataRegistry
33802
- * contract with a schema ID, without uploading any data.
34343
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34344
+ * @throws {Error} When wallet address is unavailable - "No addresses available"
34345
+ * @throws {Error} When transaction fails - "Failed to register file with schema"
34346
+ * @example
34347
+ * ```typescript
34348
+ * const { fileId, transactionHash } = await vana.data.registerFileWithSchema(
34349
+ * "ipfs://QmXxx...",
34350
+ * 1
34351
+ * );
34352
+ * console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
34353
+ * ```
33803
34354
  */
33804
34355
  registerFileWithSchema(url: string, schemaId: number): Promise<{
33805
34356
  fileId: number;
@@ -33857,95 +34408,114 @@ declare class DataController {
33857
34408
  transactionHash: string;
33858
34409
  }>;
33859
34410
  /**
33860
- * Adds a new schema to the DataRefinerRegistry.
33861
- *
33862
- * @deprecated Since v2.0.0 - Use vana.schemas.create() instead for the high-level API with automatic IPFS upload
34411
+ * Adds a new refiner to the DataRefinerRegistry.
33863
34412
  *
33864
- * Migration guide:
34413
+ * @remarks
34414
+ * Refiners are data processing templates that define how raw data should be
34415
+ * transformed into structured formats. Each refiner is associated with a DLP
34416
+ * (Data Liquidity Pool), has a specific schema for output, and includes
34417
+ * instructions for the refinement process.
34418
+ *
34419
+ * @param params - Refiner configuration parameters
34420
+ * @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
34421
+ * @param params.name - Human-readable name for the refiner
34422
+ * @param params.schemaId - Schema ID that defines the output format
34423
+ * @param params.refinementInstructionUrl - URL containing processing instructions
34424
+ * @returns Promise resolving to the new refiner ID and transaction hash
34425
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34426
+ * @throws {Error} When transaction fails - "Failed to add refiner: {error}"
34427
+ * @example
33865
34428
  * ```typescript
33866
- * // Old way (deprecated):
33867
- * const result = await vana.data.addSchema({
33868
- * name: "UserProfile",
33869
- * type: "JSON",
33870
- * definitionUrl: "ipfs://..."
33871
- * });
33872
- *
33873
- * // New way:
33874
- * const result = await vana.schemas.create({
33875
- * name: "UserProfile",
33876
- * type: "JSON",
33877
- * definition: schemaObject // Automatically uploads to IPFS
34429
+ * const result = await vana.data.addRefiner({
34430
+ * dlpId: 1,
34431
+ * name: "Social Media Sentiment Analyzer",
34432
+ * schemaId: 42,
34433
+ * refinementInstructionUrl: "ipfs://QmXxx..."
33878
34434
  * });
34435
+ * console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
33879
34436
  * ```
33880
- * @param params - Schema parameters including name, type, and definition URL
33881
- * @returns Promise resolving to the new schema ID and transaction hash
33882
34437
  */
33883
- addSchema(params: AddSchemaParams): Promise<AddSchemaResult>;
34438
+ addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
33884
34439
  /**
33885
- * Retrieves a schema by its ID.
34440
+ * Retrieves a refiner by its ID.
33886
34441
  *
33887
- * @deprecated Since v2.0.0 - Use vana.schemas.get() instead
34442
+ * @remarks
34443
+ * Queries the DataRefinerRegistry contract to get complete information about
34444
+ * a specific refiner including its DLP association, schema, and instructions.
33888
34445
  *
33889
- * Migration guide:
34446
+ * @param refinerId - The numeric refiner ID to retrieve
34447
+ * @returns Promise resolving to the refiner information object
34448
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34449
+ * @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
34450
+ * @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
34451
+ * @example
33890
34452
  * ```typescript
33891
- * // Old way (deprecated):
33892
- * const schema = await vana.data.getSchema(schemaId);
33893
- *
33894
- * // New way:
33895
- * const schema = await vana.schemas.get(schemaId);
34453
+ * const refiner = await vana.data.getRefiner(1);
34454
+ * console.log({
34455
+ * name: refiner.name,
34456
+ * dlp: refiner.dlpId,
34457
+ * schema: refiner.schemaId,
34458
+ * instructions: refiner.refinementInstructionUrl
34459
+ * });
33896
34460
  * ```
33897
- * @param schemaId - The schema ID to retrieve
33898
- * @returns Promise resolving to the schema information
33899
34461
  */
33900
- getSchema(schemaId: number): Promise<Schema>;
34462
+ getRefiner(refinerId: number): Promise<Refiner>;
33901
34463
  /**
33902
- * Gets the total number of schemas in the registry.
34464
+ * Validates if a schema ID exists in the registry.
33903
34465
  *
33904
- * @deprecated Since v2.0.0 - Use vana.schemas.count() instead
34466
+ * @remarks
34467
+ * Checks the DataRefinerRegistry contract to determine if a given schema ID
34468
+ * has been registered and is available for use.
33905
34469
  *
33906
- * Migration guide:
34470
+ * @param schemaId - The numeric schema ID to validate
34471
+ * @returns Promise resolving to true if schema exists, false otherwise
34472
+ * @example
33907
34473
  * ```typescript
33908
- * // Old way (deprecated):
33909
- * const count = await vana.data.getSchemasCount();
33910
- *
33911
- * // New way:
33912
- * const count = await vana.schemas.count();
34474
+ * const isValid = await vana.data.isValidSchemaId(42);
34475
+ * if (isValid) {
34476
+ * console.log('Schema 42 is available for use');
34477
+ * } else {
34478
+ * console.log('Schema 42 does not exist');
34479
+ * }
33913
34480
  * ```
33914
- * @returns Promise resolving to the total schema count
33915
- */
33916
- getSchemasCount(): Promise<number>;
33917
- /**
33918
- * Adds a new refiner to the DataRefinerRegistry.
33919
- *
33920
- * @param params - Refiner parameters including DLP ID, name, schema ID, and instruction URL
33921
- * @returns Promise resolving to the new refiner ID and transaction hash
33922
- */
33923
- addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
33924
- /**
33925
- * Retrieves a refiner by its ID.
33926
- *
33927
- * @param refinerId - The refiner ID to retrieve
33928
- * @returns Promise resolving to the refiner information
33929
- */
33930
- getRefiner(refinerId: number): Promise<Refiner>;
33931
- /**
33932
- * Validates if a schema ID exists in the registry.
33933
- *
33934
- * @param schemaId - The schema ID to validate
33935
- * @returns Promise resolving to boolean indicating if the schema ID is valid
33936
34481
  */
33937
34482
  isValidSchemaId(schemaId: number): Promise<boolean>;
33938
34483
  /**
33939
34484
  * Gets the total number of refiners in the registry.
33940
34485
  *
34486
+ * @remarks
34487
+ * Queries the DataRefinerRegistry contract to get the total count of all
34488
+ * registered refiners across all DLPs.
34489
+ *
33941
34490
  * @returns Promise resolving to the total refiner count
34491
+ * @example
34492
+ * ```typescript
34493
+ * const count = await vana.data.getRefinersCount();
34494
+ * console.log(`Total refiners registered: ${count}`);
34495
+ * ```
33942
34496
  */
33943
34497
  getRefinersCount(): Promise<number>;
33944
34498
  /**
33945
34499
  * Updates the schema ID for an existing refiner.
33946
34500
  *
33947
- * @param params - Parameters including refiner ID and new schema ID
34501
+ * @remarks
34502
+ * Allows the owner of a refiner to update its associated schema ID.
34503
+ * This is useful when refiner output format needs to change.
34504
+ *
34505
+ * @param params - Update parameters
34506
+ * @param params.refinerId - The refiner ID to update
34507
+ * @param params.newSchemaId - The new schema ID to set
33948
34508
  * @returns Promise resolving to the transaction hash
34509
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34510
+ * @throws {Error} When transaction fails - "Failed to update schema ID: {error}"
34511
+ * @example
34512
+ * ```typescript
34513
+ * const result = await vana.data.updateSchemaId({
34514
+ * refinerId: 1,
34515
+ * newSchemaId: 55
34516
+ * });
34517
+ * console.log(`Schema updated in tx ${result.transactionHash}`);
34518
+ * ```
33949
34519
  */
33950
34520
  updateSchemaId(params: UpdateSchemaIdParams): Promise<UpdateSchemaIdResult>;
33951
34521
  /**
@@ -33967,6 +34537,17 @@ declare class DataController {
33967
34537
  account: Address;
33968
34538
  publicKey: string;
33969
34539
  }>, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
34540
+ /**
34541
+ * Uploads content to storage without registering it on the blockchain.
34542
+ * This method only handles the storage upload and returns the file URL.
34543
+ *
34544
+ * @param content - The content to upload (string, Blob, Buffer, or object - objects will be JSON stringified)
34545
+ * @param filename - Optional filename for the uploaded file (defaults to timestamp-based name)
34546
+ * @param encrypt - Optional flag to encrypt the content before upload
34547
+ * @param providerName - Optional specific storage provider to use
34548
+ * @returns Promise resolving to the storage upload result with url, size, and contentType
34549
+ */
34550
+ uploadToStorage(content: string | Blob | Buffer | object, filename?: string, encrypt?: boolean, providerName?: string): Promise<StorageUploadResult>;
33970
34551
  /**
33971
34552
  * Adds a permission for a party to access an existing file.
33972
34553
  *
@@ -33993,7 +34574,7 @@ declare class DataController {
33993
34574
  * console.log(`Transaction: ${result.transactionHash}`);
33994
34575
  * ```
33995
34576
  */
33996
- addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<FilePermissionResult>;
34577
+ addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
33997
34578
  /**
33998
34579
  * Submits a file permission transaction and returns the transaction hash immediately.
33999
34580
  *
@@ -34010,7 +34591,7 @@ declare class DataController {
34010
34591
  * console.log(`Transaction submitted: ${txHash}`);
34011
34592
  * ```
34012
34593
  */
34013
- submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<Hash>;
34594
+ submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
34014
34595
  /**
34015
34596
  * Gets the encrypted key for a specific account's permission to access a file.
34016
34597
  *
@@ -34397,6 +34978,31 @@ interface Chains {
34397
34978
  }
34398
34979
  declare const chains: Chains;
34399
34980
 
34981
+ /**
34982
+ * Creates or retrieves a cached public client for blockchain read operations.
34983
+ *
34984
+ * @remarks
34985
+ * This function provides an optimized way to access blockchain data by maintaining
34986
+ * a cached client instance per chain. The client is used for reading contract state,
34987
+ * querying events, and other read-only blockchain operations. It automatically
34988
+ * handles HTTP transport configuration and chain switching.
34989
+ *
34990
+ * @param chainId - The chain ID to connect to (defaults to Moksha testnet)
34991
+ * @returns A public client configured for the specified chain with caching optimization
34992
+ * @throws {Error} When the specified chain ID is not supported by the SDK
34993
+ * @example
34994
+ * ```typescript
34995
+ * // Get client for default chain (Moksha testnet)
34996
+ * const client = createClient();
34997
+ *
34998
+ * // Get client for specific chain
34999
+ * const mainnetClient = createClient(14800);
35000
+ *
35001
+ * // Use client for blockchain reads
35002
+ * const blockNumber = await client.getBlockNumber();
35003
+ * ```
35004
+ * @category Blockchain
35005
+ */
34400
35006
  declare const createClient: (chainId?: keyof typeof chains) => PublicClient & {
34401
35007
  chain: Chain;
34402
35008
  };
@@ -35115,51 +35721,157 @@ declare class SerializationError extends VanaError {
35115
35721
  constructor(message: string);
35116
35722
  }
35117
35723
  /**
35118
- * Error thrown when a signature operation fails.
35724
+ * Thrown when a signature operation fails or cannot be completed.
35119
35725
  *
35120
35726
  * @remarks
35121
- * Recovery strategies: Check wallet connection and account unlock status,
35122
- * retry operation with explicit user interaction, or for gasless operations
35123
- * consider switching to direct transactions.
35727
+ * This error occurs when wallet signature operations fail due to disconnection,
35728
+ * locked accounts, or other wallet-related issues. It preserves the original
35729
+ * error for debugging while providing consistent error handling across the SDK.
35730
+ *
35731
+ * Recovery strategies:
35732
+ * - Check wallet connection and account unlock status
35733
+ * - Retry operation with explicit user interaction
35734
+ * - For gasless operations, consider switching to direct transactions
35735
+ *
35736
+ * @example
35737
+ * ```typescript
35738
+ * try {
35739
+ * await vana.permissions.grant({ grantee: '0x...' });
35740
+ * } catch (error) {
35741
+ * if (error instanceof SignatureError) {
35742
+ * // Prompt user to unlock wallet
35743
+ * await promptWalletUnlock();
35744
+ * // Retry operation
35745
+ * }
35746
+ * }
35747
+ * ```
35748
+ * @category Error Handling
35124
35749
  */
35125
35750
  declare class SignatureError extends VanaError {
35126
35751
  readonly originalError?: Error | undefined;
35127
35752
  constructor(message: string, originalError?: Error | undefined);
35128
35753
  }
35129
35754
  /**
35130
- * Error thrown when a network operation fails.
35755
+ * Thrown when network communication fails during API calls or blockchain interactions.
35131
35756
  *
35132
35757
  * @remarks
35133
- * Recovery strategies: Check network connectivity, retry with exponential backoff,
35134
- * verify API endpoints are accessible, or switch to alternative network providers.
35758
+ * This error encompasses network connectivity issues, API unavailability,
35759
+ * timeout errors, and CORS restrictions. It's commonly encountered during
35760
+ * IPFS operations, subgraph queries, or RPC calls.
35761
+ *
35762
+ * Recovery strategies:
35763
+ * - Check network connectivity
35764
+ * - Retry with exponential backoff
35765
+ * - Verify API endpoints are accessible
35766
+ * - Switch to alternative network providers or gateways
35767
+ *
35768
+ * @example
35769
+ * ```typescript
35770
+ * try {
35771
+ * const files = await vana.data.getUserFiles({ owner: '0x...' });
35772
+ * } catch (error) {
35773
+ * if (error instanceof NetworkError) {
35774
+ * // Implement retry with exponential backoff
35775
+ * await retryWithBackoff(() => vana.data.getUserFiles({ owner: '0x...' }));
35776
+ * }
35777
+ * }
35778
+ * ```
35779
+ * @category Error Handling
35135
35780
  */
35136
35781
  declare class NetworkError extends VanaError {
35137
35782
  readonly originalError?: Error | undefined;
35138
35783
  constructor(message: string, originalError?: Error | undefined);
35139
35784
  }
35140
35785
  /**
35141
- * Error thrown when the nonce retrieval fails.
35786
+ * Thrown when transaction nonce retrieval fails during gasless operations.
35142
35787
  *
35143
35788
  * @remarks
35144
- * Recovery strategies: Retry nonce retrieval after brief delay, check wallet connection
35145
- * and account status, or use manual nonce specification if supported by the operation.
35789
+ * This error occurs when the SDK cannot retrieve the user's current nonce from
35790
+ * smart contracts, preventing gasless transaction submission. Nonces are critical
35791
+ * for preventing replay attacks in signed transactions.
35792
+ *
35793
+ * Recovery strategies:
35794
+ * - Retry nonce retrieval after brief delay
35795
+ * - Check wallet connection and account status
35796
+ * - Use manual nonce specification if supported by the operation
35797
+ * - Switch to direct transactions as fallback
35798
+ *
35799
+ * @example
35800
+ * ```typescript
35801
+ * try {
35802
+ * await vana.permissions.grant({ grantee: '0x...' });
35803
+ * } catch (error) {
35804
+ * if (error instanceof NonceError) {
35805
+ * // Wait and retry
35806
+ * await delay(1000);
35807
+ * await vana.permissions.grant({ grantee: '0x...' });
35808
+ * }
35809
+ * }
35810
+ * ```
35811
+ * @category Error Handling
35146
35812
  */
35147
35813
  declare class NonceError extends VanaError {
35148
35814
  constructor(message: string);
35149
35815
  }
35150
35816
  /**
35151
- * Error thrown when a personal server operation fails.
35817
+ * Thrown when personal server operations fail or cannot be completed.
35152
35818
  *
35153
35819
  * @remarks
35154
- * Recovery strategies: Verify server URL accessibility, check server trust status via
35155
- * `vana.permissions.getUserTrustedServers()`, or retry after server becomes available.
35820
+ * This error occurs during interactions with personal servers for computation
35821
+ * requests, identity retrieval, or operation status checks. Common causes include
35822
+ * server unavailability, untrusted server status, or invalid permission grants.
35823
+ *
35824
+ * Recovery strategies:
35825
+ * - Verify server URL accessibility
35826
+ * - Check server trust status via `vana.permissions.getTrustedServers()`
35827
+ * - Ensure valid permissions exist for the operation
35828
+ * - Retry after server becomes available
35829
+ *
35830
+ * @example
35831
+ * ```typescript
35832
+ * try {
35833
+ * const result = await vana.server.createOperation({ permissionId: 123 });
35834
+ * } catch (error) {
35835
+ * if (error instanceof PersonalServerError) {
35836
+ * // Check if server is trusted
35837
+ * const trustedServers = await vana.permissions.getTrustedServers();
35838
+ * if (!trustedServers.includes(serverId)) {
35839
+ * await vana.permissions.trustServer({ serverId });
35840
+ * }
35841
+ * }
35842
+ * }
35843
+ * ```
35844
+ * @category Error Handling
35156
35845
  */
35157
35846
  declare class PersonalServerError extends VanaError {
35158
35847
  readonly originalError?: Error | undefined;
35159
35848
  constructor(message: string, originalError?: Error | undefined);
35160
35849
  }
35161
35850
  /**
35162
- * Error thrown when trying to register a server with a URL that doesn't match the existing registration.
35851
+ * Thrown when attempting to register a server with a URL different from its existing registration.
35852
+ *
35853
+ * @remarks
35854
+ * This error occurs when trying to add or trust a server that's already registered
35855
+ * on-chain with a different URL. Server URLs are immutable once registered to
35856
+ * maintain consistency and security. Applications should use the existing URL
35857
+ * or register a new server with a different ID.
35858
+ *
35859
+ * @example
35860
+ * ```typescript
35861
+ * try {
35862
+ * await vana.permissions.addAndTrustServer({
35863
+ * serverId: 1,
35864
+ * serverUrl: 'https://new-url.com',
35865
+ * publicKey: '0x...'
35866
+ * });
35867
+ * } catch (error) {
35868
+ * if (error instanceof ServerUrlMismatchError) {
35869
+ * console.log(`Server already registered with: ${error.existingUrl}`);
35870
+ * // Use existing URL or register new server
35871
+ * }
35872
+ * }
35873
+ * ```
35874
+ * @category Error Handling
35163
35875
  */
35164
35876
  declare class ServerUrlMismatchError extends VanaError {
35165
35877
  constructor(existingUrl: string, providedUrl: string, serverId: string);
@@ -35168,7 +35880,25 @@ declare class ServerUrlMismatchError extends VanaError {
35168
35880
  readonly serverId: string;
35169
35881
  }
35170
35882
  /**
35171
- * Error thrown when a permission operation fails.
35883
+ * Thrown when permission grant, revoke, or validation operations fail.
35884
+ *
35885
+ * @remarks
35886
+ * This error occurs during permission management operations including grants,
35887
+ * revocations, and permission validation checks. Common causes include invalid
35888
+ * grantee addresses, expired permissions, or insufficient privileges.
35889
+ *
35890
+ * @example
35891
+ * ```typescript
35892
+ * try {
35893
+ * await vana.permissions.revoke({ permissionId: 999999 });
35894
+ * } catch (error) {
35895
+ * if (error instanceof PermissionError) {
35896
+ * console.error('Permission operation failed:', error.message);
35897
+ * // Permission may not exist or user may not be owner
35898
+ * }
35899
+ * }
35900
+ * ```
35901
+ * @category Error Handling
35172
35902
  */
35173
35903
  declare class PermissionError extends VanaError {
35174
35904
  readonly originalError?: Error | undefined;
@@ -36176,21 +36906,53 @@ declare function withSignatureCache(cache: VanaCacheAdapter, walletAddress: stri
36176
36906
 
36177
36907
  declare const CONTRACT_ADDRESSES: Record<number, Record<string, string>>;
36178
36908
  /**
36179
- * Retrieves the deployed contract address for a specific contract on a given chain.
36909
+ * Retrieves the deployed contract address for a specific Vana protocol contract on a given chain.
36180
36910
  *
36181
- * @param chainId - The chain ID to look up the contract on
36182
- * @param contract - The contract name to get the address for
36183
- * @returns The contract address as a hex string
36184
- * @throws {Error} When contract address not found for the specified contract and chain
36911
+ * @remarks
36912
+ * This function provides type-safe access to contract addresses across all supported Vana networks.
36913
+ * It automatically searches both current and legacy contract registries to ensure backwards
36914
+ * compatibility while providing clear error messages for unsupported combinations.
36915
+ *
36916
+ * The function validates that both the chain ID and contract name are supported before
36917
+ * attempting address lookup, helping developers identify deployment or configuration issues
36918
+ * early in the development process.
36919
+ *
36920
+ * **Supported Chains:**
36921
+ * - 14800: Vana Mainnet
36922
+ * - 1480: Moksha Testnet
36923
+ *
36924
+ * **Contract Categories:**
36925
+ * - Data Management: DataRegistry, DataRefinerRegistry
36926
+ * - Permissions: DataPortabilityPermissions, DataPortabilityServers, DataPortabilityGrantees
36927
+ * - Computing: TeePoolPhala, TeePoolDedicatedGpu, etc.
36928
+ * - Token & Governance: DATImplementation, VanaPoolStaking, etc.
36929
+ *
36930
+ * @param chainId - The chain ID to look up the contract on (14800 for mainnet, 1480 for testnet)
36931
+ * @param contract - The contract name to get the address for (use TypeScript autocomplete for available options)
36932
+ * @returns The contract address as a checksummed hex string (0x...)
36933
+ * @throws {Error} When contract address not found for the specified contract and chain combination.
36934
+ * This typically indicates the contract is not deployed on the requested network.
36185
36935
  * @example
36186
36936
  * ```typescript
36937
+ * // Get core protocol contract addresses
36938
+ * const dataRegistry = getContractAddress(14800, 'DataRegistry');
36939
+ * const permissions = getContractAddress(14800, 'DataPortabilityPermissions');
36940
+ * const trustedServers = getContractAddress(14800, 'DataPortabilityServers');
36941
+ *
36942
+ * // Handle unsupported combinations gracefully
36187
36943
  * try {
36188
- * const dataRegistryAddress = getContractAddress(1480, 'DataRegistry');
36189
- * console.log('DataRegistry address:', dataRegistryAddress);
36944
+ * const address = getContractAddress(1480, 'DataRegistry');
36945
+ * console.log('DataRegistry testnet address:', address);
36190
36946
  * } catch (error) {
36191
- * console.error('Contract not deployed on this chain:', error.message);
36947
+ * console.error('Contract not available on testnet:', error.message);
36948
+ * // Fallback to mainnet or show user-friendly error
36192
36949
  * }
36950
+ *
36951
+ * // TypeScript provides autocomplete for contract names
36952
+ * const poolAddress = getContractAddress(14800, 'TeePoolPhala'); // ✅ Valid
36953
+ * // const invalid = getContractAddress(14800, 'InvalidContract'); // ❌ TypeScript error
36193
36954
  * ```
36955
+ * @category Configuration
36194
36956
  */
36195
36957
  declare const getContractAddress: (chainId: keyof typeof CONTRACT_ADDRESSES, contract: VanaContract) => `0x${string}`;
36196
36958
 
@@ -36360,6 +37122,8 @@ declare class CircuitBreaker {
36360
37122
  reset(): void;
36361
37123
  }
36362
37124
 
37125
+ /** Union type of all possible transaction results from relayer operations */
37126
+ type RelayerTransactionResult = PermissionGrantResult | PermissionRevokeResult | ServerTrustResult | ServerUntrustResult | GranteeRegisterResult | FileAddedResult;
36363
37127
  /**
36364
37128
  * Payload structure for relayer requests.
36365
37129
  * Contains the EIP-712 typed data, signature, and optional expected user address for security verification.
@@ -36381,17 +37145,20 @@ interface RelayerRequestPayload {
36381
37145
  * 1. Verifies the signature against the typed data
36382
37146
  * 2. Optionally checks the signer matches the expected user address
36383
37147
  * 3. Routes to the appropriate SDK method based on primaryType
36384
- * 4. Returns the resulting transaction hash
37148
+ * 4. Returns the transaction handle with hash and event parsing capability
36385
37149
  *
36386
37150
  * Supported transaction types:
36387
37151
  * - Permission: Permission grants
36388
37152
  * - PermissionRevoke: Permission revocations
36389
37153
  * - TrustServer: Trust server operations
36390
37154
  * - UntrustServer: Untrust server operations
37155
+ * - AddServer: Add and trust server operations
37156
+ * - RegisterGrantee: Register grantee operations
37157
+ * - ServerFilesAndPermission: Batch operation for server, files, and permissions
36391
37158
  *
36392
37159
  * @param sdk - Initialized Vana SDK instance
36393
37160
  * @param payload - Request payload containing typed data, signature, and optional security check
36394
- * @returns Promise resolving to the transaction hash
37161
+ * @returns Promise resolving to TransactionHandle with hash and event parsing capability
36395
37162
  * @throws {SignatureError} When signature verification fails or signer mismatch occurs
36396
37163
  * @throws {Error} When primaryType is unsupported or SDK operations fail
36397
37164
  * @category Server
@@ -36405,15 +37172,24 @@ interface RelayerRequestPayload {
36405
37172
  * const body = await request.json();
36406
37173
  * const vana = await createRelayerVana();
36407
37174
  *
36408
- * const txHash = await handleRelayerRequest(vana, {
37175
+ * const tx = await handleRelayerRequest(vana, {
36409
37176
  * typedData: body.typedData,
36410
37177
  * signature: body.signature,
36411
37178
  * expectedUserAddress: body.expectedUserAddress
36412
37179
  * });
36413
37180
  *
37181
+ * // Option 1: Return just the hash immediately
37182
+ * return NextResponse.json({
37183
+ * success: true,
37184
+ * transactionHash: tx.hash
37185
+ * });
37186
+ *
37187
+ * // Option 2: Wait for transaction confirmation and return event data
37188
+ * const eventData = await tx.waitForEvents();
36414
37189
  * return NextResponse.json({
36415
37190
  * success: true,
36416
- * transactionHash: txHash
37191
+ * transactionHash: tx.hash,
37192
+ * ...eventData // Include parsed event data like permissionId, fileId, etc.
36417
37193
  * });
36418
37194
  * } catch (error) {
36419
37195
  * return NextResponse.json({
@@ -36424,13 +37200,14 @@ interface RelayerRequestPayload {
36424
37200
  * }
36425
37201
  * ```
36426
37202
  */
36427
- declare function handleRelayerRequest(sdk: VanaInstance, payload: RelayerRequestPayload): Promise<Hash>;
37203
+ declare function handleRelayerRequest(sdk: VanaInstance, payload: RelayerRequestPayload): Promise<TransactionHandle<RelayerTransactionResult>>;
36428
37204
 
36429
37205
  /**
36430
37206
  * Node.js implementation of the Vana Platform Adapter
36431
37207
  *
36432
- * This implementation uses Node.js-specific libraries and configurations
36433
- * to provide crypto, PGP, and HTTP functionality.
37208
+ * WARNING: Dependencies that access globals during init
37209
+ * MUST be dynamically imported to support Turbopack.
37210
+ * See: https://github.com/vercel/next.js/issues/82632
36434
37211
  */
36435
37212
 
36436
37213
  /**
@@ -36450,6 +37227,10 @@ declare class NodePlatformAdapter implements VanaPlatformAdapter {
36450
37227
  *
36451
37228
  * This implementation uses browser-compatible libraries and configurations
36452
37229
  * to provide crypto, PGP, and HTTP functionality without Node.js dependencies.
37230
+ *
37231
+ * WARNING: Dependencies that access globals during init
37232
+ * MUST be dynamically imported to support Turbopack.
37233
+ * See: https://github.com/vercel/next.js/issues/82632
36453
37234
  */
36454
37235
 
36455
37236
  /**
@@ -36838,4 +37619,4 @@ declare function Vana(config: VanaConfig): VanaNodeImpl;
36838
37619
  */
36839
37620
  type VanaInstance = VanaNodeImpl;
36840
37621
 
36841
- 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 };
37622
+ 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 };