@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,50 @@ 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
+ }
28765
28917
  /**
28766
28918
  * Result of a successful file permission addition operation.
28767
28919
  * Contains data from the FilePermissionAdded blockchain event.
@@ -28775,6 +28927,80 @@ interface FilePermissionResult extends BaseTransactionResult {
28775
28927
  encryptedKey: string;
28776
28928
  }
28777
28929
 
28930
+ /**
28931
+ * Provides a unified interface for blockchain transaction results with lazy-loaded event parsing.
28932
+ *
28933
+ * @remarks
28934
+ * TransactionHandle enables immediate access to transaction hashes while providing optional
28935
+ * lazy-loaded access to receipts and parsed event data. All transaction-submitting methods
28936
+ * in the SDK return this handle, allowing developers to choose between immediate hash access
28937
+ * or waiting for event data. Results are memoized to prevent redundant network calls.
28938
+ *
28939
+ * @category Transactions
28940
+ * @example
28941
+ * ```typescript
28942
+ * // Immediate hash access
28943
+ * const tx = await sdk.permissions.submitSignedGrant(typedData, signature);
28944
+ * console.log(`Transaction submitted: ${tx.hash}`);
28945
+ *
28946
+ * // Wait for and parse events
28947
+ * const eventData = await tx.waitForEvents();
28948
+ * console.log(`Permission ID: ${eventData.permissionId}`);
28949
+ *
28950
+ * // Check receipt for gas usage
28951
+ * const receipt = await tx.waitForReceipt();
28952
+ * console.log(`Gas used: ${receipt.gasUsed}`);
28953
+ * ```
28954
+ */
28955
+ declare class TransactionHandle<TEventData = unknown> {
28956
+ private readonly context;
28957
+ readonly hash: Hash;
28958
+ private readonly operation?;
28959
+ private _receipt?;
28960
+ private _eventData?;
28961
+ private _receiptPromise?;
28962
+ private _eventPromise?;
28963
+ constructor(context: ControllerContext$1, hash: Hash, operation?: TransactionOperation | undefined);
28964
+ /**
28965
+ * Waits for transaction confirmation and returns the receipt.
28966
+ * Results are memoized - multiple calls return the same promise.
28967
+ *
28968
+ * @param options Optional timeout configuration
28969
+ * @param options.timeout Timeout in milliseconds (default: 30000)
28970
+ * @returns Transaction receipt with gas usage, logs, and status
28971
+ */
28972
+ waitForReceipt(options?: {
28973
+ timeout?: number;
28974
+ }): Promise<TransactionReceipt$1>;
28975
+ /**
28976
+ * Waits for transaction confirmation and parses emitted events.
28977
+ * Results are memoized - multiple calls return the same promise.
28978
+ *
28979
+ * @returns Parsed event data with transaction metadata
28980
+ * @throws {Error} If no operation was specified for event parsing
28981
+ */
28982
+ waitForEvents(): Promise<TEventData>;
28983
+ /**
28984
+ * Enables string coercion for backwards compatibility.
28985
+ * Allows TransactionHandle to be used anywhere a Hash is expected.
28986
+ *
28987
+ * @example
28988
+ * ```typescript
28989
+ * const hash: Hash = tx; // Works via toString()
28990
+ * console.log(`Transaction: ${tx}`); // Prints hash
28991
+ * ```
28992
+ * @returns The transaction hash as a string
28993
+ */
28994
+ toString(): string;
28995
+ /**
28996
+ * JSON serialization support.
28997
+ * Returns the hash when serialized to JSON.
28998
+ *
28999
+ * @returns The transaction hash for JSON serialization
29000
+ */
29001
+ toJSON(): string;
29002
+ }
29003
+
28778
29004
  /**
28779
29005
  * Google Drive Storage Provider for Vana SDK
28780
29006
  *
@@ -29813,30 +30039,31 @@ declare class PermissionsController {
29813
30039
  */
29814
30040
  grant(params: GrantPermissionParams$1): Promise<PermissionGrantResult>;
29815
30041
  /**
29816
- * Submits a permission grant transaction and returns the transaction hash immediately.
30042
+ * Submits a permission grant transaction and returns a handle for flexible result access.
29817
30043
  *
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.
30044
+ * @remarks
30045
+ * This lower-level method provides maximum control over transaction timing.
30046
+ * Returns a TransactionHandle that allows immediate hash access or optional event parsing.
30047
+ * Use this when handling multiple transactions or when you need granular control.
29821
30048
  *
29822
30049
  * @param params - The permission grant configuration object
29823
- * @returns Promise that resolves to the transaction hash when successfully submitted
30050
+ * @returns Promise resolving to TransactionHandle with hash and event parsing capabilities
29824
30051
  * @throws {RelayerError} When gasless transaction submission fails
29825
30052
  * @throws {SignatureError} When user rejects the signature request
29826
30053
  * @throws {SerializationError} When grant data cannot be serialized
29827
30054
  * @throws {BlockchainError} When permission grant preparation fails
29828
30055
  * @example
29829
30056
  * ```typescript
29830
- * // Submit transaction and handle confirmation later
29831
- * const txHash = await vana.permissions.submitPermissionGrant(params);
29832
- * console.log(`Transaction submitted: ${txHash}`);
30057
+ * // Submit transaction and get immediate hash access
30058
+ * const tx = await vana.permissions.submitPermissionGrant(params);
30059
+ * console.log(`Transaction submitted: ${tx.hash}`);
29833
30060
  *
29834
- * // Later, when you need the permission data:
29835
- * const result = await parseTransactionResult(context, txHash, 'grant');
29836
- * console.log(`Permission ID: ${result.permissionId}`);
30061
+ * // Optionally wait for and parse events
30062
+ * const eventData = await tx.waitForEvents();
30063
+ * console.log(`Permission ID: ${eventData.permissionId}`);
29837
30064
  * ```
29838
30065
  */
29839
- submitPermissionGrant(params: GrantPermissionParams$1): Promise<Hash>;
30066
+ submitPermissionGrant(params: GrantPermissionParams$1): Promise<TransactionHandle<PermissionGrantResult>>;
29840
30067
  /**
29841
30068
  * Prepares a permission grant with preview before signing.
29842
30069
  *
@@ -29864,15 +30091,21 @@ declare class PermissionsController {
29864
30091
  */
29865
30092
  prepareGrant(params: GrantPermissionParams$1): Promise<{
29866
30093
  preview: GrantFile;
29867
- confirm: () => Promise<Hash>;
30094
+ confirm: () => Promise<TransactionHandle<PermissionGrantResult>>;
29868
30095
  }>;
29869
30096
  /**
29870
- * Internal method to complete the grant process after user confirmation.
29871
- * This is called by the confirm() function returned from prepareGrant().
30097
+ * Completes the grant process after user confirmation.
30098
+ *
30099
+ * @remarks
30100
+ * This internal method is called by the confirm() function returned from prepareGrant().
30101
+ * It handles IPFS upload, signature creation, and transaction submission.
29872
30102
  *
29873
30103
  * @param params - The permission grant parameters containing user and operation details
29874
30104
  * @param grantFile - The prepared grant file with permissions and metadata
29875
- * @returns Promise resolving to the transaction hash
30105
+ * @returns Promise resolving to TransactionHandle for flexible result access
30106
+ * @throws {BlockchainError} When permission grant confirmation fails
30107
+ * @throws {NetworkError} When IPFS upload fails
30108
+ * @throws {SignatureError} When user rejects the signature
29876
30109
  */
29877
30110
  private confirmGrantInternal;
29878
30111
  /**
@@ -29928,49 +30161,106 @@ declare class PermissionsController {
29928
30161
  * );
29929
30162
  * ```
29930
30163
  */
29931
- submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<Hash>;
30164
+ submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
29932
30165
  /**
29933
30166
  * Submits an already-signed trust server transaction to the blockchain.
30167
+ *
30168
+ * @remarks
29934
30169
  * This method extracts the trust server input from typed data and submits it directly.
30170
+ * Used internally by trust server methods after signature collection.
29935
30171
  *
29936
30172
  * @param typedData - The EIP-712 typed data for TrustServer
29937
- * @param signature - The user's signature
29938
- * @returns Promise resolving to the transaction hash
30173
+ * @param signature - The user's signature obtained via `signTypedData()`
30174
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30175
+ * @throws {BlockchainError} When contract submission fails
30176
+ * @throws {NetworkError} When blockchain communication fails
30177
+ * @example
30178
+ * ```typescript
30179
+ * const txHandle = await vana.permissions.submitSignedTrustServer(
30180
+ * typedData,
30181
+ * "0x1234..."
30182
+ * );
30183
+ * const result = await txHandle.waitForEvents();
30184
+ * ```
29939
30185
  */
29940
- submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<Hash>;
30186
+ submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
29941
30187
  /**
29942
30188
  * Submits an already-signed add and trust server transaction to the blockchain.
30189
+ *
30190
+ * @remarks
29943
30191
  * This method extracts the add and trust server input from typed data and submits it directly.
30192
+ * Combines server registration and trust operations in a single transaction.
29944
30193
  *
29945
30194
  * @param typedData - The EIP-712 typed data for AddAndTrustServer
29946
- * @param signature - The user's signature
29947
- * @returns Promise resolving to the transaction hash
30195
+ * @param signature - The user's signature obtained via `signTypedData()`
30196
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30197
+ * @throws {BlockchainError} When contract submission fails
30198
+ * @throws {NetworkError} When blockchain communication fails
30199
+ * @example
30200
+ * ```typescript
30201
+ * const txHandle = await vana.permissions.submitSignedAddAndTrustServer(
30202
+ * typedData,
30203
+ * "0x1234..."
30204
+ * );
30205
+ * const result = await txHandle.waitForEvents();
30206
+ * ```
29948
30207
  */
29949
- submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<Hash>;
30208
+ submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
29950
30209
  /**
29951
30210
  * Submits an already-signed permission revoke transaction to the blockchain.
30211
+ *
30212
+ * @remarks
29952
30213
  * This method handles the revocation of previously granted permissions.
30214
+ * Used internally by revocation methods after signature collection.
29953
30215
  *
29954
30216
  * @param typedData - The EIP-712 typed data for PermissionRevoke
29955
- * @param signature - The user's signature
29956
- * @returns Promise resolving to the transaction hash
30217
+ * @param signature - The user's signature obtained via `signTypedData()`
30218
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30219
+ * @throws {BlockchainError} When contract submission fails
30220
+ * @throws {NetworkError} When blockchain communication fails
30221
+ * @example
30222
+ * ```typescript
30223
+ * const txHandle = await vana.permissions.submitSignedRevoke(
30224
+ * typedData,
30225
+ * "0x1234..."
30226
+ * );
30227
+ * const result = await txHandle.waitForEvents();
30228
+ * ```
29957
30229
  */
29958
- submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30230
+ submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionRevokeResult>>;
29959
30231
  /**
29960
30232
  * Submits an already-signed untrust server transaction to the blockchain.
30233
+ *
30234
+ * @remarks
29961
30235
  * This method handles the removal of trusted servers.
30236
+ * Used internally by untrust server methods after signature collection.
29962
30237
  *
29963
30238
  * @param typedData - The EIP-712 typed data for UntrustServer
29964
- * @param signature - The user's signature
29965
- * @returns Promise resolving to the transaction hash
30239
+ * @param signature - The user's signature obtained via `signTypedData()`
30240
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30241
+ * @throws {BlockchainError} When contract submission fails
30242
+ * @throws {NetworkError} When blockchain communication fails
30243
+ * @example
30244
+ * ```typescript
30245
+ * const txHandle = await vana.permissions.submitSignedUntrustServer(
30246
+ * typedData,
30247
+ * "0x1234..."
30248
+ * );
30249
+ * const result = await txHandle.waitForEvents();
30250
+ * ```
29966
30251
  */
29967
- submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30252
+ submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<ServerUntrustResult>>;
29968
30253
  /**
29969
30254
  * Submits a signed transaction directly to the blockchain.
29970
30255
  *
30256
+ * @remarks
30257
+ * Internal method used when relayer callbacks are not available. Formats the signature
30258
+ * and submits the permission grant directly to the smart contract.
30259
+ *
29971
30260
  * @param typedData - The typed data structure for the permission grant
29972
30261
  * @param signature - The cryptographic signature authorizing the transaction
29973
30262
  * @returns Promise resolving to the transaction hash
30263
+ * @throws {BlockchainError} When contract submission fails
29974
30264
  */
29975
30265
  private submitDirectTransaction;
29976
30266
  /**
@@ -30017,21 +30307,38 @@ declare class PermissionsController {
30017
30307
  * console.log(`Revocation submitted: ${txHash}`);
30018
30308
  * ```
30019
30309
  */
30020
- submitPermissionRevoke(params: RevokePermissionParams): Promise<Hash>;
30310
+ submitPermissionRevoke(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
30021
30311
  /**
30022
- * Revokes a permission with a signature (gasless transaction).
30312
+ * Revokes a permission with a signature for gasless transactions.
30313
+ *
30314
+ * @remarks
30315
+ * This method creates an EIP-712 signature for permission revocation and submits
30316
+ * it either through relayer callbacks or directly to the blockchain. Provides
30317
+ * gasless revocation when relayer is configured.
30023
30318
  *
30024
30319
  * @param params - Parameters for revoking the permission
30025
- * @returns Promise resolving to transaction hash
30320
+ * @param params.permissionId - Permission identifier to revoke (accepts bigint, number, or string)
30321
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30026
30322
  * @throws {BlockchainError} When chain ID is not available
30027
30323
  * @throws {NonceError} When retrieving user nonce fails
30028
30324
  * @throws {SignatureError} When user rejects the signature request
30029
30325
  * @throws {RelayerError} When gasless submission fails
30030
30326
  * @throws {PermissionError} When revocation fails for any other reason
30327
+ * @example
30328
+ * ```typescript
30329
+ * const txHandle = await vana.permissions.submitRevokeWithSignature({
30330
+ * permissionId: 123n
30331
+ * });
30332
+ * const result = await txHandle.waitForEvents();
30333
+ * console.log(`Permission ${result.permissionId} revoked`);
30334
+ * ```
30031
30335
  */
30032
- submitRevokeWithSignature(params: RevokePermissionParams): Promise<Hash>;
30336
+ submitRevokeWithSignature(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
30033
30337
  /**
30338
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30339
+ *
30034
30340
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
30341
+ * This method is deprecated in favor of more specific nonce methods.
30035
30342
  *
30036
30343
  * The nonce is used to prevent replay attacks in signed transactions and must
30037
30344
  * be incremented with each transaction to maintain security.
@@ -30043,25 +30350,77 @@ declare class PermissionsController {
30043
30350
  * @private
30044
30351
  * @example
30045
30352
  * ```typescript
30353
+ * // Deprecated - use specific methods instead
30046
30354
  * const nonce = await this.getUserNonce();
30047
- * console.log(`Current nonce: ${nonce}`);
30355
+ *
30356
+ * // Use these instead:
30357
+ * const permissionsNonce = await this.getPermissionsUserNonce();
30358
+ * const serversNonce = await this.getServersUserNonce();
30048
30359
  * ```
30049
30360
  */
30361
+ /**
30362
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30363
+ *
30364
+ * Retrieves the user's current nonce from the DataPortabilityServers contract.
30365
+ *
30366
+ * @remarks
30367
+ * This method is deprecated in favor of more specific nonce methods that target
30368
+ * the appropriate contract for the operation being performed.
30369
+ *
30370
+ * @returns Promise resolving to the user's current nonce as a bigint
30371
+ * @throws {NonceError} When retrieving the nonce fails
30372
+ */
30050
30373
  private getUserNonce;
30051
30374
  /**
30052
30375
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
30053
30376
  * This nonce is used for server-related operations (AddAndTrustServer, TrustServer, UntrustServer).
30054
30377
  *
30055
- * @returns Promise resolving to the current nonce
30378
+ * @returns Promise resolving to the current servers nonce
30379
+ * @throws {NonceError} When reading nonce from contract fails
30380
+ * @private
30381
+ *
30382
+ * @example
30383
+ * ```typescript
30384
+ * const nonce = await this.getServersUserNonce();
30385
+ * console.log(`Current servers nonce: ${nonce}`);
30386
+ * ```
30387
+ */
30388
+ /**
30389
+ * Retrieves the user's current nonce from the DataPortabilityServers contract.
30390
+ *
30391
+ * @remarks
30392
+ * Used for server-related operations (trust/untrust) to prevent replay attacks.
30393
+ * The nonce must be incremented with each server operation.
30394
+ *
30395
+ * @returns Promise resolving to the user's current nonce as a bigint
30396
+ * @throws {NonceError} When retrieving the nonce fails
30397
+ */
30398
+ private getServersUserNonce;
30399
+ /**
30400
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
30401
+ * This nonce is used for permission-related operations (addPermission, addServerFilesAndPermissions).
30402
+ *
30403
+ * @returns Promise resolving to the current permissions nonce
30404
+ * @throws {NonceError} When reading nonce from contract fails
30056
30405
  * @private
30057
30406
  *
30058
30407
  * @example
30059
30408
  * ```typescript
30060
- * const nonce = await this.getServerNonce();
30061
- * console.log(`Current server nonce: ${nonce}`);
30409
+ * const nonce = await this.getPermissionsUserNonce();
30410
+ * console.log(`Current permissions nonce: ${nonce}`);
30062
30411
  * ```
30063
30412
  */
30064
- private getServerNonce;
30413
+ /**
30414
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
30415
+ *
30416
+ * @remarks
30417
+ * Used for permission-related operations (grant/revoke) to prevent replay attacks.
30418
+ * The nonce must be incremented with each permission operation.
30419
+ *
30420
+ * @returns Promise resolving to the user's current nonce as a bigint
30421
+ * @throws {NonceError} When retrieving the nonce fails
30422
+ */
30423
+ private getPermissionsUserNonce;
30065
30424
  /**
30066
30425
  * Composes the EIP-712 typed data for PermissionGrant (new simplified format).
30067
30426
  *
@@ -30082,6 +30441,7 @@ declare class PermissionsController {
30082
30441
  * @param params.granteeId - Grantee ID
30083
30442
  * @param params.grant - Grant URL or grant data
30084
30443
  * @param params.fileUrls - Array of file URLs
30444
+ * @param params.schemaIds - Schema IDs for each file
30085
30445
  * @param params.serverAddress - Server address
30086
30446
  * @param params.serverUrl - Server URL
30087
30447
  * @param params.serverPublicKey - Server public key
@@ -30187,7 +30547,7 @@ declare class PermissionsController {
30187
30547
  * console.log('Now trusting servers:', trustedServers);
30188
30548
  * ```
30189
30549
  */
30190
- addAndTrustServer(params: AddAndTrustServerParams): Promise<Hash>;
30550
+ addAndTrustServer(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30191
30551
  /**
30192
30552
  * Trusts a server for data processing (legacy method).
30193
30553
  *
@@ -30195,14 +30555,14 @@ declare class PermissionsController {
30195
30555
  * @returns Promise resolving to transaction hash
30196
30556
  * @deprecated Use addAndTrustServer instead
30197
30557
  */
30198
- submitTrustServer(params: TrustServerParams): Promise<Hash>;
30558
+ submitTrustServer(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30199
30559
  /**
30200
30560
  * Adds and trusts a server using a signature (gasless transaction).
30201
30561
  *
30202
30562
  * @param params - Parameters for adding and trusting the server
30203
- * @returns Promise resolving to transaction hash
30563
+ * @returns Promise resolving to TransactionHandle with ServerTrustResult event data
30204
30564
  */
30205
- submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<Hash>;
30565
+ submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30206
30566
  /**
30207
30567
  * Trusts a server using a signature (gasless transaction - legacy method).
30208
30568
  *
@@ -30216,13 +30576,24 @@ declare class PermissionsController {
30216
30576
  * @throws {ServerUrlMismatchError} When server URL doesn't match existing registration
30217
30577
  * @throws {BlockchainError} When trust operation fails for any other reason
30218
30578
  */
30219
- submitTrustServerWithSignature(params: TrustServerParams): Promise<Hash>;
30579
+ submitTrustServerWithSignature(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
30220
30580
  /**
30221
30581
  * Submits a direct untrust server transaction (without signature).
30222
30582
  *
30223
30583
  * @param params - The untrust server parameters containing server details
30224
30584
  * @returns Promise resolving to the transaction hash
30225
30585
  */
30586
+ /**
30587
+ * Submits an untrust server transaction directly to the blockchain.
30588
+ *
30589
+ * @remarks
30590
+ * Internal method used for direct blockchain submission of untrust server operations
30591
+ * when relayer callbacks are not available.
30592
+ *
30593
+ * @param params - The untrust server parameters
30594
+ * @returns Promise resolving to TransactionHandle for transaction tracking
30595
+ * @throws {BlockchainError} When contract submission fails
30596
+ */
30226
30597
  private submitDirectUntrustTransaction;
30227
30598
  /**
30228
30599
  * Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
@@ -30252,7 +30623,7 @@ declare class PermissionsController {
30252
30623
  * console.log('Still trusting servers:', trustedServers);
30253
30624
  * ```
30254
30625
  */
30255
- submitUntrustServer(params: UntrustServerParams): Promise<Hash>;
30626
+ submitUntrustServer(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
30256
30627
  /**
30257
30628
  * Untrusts a server using a signature (gasless transaction).
30258
30629
  *
@@ -30265,7 +30636,7 @@ declare class PermissionsController {
30265
30636
  * @throws {RelayerError} When gasless submission fails
30266
30637
  * @throws {BlockchainError} When untrust transaction fails
30267
30638
  */
30268
- submitUntrustServerWithSignature(params: UntrustServerParams): Promise<Hash>;
30639
+ submitUntrustServerWithSignature(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
30269
30640
  /**
30270
30641
  * Retrieves all servers trusted by a user from the DataPortabilityServers contract.
30271
30642
  *
@@ -30316,22 +30687,60 @@ declare class PermissionsController {
30316
30687
  /**
30317
30688
  * Gets server information for multiple servers efficiently.
30318
30689
  *
30319
- * @param serverIds - Array of server IDs to query
30320
- * @returns Promise resolving to batch result with successes and failures
30690
+ * @remarks
30691
+ * This method uses multicall to fetch information for multiple servers in a single
30692
+ * blockchain call, improving performance when querying many servers. Failed lookups
30693
+ * are returned separately for error handling.
30694
+ *
30695
+ * @param serverIds - Array of numeric server IDs to query
30696
+ * @returns Promise resolving to batch result containing successful lookups and failed IDs
30321
30697
  * @throws {BlockchainError} When reading from contract fails or chain is unavailable
30698
+ * @example
30699
+ * ```typescript
30700
+ * const result = await vana.permissions.getServerInfoBatch([1, 2, 3, 999]);
30701
+ *
30702
+ * // Process successful lookups
30703
+ * result.servers.forEach((server, id) => {
30704
+ * console.log(`Server ${id}: ${server.url}`);
30705
+ * });
30706
+ *
30707
+ * // Handle failed lookups
30708
+ * if (result.failed.length > 0) {
30709
+ * console.log(`Failed to fetch: ${result.failed.join(', ')}`);
30710
+ * }
30711
+ * ```
30322
30712
  */
30323
30713
  getServerInfoBatch(serverIds: number[]): Promise<BatchServerInfoResult>;
30324
30714
  /**
30325
30715
  * Checks whether a specific server is trusted by a user.
30326
30716
  *
30327
- * @param serverId - Server ID to check (numeric)
30717
+ * @remarks
30718
+ * This method queries the user's trusted server list and checks if the specified
30719
+ * server is present. Returns both the trust status and the index in the trust list
30720
+ * if trusted.
30721
+ *
30722
+ * @param serverId - Numeric server ID to check
30328
30723
  * @param userAddress - Optional user address (defaults to current user)
30329
- * @returns Promise resolving to server trust status
30724
+ * @returns Promise resolving to server trust status with trust index if applicable
30725
+ * @throws {BlockchainError} When reading from contract fails
30726
+ * @example
30727
+ * ```typescript
30728
+ * const status = await vana.permissions.checkServerTrustStatus(1);
30729
+ * if (status.isTrusted) {
30730
+ * console.log(`Server is trusted at index ${status.trustIndex}`);
30731
+ * } else {
30732
+ * console.log('Server is not trusted');
30733
+ * }
30734
+ * ```
30330
30735
  */
30331
30736
  checkServerTrustStatus(serverId: number, userAddress?: Address): Promise<ServerTrustStatus>;
30332
30737
  /**
30333
30738
  * Composes EIP-712 typed data for AddAndTrustServer.
30334
30739
  *
30740
+ * @remarks
30741
+ * Creates the complete typed data structure required for EIP-712 signature generation
30742
+ * when adding and trusting a new server in a single transaction.
30743
+ *
30335
30744
  * @param input - The add and trust server input data containing server details
30336
30745
  * @returns Promise resolving to the typed data structure for server add and trust
30337
30746
  */
@@ -30413,7 +30822,7 @@ declare class PermissionsController {
30413
30822
  * console.log(`Grantee registered in transaction: ${txHash}`);
30414
30823
  * ```
30415
30824
  */
30416
- submitRegisterGrantee(params: RegisterGranteeParams): Promise<Hash>;
30825
+ submitRegisterGrantee(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
30417
30826
  /**
30418
30827
  * Registers a grantee with a signature (gasless transaction)
30419
30828
  *
@@ -30429,7 +30838,7 @@ declare class PermissionsController {
30429
30838
  * });
30430
30839
  * ```
30431
30840
  */
30432
- submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<Hash>;
30841
+ submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
30433
30842
  /**
30434
30843
  * Submits a signed register grantee transaction via relayer
30435
30844
  *
@@ -30442,7 +30851,7 @@ declare class PermissionsController {
30442
30851
  * const result = await vana.permissions.submitSignedRegisterGrantee(typedData, signature);
30443
30852
  * ```
30444
30853
  */
30445
- submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<Hash>;
30854
+ submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<TransactionHandle<GranteeRegisterResult>>;
30446
30855
  /**
30447
30856
  * Retrieves all registered grantees from the DataPortabilityGrantees contract.
30448
30857
  *
@@ -30729,7 +31138,7 @@ declare class PermissionsController {
30729
31138
  * @param url - New URL for the server
30730
31139
  * @returns Promise resolving to transaction hash
30731
31140
  */
30732
- submitUpdateServer(serverId: bigint, url: string): Promise<Hash>;
31141
+ submitUpdateServer(serverId: bigint, url: string): Promise<TransactionHandle<ServerUpdateResult>>;
30733
31142
  /**
30734
31143
  * Get all permission IDs for a user
30735
31144
  *
@@ -30760,26 +31169,131 @@ declare class PermissionsController {
30760
31169
  */
30761
31170
  getPermissions(permissionId: bigint): Promise<PermissionInfo>;
30762
31171
  /**
30763
- * Submit permission with signature to the blockchain
31172
+ * Submit permission with signature to the blockchain (supports gasless transactions)
30764
31173
  *
30765
31174
  * @param params - Parameters for adding permission
30766
31175
  * @returns Promise resolving to transaction hash
31176
+ * @throws {RelayerError} When gasless transaction submission fails
31177
+ * @throws {SignatureError} When user rejects the signature request
31178
+ * @throws {BlockchainError} When permission addition fails
31179
+ * @throws {NetworkError} When network communication fails
30767
31180
  */
30768
- submitAddPermission(params: ServerFilesAndPermissionParams): Promise<Hash>;
31181
+ submitAddPermission(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
30769
31182
  /**
30770
- * Submit server files and permissions with signature to the blockchain
31183
+ * Submits an already-signed add permission transaction to the blockchain.
31184
+ * This method supports both relayer-based gasless transactions and direct transactions.
31185
+ *
31186
+ * @param typedData - The EIP-712 typed data for AddPermission
31187
+ * @param signature - The user's signature
31188
+ * @returns Promise resolving to TransactionHandle with PermissionGrantResult event data
31189
+ * @throws {RelayerError} When gasless transaction submission fails
31190
+ * @throws {BlockchainError} When permission addition fails
31191
+ * @throws {NetworkError} When network communication fails
31192
+ */
31193
+ submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
31194
+ /**
31195
+ * Submits server files and permissions with signature to the blockchain, supporting schema validation and gasless transactions.
31196
+ *
31197
+ * @remarks
31198
+ * This method validates files against their specified schemas before submission.
31199
+ * Schema validation ensures data conforms to expected formats before on-chain registration.
31200
+ * Files with schemaId = 0 bypass validation. The method supports atomic batch operations
31201
+ * where all files and permissions are registered in a single transaction.
30771
31202
  *
30772
31203
  * @param params - Parameters for adding server files and permissions
30773
- * @returns Promise resolving to transaction hash
31204
+ * @param params.granteeId - The ID of the permission grantee
31205
+ * @param params.grant - Grant URL containing permission parameters (typically IPFS)
31206
+ * @param params.fileUrls - Array of file URLs to register
31207
+ * @param params.schemaIds - Schema IDs for each file. Use 0 for files without schema validation.
31208
+ * Array length must match fileUrls length.
31209
+ * @param params.serverAddress - Server wallet address for decryption permissions
31210
+ * @param params.serverUrl - Server endpoint URL
31211
+ * @param params.serverPublicKey - Server's public key for encryption.
31212
+ * Obtain via `vana.server.getIdentity(userAddress).public_key`.
31213
+ * @param params.filePermissions - Nested array of permissions for each file
31214
+ * @returns TransactionHandle with immediate hash access and event parsing capability
31215
+ * @throws {Error} When schemaIds array length doesn't match fileUrls array length
31216
+ * @throws {SchemaValidationError} When file data doesn't match the specified schema.
31217
+ * Verify data structure matches schema definition from `vana.schemas.get(schemaId)`.
31218
+ * @throws {RelayerError} When gasless transaction submission fails.
31219
+ * Retry without relayer configuration to submit direct transaction.
31220
+ * @throws {SignatureError} When user rejects the signature request
31221
+ * @throws {BlockchainError} When server files and permissions addition fails
31222
+ * @throws {NetworkError} When network communication fails.
31223
+ * Check network connection or configure alternative gateways.
31224
+ *
31225
+ * @example
31226
+ * ```typescript
31227
+ * const result = await vana.permissions.submitAddServerFilesAndPermissions({
31228
+ * granteeId: BigInt(1),
31229
+ * grant: "ipfs://QmXxx...",
31230
+ * fileUrls: ["https://storage.example.com/data.json"],
31231
+ * schemaIds: [123], // LinkedIn profile schema ID
31232
+ * serverAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
31233
+ * serverUrl: "https://server.example.com",
31234
+ * serverPublicKey: serverInfo.public_key,
31235
+ * filePermissions: [[{
31236
+ * account: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
31237
+ * key: encryptedKey
31238
+ * }]]
31239
+ * });
31240
+ * const events = await result.waitForEvents();
31241
+ * console.log(`Permission ID: ${events.permissionId}`);
31242
+ * ```
31243
+ */
31244
+ submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
31245
+ /**
31246
+ * Submits an already-signed add server files and permissions transaction to the blockchain.
31247
+ *
31248
+ * @remarks
31249
+ * This method returns a TransactionHandle that provides immediate access to the transaction hash
31250
+ * while allowing lazy-loaded access to parsed event data. Use `waitForEvents()` to retrieve
31251
+ * the permission ID and other event details after transaction confirmation.
31252
+ *
31253
+ * @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
31254
+ * @param signature - The user's signature
31255
+ * @returns TransactionHandle with immediate hash access and optional event parsing
31256
+ * @throws {RelayerError} When gasless transaction submission fails
31257
+ * @throws {BlockchainError} When server files and permissions addition fails
31258
+ * @throws {NetworkError} When network communication fails
31259
+ *
31260
+ * @example
31261
+ * ```typescript
31262
+ * const tx = await vana.permissions.submitSignedAddServerFilesAndPermissions(
31263
+ * typedData,
31264
+ * signature
31265
+ * );
31266
+ * console.log(`Transaction submitted: ${tx.hash}`);
31267
+ *
31268
+ * // Wait for confirmation and get the permission ID
31269
+ * const { permissionId } = await tx.waitForEvents();
31270
+ * console.log(`Permission created with ID: ${permissionId}`);
31271
+ * ```
30774
31272
  */
30775
- submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<Hash>;
31273
+ submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
30776
31274
  /**
30777
31275
  * Submit permission revocation with signature to the blockchain
30778
31276
  *
30779
31277
  * @param permissionId - Permission ID to revoke
30780
31278
  * @returns Promise resolving to transaction hash
30781
31279
  */
30782
- submitRevokePermission(permissionId: bigint): Promise<Hash>;
31280
+ submitRevokePermission(permissionId: bigint): Promise<TransactionHandle<PermissionRevokeResult>>;
31281
+ /**
31282
+ * Submits a signed add permission transaction directly to the blockchain.
31283
+ *
31284
+ * @param typedData - The typed data structure for the permission addition
31285
+ * @param signature - The cryptographic signature authorizing the transaction
31286
+ * @returns Promise resolving to the transaction hash
31287
+ */
31288
+ private submitDirectAddPermissionTransaction;
31289
+ /**
31290
+ * Submits a signed add server files and permissions transaction directly to the blockchain.
31291
+ *
31292
+ * @param typedData - The typed data structure for the server files and permissions addition
31293
+ * @param signature - The cryptographic signature authorizing the transaction
31294
+ * @returns Promise resolving to the transaction hash
31295
+ */
31296
+ private submitDirectAddServerFilesAndPermissionsTransaction;
30783
31297
  }
30784
31298
 
30785
31299
  /**
@@ -30905,33 +31419,52 @@ declare class SchemaController {
30905
31419
  * Retrieves a schema by its ID.
30906
31420
  *
30907
31421
  * @param schemaId - The ID of the schema to retrieve
31422
+ * @param options - Optional parameters
31423
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
30908
31424
  * @returns Promise resolving to the schema object
30909
31425
  * @throws {Error} When the schema is not found or chain is unavailable
30910
31426
  * @example
30911
31427
  * ```typescript
30912
31428
  * const schema = await vana.schemas.get(1);
30913
31429
  * console.log(`Schema: ${schema.name} (${schema.type})`);
31430
+ *
31431
+ * // With custom subgraph
31432
+ * const schema = await vana.schemas.get(1, {
31433
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
31434
+ * });
30914
31435
  * ```
30915
31436
  */
30916
- get(schemaId: number): Promise<Schema>;
31437
+ get(schemaId: number, options?: {
31438
+ subgraphUrl?: string;
31439
+ }): Promise<Schema>;
30917
31440
  /**
30918
31441
  * Gets the total number of schemas registered on the network.
30919
31442
  *
31443
+ * @param options - Optional parameters
31444
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
30920
31445
  * @returns Promise resolving to the total schema count
30921
31446
  * @throws {Error} When the count cannot be retrieved
30922
31447
  * @example
30923
31448
  * ```typescript
30924
31449
  * const count = await vana.schemas.count();
30925
31450
  * console.log(`Total schemas: ${count}`);
31451
+ *
31452
+ * // With custom subgraph
31453
+ * const count = await vana.schemas.count({
31454
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
31455
+ * });
30926
31456
  * ```
30927
31457
  */
30928
- count(): Promise<number>;
31458
+ count(options?: {
31459
+ subgraphUrl?: string;
31460
+ }): Promise<number>;
30929
31461
  /**
30930
31462
  * Lists all schemas with pagination.
30931
31463
  *
30932
31464
  * @param options - Optional parameters for listing schemas
30933
31465
  * @param options.limit - Maximum number of schemas to return
30934
31466
  * @param options.offset - Number of schemas to skip
31467
+ * @param options.subgraphUrl - Custom subgraph URL to use instead of default
30935
31468
  * @returns Promise resolving to an array of schemas
30936
31469
  * @example
30937
31470
  * ```typescript
@@ -30940,11 +31473,19 @@ declare class SchemaController {
30940
31473
  *
30941
31474
  * // Get schemas with pagination
30942
31475
  * const schemas = await vana.schemas.list({ limit: 10, offset: 0 });
31476
+ *
31477
+ * // With custom subgraph
31478
+ * const schemas = await vana.schemas.list({
31479
+ * limit: 10,
31480
+ * offset: 0,
31481
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
31482
+ * });
30943
31483
  * ```
30944
31484
  */
30945
31485
  list(options?: {
30946
31486
  limit?: number;
30947
31487
  offset?: number;
31488
+ subgraphUrl?: string;
30948
31489
  }): Promise<Schema[]>;
30949
31490
  /**
30950
31491
  * Adds a schema using the legacy method (low-level API).
@@ -30954,6 +31495,36 @@ declare class SchemaController {
30954
31495
  * @returns Promise resolving to the add schema result
30955
31496
  */
30956
31497
  addSchema(params: AddSchemaParams): Promise<AddSchemaResult>;
31498
+ /**
31499
+ * Internal method: Query schema via subgraph
31500
+ *
31501
+ * @param params - Query parameters
31502
+ * @param params.schemaId - The ID of the schema to retrieve
31503
+ * @param params.subgraphUrl - The subgraph URL to query
31504
+ * @returns Promise resolving to the schema object
31505
+ * @private
31506
+ */
31507
+ private _getSchemaViaSubgraph;
31508
+ /**
31509
+ * Internal method: List schemas via subgraph
31510
+ *
31511
+ * @param params - Query parameters
31512
+ * @param params.limit - Maximum number of schemas to return
31513
+ * @param params.offset - Number of schemas to skip
31514
+ * @param params.subgraphUrl - The subgraph URL to query
31515
+ * @returns Promise resolving to an array of schemas
31516
+ * @private
31517
+ */
31518
+ private _listSchemasViaSubgraph;
31519
+ /**
31520
+ * Internal method: Count schemas via subgraph
31521
+ *
31522
+ * @param params - Query parameters
31523
+ * @param params.subgraphUrl - The subgraph URL to query
31524
+ * @returns Promise resolving to the total schema count
31525
+ * @private
31526
+ */
31527
+ private _countSchemasViaSubgraph;
30957
31528
  /**
30958
31529
  * Gets the user's wallet address.
30959
31530
  *
@@ -33602,19 +34173,18 @@ declare class DataController {
33602
34173
  subgraphUrl?: string;
33603
34174
  }): Promise<UserFile$1[]>;
33604
34175
  /**
33605
- * Retrieves a list of permissions granted by a user using the new subgraph entities.
34176
+ * Retrieves a list of permissions granted by a user.
33606
34177
  *
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
34178
+ * This method supports automatic fallback between subgraph and RPC modes:
34179
+ * - If subgraph URL is available, tries subgraph query first
34180
+ * - Falls back to direct contract queries via RPC if subgraph fails
34181
+ * - RPC mode uses gasAwareMulticall for efficient batch queries
33612
34182
  *
33613
34183
  * @param params - Object containing the user address and optional subgraph URL
33614
34184
  * @param params.user - The wallet address of the user to query permissions for
33615
34185
  * @param params.subgraphUrl - Optional subgraph URL to override the default
33616
34186
  * @returns Promise resolving to an array of permission objects
33617
- * @throws Error if subgraph is unavailable or returns invalid data
34187
+ * @throws Error if both subgraph and RPC queries fail
33618
34188
  */
33619
34189
  getUserPermissions(params: {
33620
34190
  user: Address;
@@ -33630,43 +34200,59 @@ declare class DataController {
33630
34200
  user: Address;
33631
34201
  }>>;
33632
34202
  /**
33633
- * Retrieves a list of trusted servers for a user using the new subgraph entities.
34203
+ * Internal method: Query user permissions via subgraph
34204
+ *
34205
+ * @param params - Query parameters object
34206
+ * @param params.user - The user address to query permissions for
34207
+ * @param params.subgraphUrl - The subgraph URL endpoint to query
34208
+ * @returns Promise resolving to an array of permission objects
34209
+ */
34210
+ private _getUserPermissionsViaSubgraph;
34211
+ /**
34212
+ * Internal method: Query user permissions via direct RPC
33634
34213
  *
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.
34214
+ * @param params - Query parameters object
34215
+ * @param params.user - The user address to query permissions for
34216
+ * @returns Promise resolving to an array of permission objects
34217
+ */
34218
+ private _getUserPermissionsViaRpc;
34219
+ /**
34220
+ * Retrieves a list of trusted servers for a user.
33637
34221
  *
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
34222
+ * This method supports automatic fallback between subgraph and RPC modes:
34223
+ * - If subgraph URL is available, tries subgraph query first for fast results
34224
+ * - Falls back to direct contract queries via RPC if subgraph fails
34225
+ * - RPC mode uses gasAwareMulticall for efficient batch queries
33642
34226
  *
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')
34227
+ * @param params - Query parameters including user address and optional pagination
34228
+ * @param params.user - The wallet address of the user to query trusted servers for
34229
+ * @param params.subgraphUrl - Optional subgraph URL to override the default
34230
+ * @param params.limit - Maximum number of results to return (default: 50)
34231
+ * @param params.offset - Number of results to skip for pagination (default: 0)
34232
+ * @returns Promise resolving to an array of trusted server objects
34233
+ * @throws Error if both subgraph and RPC queries fail
33646
34234
  * @example
33647
34235
  * ```typescript
33648
- * // Use subgraph for fast queries
33649
- * const result = await vana.data.getUserTrustedServers({
33650
- * user: '0x...',
33651
- * mode: 'subgraph',
33652
- * subgraphUrl: 'https://...'
34236
+ * // Basic usage with automatic fallback
34237
+ * const servers = await vana.data.getUserTrustedServers({
34238
+ * user: '0x...'
33653
34239
  * });
33654
34240
  *
33655
- * // Use direct RPC (no external dependencies)
33656
- * const result = await vana.data.getUserTrustedServers({
34241
+ * // With pagination
34242
+ * const servers = await vana.data.getUserTrustedServers({
33657
34243
  * user: '0x...',
33658
- * mode: 'rpc',
33659
- * limit: 10
34244
+ * limit: 10,
34245
+ * offset: 20
33660
34246
  * });
33661
34247
  *
33662
- * // Auto-fallback mode
33663
- * const result = await vana.data.getUserTrustedServers({
34248
+ * // With custom subgraph URL
34249
+ * const servers = await vana.data.getUserTrustedServers({
33664
34250
  * user: '0x...',
33665
- * mode: 'auto' // tries subgraph first, falls back to RPC
34251
+ * subgraphUrl: 'https://custom-subgraph.com/graphql'
33666
34252
  * });
33667
34253
  * ```
33668
34254
  */
33669
- getUserTrustedServers(params: GetUserTrustedServersParams): Promise<GetUserTrustedServersResult>;
34255
+ getUserTrustedServers(params: GetUserTrustedServersParams): Promise<TrustedServer[]>;
33670
34256
  /**
33671
34257
  * Internal method: Query trusted servers via subgraph
33672
34258
  *
@@ -33731,75 +34317,28 @@ declare class DataController {
33731
34317
  * for specific files by ID.
33732
34318
  */
33733
34319
  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
34320
  /**
33795
34321
  * Registers a file URL directly on the blockchain with a schema ID.
33796
34322
  *
33797
- * @param url - The URL of the file to register
34323
+ * @remarks
34324
+ * This method registers an existing file URL on the DataRegistry contract
34325
+ * with a schema ID, without uploading any data. Useful when you have already
34326
+ * uploaded content to storage and just need to register it on-chain.
34327
+ *
34328
+ * @param url - The URL of the file to register (IPFS or HTTP/HTTPS)
33798
34329
  * @param schemaId - The schema ID to associate with the file
33799
34330
  * @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.
34331
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34332
+ * @throws {Error} When wallet address is unavailable - "No addresses available"
34333
+ * @throws {Error} When transaction fails - "Failed to register file with schema"
34334
+ * @example
34335
+ * ```typescript
34336
+ * const { fileId, transactionHash } = await vana.data.registerFileWithSchema(
34337
+ * "ipfs://QmXxx...",
34338
+ * 1
34339
+ * );
34340
+ * console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
34341
+ * ```
33803
34342
  */
33804
34343
  registerFileWithSchema(url: string, schemaId: number): Promise<{
33805
34344
  fileId: number;
@@ -33857,95 +34396,114 @@ declare class DataController {
33857
34396
  transactionHash: string;
33858
34397
  }>;
33859
34398
  /**
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
34399
+ * Adds a new refiner to the DataRefinerRegistry.
33863
34400
  *
33864
- * Migration guide:
34401
+ * @remarks
34402
+ * Refiners are data processing templates that define how raw data should be
34403
+ * transformed into structured formats. Each refiner is associated with a DLP
34404
+ * (Data Liquidity Pool), has a specific schema for output, and includes
34405
+ * instructions for the refinement process.
34406
+ *
34407
+ * @param params - Refiner configuration parameters
34408
+ * @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
34409
+ * @param params.name - Human-readable name for the refiner
34410
+ * @param params.schemaId - Schema ID that defines the output format
34411
+ * @param params.refinementInstructionUrl - URL containing processing instructions
34412
+ * @returns Promise resolving to the new refiner ID and transaction hash
34413
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34414
+ * @throws {Error} When transaction fails - "Failed to add refiner: {error}"
34415
+ * @example
33865
34416
  * ```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
34417
+ * const result = await vana.data.addRefiner({
34418
+ * dlpId: 1,
34419
+ * name: "Social Media Sentiment Analyzer",
34420
+ * schemaId: 42,
34421
+ * refinementInstructionUrl: "ipfs://QmXxx..."
33878
34422
  * });
34423
+ * console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
33879
34424
  * ```
33880
- * @param params - Schema parameters including name, type, and definition URL
33881
- * @returns Promise resolving to the new schema ID and transaction hash
33882
34425
  */
33883
- addSchema(params: AddSchemaParams): Promise<AddSchemaResult>;
34426
+ addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
33884
34427
  /**
33885
- * Retrieves a schema by its ID.
34428
+ * Retrieves a refiner by its ID.
33886
34429
  *
33887
- * @deprecated Since v2.0.0 - Use vana.schemas.get() instead
34430
+ * @remarks
34431
+ * Queries the DataRefinerRegistry contract to get complete information about
34432
+ * a specific refiner including its DLP association, schema, and instructions.
33888
34433
  *
33889
- * Migration guide:
34434
+ * @param refinerId - The numeric refiner ID to retrieve
34435
+ * @returns Promise resolving to the refiner information object
34436
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34437
+ * @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
34438
+ * @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
34439
+ * @example
33890
34440
  * ```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);
34441
+ * const refiner = await vana.data.getRefiner(1);
34442
+ * console.log({
34443
+ * name: refiner.name,
34444
+ * dlp: refiner.dlpId,
34445
+ * schema: refiner.schemaId,
34446
+ * instructions: refiner.refinementInstructionUrl
34447
+ * });
33896
34448
  * ```
33897
- * @param schemaId - The schema ID to retrieve
33898
- * @returns Promise resolving to the schema information
33899
34449
  */
33900
- getSchema(schemaId: number): Promise<Schema>;
34450
+ getRefiner(refinerId: number): Promise<Refiner>;
33901
34451
  /**
33902
- * Gets the total number of schemas in the registry.
34452
+ * Validates if a schema ID exists in the registry.
33903
34453
  *
33904
- * @deprecated Since v2.0.0 - Use vana.schemas.count() instead
34454
+ * @remarks
34455
+ * Checks the DataRefinerRegistry contract to determine if a given schema ID
34456
+ * has been registered and is available for use.
33905
34457
  *
33906
- * Migration guide:
34458
+ * @param schemaId - The numeric schema ID to validate
34459
+ * @returns Promise resolving to true if schema exists, false otherwise
34460
+ * @example
33907
34461
  * ```typescript
33908
- * // Old way (deprecated):
33909
- * const count = await vana.data.getSchemasCount();
33910
- *
33911
- * // New way:
33912
- * const count = await vana.schemas.count();
34462
+ * const isValid = await vana.data.isValidSchemaId(42);
34463
+ * if (isValid) {
34464
+ * console.log('Schema 42 is available for use');
34465
+ * } else {
34466
+ * console.log('Schema 42 does not exist');
34467
+ * }
33913
34468
  * ```
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
34469
  */
33937
34470
  isValidSchemaId(schemaId: number): Promise<boolean>;
33938
34471
  /**
33939
34472
  * Gets the total number of refiners in the registry.
33940
34473
  *
34474
+ * @remarks
34475
+ * Queries the DataRefinerRegistry contract to get the total count of all
34476
+ * registered refiners across all DLPs.
34477
+ *
33941
34478
  * @returns Promise resolving to the total refiner count
34479
+ * @example
34480
+ * ```typescript
34481
+ * const count = await vana.data.getRefinersCount();
34482
+ * console.log(`Total refiners registered: ${count}`);
34483
+ * ```
33942
34484
  */
33943
34485
  getRefinersCount(): Promise<number>;
33944
34486
  /**
33945
34487
  * Updates the schema ID for an existing refiner.
33946
34488
  *
33947
- * @param params - Parameters including refiner ID and new schema ID
34489
+ * @remarks
34490
+ * Allows the owner of a refiner to update its associated schema ID.
34491
+ * This is useful when refiner output format needs to change.
34492
+ *
34493
+ * @param params - Update parameters
34494
+ * @param params.refinerId - The refiner ID to update
34495
+ * @param params.newSchemaId - The new schema ID to set
33948
34496
  * @returns Promise resolving to the transaction hash
34497
+ * @throws {Error} When chain ID is not available - "Chain ID not available"
34498
+ * @throws {Error} When transaction fails - "Failed to update schema ID: {error}"
34499
+ * @example
34500
+ * ```typescript
34501
+ * const result = await vana.data.updateSchemaId({
34502
+ * refinerId: 1,
34503
+ * newSchemaId: 55
34504
+ * });
34505
+ * console.log(`Schema updated in tx ${result.transactionHash}`);
34506
+ * ```
33949
34507
  */
33950
34508
  updateSchemaId(params: UpdateSchemaIdParams): Promise<UpdateSchemaIdResult>;
33951
34509
  /**
@@ -33967,6 +34525,17 @@ declare class DataController {
33967
34525
  account: Address;
33968
34526
  publicKey: string;
33969
34527
  }>, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
34528
+ /**
34529
+ * Uploads content to storage without registering it on the blockchain.
34530
+ * This method only handles the storage upload and returns the file URL.
34531
+ *
34532
+ * @param content - The content to upload (string, Blob, Buffer, or object - objects will be JSON stringified)
34533
+ * @param filename - Optional filename for the uploaded file (defaults to timestamp-based name)
34534
+ * @param encrypt - Optional flag to encrypt the content before upload
34535
+ * @param providerName - Optional specific storage provider to use
34536
+ * @returns Promise resolving to the storage upload result with url, size, and contentType
34537
+ */
34538
+ uploadToStorage(content: string | Blob | Buffer | object, filename?: string, encrypt?: boolean, providerName?: string): Promise<StorageUploadResult>;
33970
34539
  /**
33971
34540
  * Adds a permission for a party to access an existing file.
33972
34541
  *
@@ -33993,7 +34562,7 @@ declare class DataController {
33993
34562
  * console.log(`Transaction: ${result.transactionHash}`);
33994
34563
  * ```
33995
34564
  */
33996
- addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<FilePermissionResult>;
34565
+ addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
33997
34566
  /**
33998
34567
  * Submits a file permission transaction and returns the transaction hash immediately.
33999
34568
  *
@@ -34010,7 +34579,7 @@ declare class DataController {
34010
34579
  * console.log(`Transaction submitted: ${txHash}`);
34011
34580
  * ```
34012
34581
  */
34013
- submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<Hash>;
34582
+ submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
34014
34583
  /**
34015
34584
  * Gets the encrypted key for a specific account's permission to access a file.
34016
34585
  *
@@ -34397,6 +34966,31 @@ interface Chains {
34397
34966
  }
34398
34967
  declare const chains: Chains;
34399
34968
 
34969
+ /**
34970
+ * Creates or retrieves a cached public client for blockchain read operations.
34971
+ *
34972
+ * @remarks
34973
+ * This function provides an optimized way to access blockchain data by maintaining
34974
+ * a cached client instance per chain. The client is used for reading contract state,
34975
+ * querying events, and other read-only blockchain operations. It automatically
34976
+ * handles HTTP transport configuration and chain switching.
34977
+ *
34978
+ * @param chainId - The chain ID to connect to (defaults to Moksha testnet)
34979
+ * @returns A public client configured for the specified chain with caching optimization
34980
+ * @throws {Error} When the specified chain ID is not supported by the SDK
34981
+ * @example
34982
+ * ```typescript
34983
+ * // Get client for default chain (Moksha testnet)
34984
+ * const client = createClient();
34985
+ *
34986
+ * // Get client for specific chain
34987
+ * const mainnetClient = createClient(14800);
34988
+ *
34989
+ * // Use client for blockchain reads
34990
+ * const blockNumber = await client.getBlockNumber();
34991
+ * ```
34992
+ * @category Blockchain
34993
+ */
34400
34994
  declare const createClient: (chainId?: keyof typeof chains) => PublicClient & {
34401
34995
  chain: Chain;
34402
34996
  };
@@ -35115,51 +35709,157 @@ declare class SerializationError extends VanaError {
35115
35709
  constructor(message: string);
35116
35710
  }
35117
35711
  /**
35118
- * Error thrown when a signature operation fails.
35712
+ * Thrown when a signature operation fails or cannot be completed.
35119
35713
  *
35120
35714
  * @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.
35715
+ * This error occurs when wallet signature operations fail due to disconnection,
35716
+ * locked accounts, or other wallet-related issues. It preserves the original
35717
+ * error for debugging while providing consistent error handling across the SDK.
35718
+ *
35719
+ * Recovery strategies:
35720
+ * - Check wallet connection and account unlock status
35721
+ * - Retry operation with explicit user interaction
35722
+ * - For gasless operations, consider switching to direct transactions
35723
+ *
35724
+ * @example
35725
+ * ```typescript
35726
+ * try {
35727
+ * await vana.permissions.grant({ grantee: '0x...' });
35728
+ * } catch (error) {
35729
+ * if (error instanceof SignatureError) {
35730
+ * // Prompt user to unlock wallet
35731
+ * await promptWalletUnlock();
35732
+ * // Retry operation
35733
+ * }
35734
+ * }
35735
+ * ```
35736
+ * @category Error Handling
35124
35737
  */
35125
35738
  declare class SignatureError extends VanaError {
35126
35739
  readonly originalError?: Error | undefined;
35127
35740
  constructor(message: string, originalError?: Error | undefined);
35128
35741
  }
35129
35742
  /**
35130
- * Error thrown when a network operation fails.
35743
+ * Thrown when network communication fails during API calls or blockchain interactions.
35131
35744
  *
35132
35745
  * @remarks
35133
- * Recovery strategies: Check network connectivity, retry with exponential backoff,
35134
- * verify API endpoints are accessible, or switch to alternative network providers.
35746
+ * This error encompasses network connectivity issues, API unavailability,
35747
+ * timeout errors, and CORS restrictions. It's commonly encountered during
35748
+ * IPFS operations, subgraph queries, or RPC calls.
35749
+ *
35750
+ * Recovery strategies:
35751
+ * - Check network connectivity
35752
+ * - Retry with exponential backoff
35753
+ * - Verify API endpoints are accessible
35754
+ * - Switch to alternative network providers or gateways
35755
+ *
35756
+ * @example
35757
+ * ```typescript
35758
+ * try {
35759
+ * const files = await vana.data.getUserFiles({ owner: '0x...' });
35760
+ * } catch (error) {
35761
+ * if (error instanceof NetworkError) {
35762
+ * // Implement retry with exponential backoff
35763
+ * await retryWithBackoff(() => vana.data.getUserFiles({ owner: '0x...' }));
35764
+ * }
35765
+ * }
35766
+ * ```
35767
+ * @category Error Handling
35135
35768
  */
35136
35769
  declare class NetworkError extends VanaError {
35137
35770
  readonly originalError?: Error | undefined;
35138
35771
  constructor(message: string, originalError?: Error | undefined);
35139
35772
  }
35140
35773
  /**
35141
- * Error thrown when the nonce retrieval fails.
35774
+ * Thrown when transaction nonce retrieval fails during gasless operations.
35142
35775
  *
35143
35776
  * @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.
35777
+ * This error occurs when the SDK cannot retrieve the user's current nonce from
35778
+ * smart contracts, preventing gasless transaction submission. Nonces are critical
35779
+ * for preventing replay attacks in signed transactions.
35780
+ *
35781
+ * Recovery strategies:
35782
+ * - Retry nonce retrieval after brief delay
35783
+ * - Check wallet connection and account status
35784
+ * - Use manual nonce specification if supported by the operation
35785
+ * - Switch to direct transactions as fallback
35786
+ *
35787
+ * @example
35788
+ * ```typescript
35789
+ * try {
35790
+ * await vana.permissions.grant({ grantee: '0x...' });
35791
+ * } catch (error) {
35792
+ * if (error instanceof NonceError) {
35793
+ * // Wait and retry
35794
+ * await delay(1000);
35795
+ * await vana.permissions.grant({ grantee: '0x...' });
35796
+ * }
35797
+ * }
35798
+ * ```
35799
+ * @category Error Handling
35146
35800
  */
35147
35801
  declare class NonceError extends VanaError {
35148
35802
  constructor(message: string);
35149
35803
  }
35150
35804
  /**
35151
- * Error thrown when a personal server operation fails.
35805
+ * Thrown when personal server operations fail or cannot be completed.
35152
35806
  *
35153
35807
  * @remarks
35154
- * Recovery strategies: Verify server URL accessibility, check server trust status via
35155
- * `vana.permissions.getUserTrustedServers()`, or retry after server becomes available.
35808
+ * This error occurs during interactions with personal servers for computation
35809
+ * requests, identity retrieval, or operation status checks. Common causes include
35810
+ * server unavailability, untrusted server status, or invalid permission grants.
35811
+ *
35812
+ * Recovery strategies:
35813
+ * - Verify server URL accessibility
35814
+ * - Check server trust status via `vana.permissions.getTrustedServers()`
35815
+ * - Ensure valid permissions exist for the operation
35816
+ * - Retry after server becomes available
35817
+ *
35818
+ * @example
35819
+ * ```typescript
35820
+ * try {
35821
+ * const result = await vana.server.createOperation({ permissionId: 123 });
35822
+ * } catch (error) {
35823
+ * if (error instanceof PersonalServerError) {
35824
+ * // Check if server is trusted
35825
+ * const trustedServers = await vana.permissions.getTrustedServers();
35826
+ * if (!trustedServers.includes(serverId)) {
35827
+ * await vana.permissions.trustServer({ serverId });
35828
+ * }
35829
+ * }
35830
+ * }
35831
+ * ```
35832
+ * @category Error Handling
35156
35833
  */
35157
35834
  declare class PersonalServerError extends VanaError {
35158
35835
  readonly originalError?: Error | undefined;
35159
35836
  constructor(message: string, originalError?: Error | undefined);
35160
35837
  }
35161
35838
  /**
35162
- * Error thrown when trying to register a server with a URL that doesn't match the existing registration.
35839
+ * Thrown when attempting to register a server with a URL different from its existing registration.
35840
+ *
35841
+ * @remarks
35842
+ * This error occurs when trying to add or trust a server that's already registered
35843
+ * on-chain with a different URL. Server URLs are immutable once registered to
35844
+ * maintain consistency and security. Applications should use the existing URL
35845
+ * or register a new server with a different ID.
35846
+ *
35847
+ * @example
35848
+ * ```typescript
35849
+ * try {
35850
+ * await vana.permissions.addAndTrustServer({
35851
+ * serverId: 1,
35852
+ * serverUrl: 'https://new-url.com',
35853
+ * publicKey: '0x...'
35854
+ * });
35855
+ * } catch (error) {
35856
+ * if (error instanceof ServerUrlMismatchError) {
35857
+ * console.log(`Server already registered with: ${error.existingUrl}`);
35858
+ * // Use existing URL or register new server
35859
+ * }
35860
+ * }
35861
+ * ```
35862
+ * @category Error Handling
35163
35863
  */
35164
35864
  declare class ServerUrlMismatchError extends VanaError {
35165
35865
  constructor(existingUrl: string, providedUrl: string, serverId: string);
@@ -35168,7 +35868,25 @@ declare class ServerUrlMismatchError extends VanaError {
35168
35868
  readonly serverId: string;
35169
35869
  }
35170
35870
  /**
35171
- * Error thrown when a permission operation fails.
35871
+ * Thrown when permission grant, revoke, or validation operations fail.
35872
+ *
35873
+ * @remarks
35874
+ * This error occurs during permission management operations including grants,
35875
+ * revocations, and permission validation checks. Common causes include invalid
35876
+ * grantee addresses, expired permissions, or insufficient privileges.
35877
+ *
35878
+ * @example
35879
+ * ```typescript
35880
+ * try {
35881
+ * await vana.permissions.revoke({ permissionId: 999999 });
35882
+ * } catch (error) {
35883
+ * if (error instanceof PermissionError) {
35884
+ * console.error('Permission operation failed:', error.message);
35885
+ * // Permission may not exist or user may not be owner
35886
+ * }
35887
+ * }
35888
+ * ```
35889
+ * @category Error Handling
35172
35890
  */
35173
35891
  declare class PermissionError extends VanaError {
35174
35892
  readonly originalError?: Error | undefined;
@@ -36176,21 +36894,53 @@ declare function withSignatureCache(cache: VanaCacheAdapter, walletAddress: stri
36176
36894
 
36177
36895
  declare const CONTRACT_ADDRESSES: Record<number, Record<string, string>>;
36178
36896
  /**
36179
- * Retrieves the deployed contract address for a specific contract on a given chain.
36897
+ * Retrieves the deployed contract address for a specific Vana protocol contract on a given chain.
36180
36898
  *
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
36899
+ * @remarks
36900
+ * This function provides type-safe access to contract addresses across all supported Vana networks.
36901
+ * It automatically searches both current and legacy contract registries to ensure backwards
36902
+ * compatibility while providing clear error messages for unsupported combinations.
36903
+ *
36904
+ * The function validates that both the chain ID and contract name are supported before
36905
+ * attempting address lookup, helping developers identify deployment or configuration issues
36906
+ * early in the development process.
36907
+ *
36908
+ * **Supported Chains:**
36909
+ * - 14800: Vana Mainnet
36910
+ * - 1480: Moksha Testnet
36911
+ *
36912
+ * **Contract Categories:**
36913
+ * - Data Management: DataRegistry, DataRefinerRegistry
36914
+ * - Permissions: DataPortabilityPermissions, DataPortabilityServers, DataPortabilityGrantees
36915
+ * - Computing: TeePoolPhala, TeePoolDedicatedGpu, etc.
36916
+ * - Token & Governance: DATImplementation, VanaPoolStaking, etc.
36917
+ *
36918
+ * @param chainId - The chain ID to look up the contract on (14800 for mainnet, 1480 for testnet)
36919
+ * @param contract - The contract name to get the address for (use TypeScript autocomplete for available options)
36920
+ * @returns The contract address as a checksummed hex string (0x...)
36921
+ * @throws {Error} When contract address not found for the specified contract and chain combination.
36922
+ * This typically indicates the contract is not deployed on the requested network.
36185
36923
  * @example
36186
36924
  * ```typescript
36925
+ * // Get core protocol contract addresses
36926
+ * const dataRegistry = getContractAddress(14800, 'DataRegistry');
36927
+ * const permissions = getContractAddress(14800, 'DataPortabilityPermissions');
36928
+ * const trustedServers = getContractAddress(14800, 'DataPortabilityServers');
36929
+ *
36930
+ * // Handle unsupported combinations gracefully
36187
36931
  * try {
36188
- * const dataRegistryAddress = getContractAddress(1480, 'DataRegistry');
36189
- * console.log('DataRegistry address:', dataRegistryAddress);
36932
+ * const address = getContractAddress(1480, 'DataRegistry');
36933
+ * console.log('DataRegistry testnet address:', address);
36190
36934
  * } catch (error) {
36191
- * console.error('Contract not deployed on this chain:', error.message);
36935
+ * console.error('Contract not available on testnet:', error.message);
36936
+ * // Fallback to mainnet or show user-friendly error
36192
36937
  * }
36938
+ *
36939
+ * // TypeScript provides autocomplete for contract names
36940
+ * const poolAddress = getContractAddress(14800, 'TeePoolPhala'); // ✅ Valid
36941
+ * // const invalid = getContractAddress(14800, 'InvalidContract'); // ❌ TypeScript error
36193
36942
  * ```
36943
+ * @category Configuration
36194
36944
  */
36195
36945
  declare const getContractAddress: (chainId: keyof typeof CONTRACT_ADDRESSES, contract: VanaContract) => `0x${string}`;
36196
36946
 
@@ -36365,6 +37115,10 @@ declare class CircuitBreaker {
36365
37115
  *
36366
37116
  * This implementation uses browser-compatible libraries and configurations
36367
37117
  * to provide crypto, PGP, and HTTP functionality without Node.js dependencies.
37118
+ *
37119
+ * WARNING: Dependencies that access globals during init
37120
+ * MUST be dynamically imported to support Turbopack.
37121
+ * See: https://github.com/vercel/next.js/issues/82632
36368
37122
  */
36369
37123
 
36370
37124
  /**
@@ -36704,4 +37458,4 @@ declare function Vana(config: VanaConfig): VanaBrowserImpl;
36704
37458
  */
36705
37459
  type VanaInstance = VanaBrowserImpl;
36706
37460
 
36707
- 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, type Nominal, type NonNullable, NonceError, type NotFoundErrorResponse, type Observable, type Observer, type OmitByType, type OnChainPermissionGrant, type OperationErrorResponse, OperationNotAllowedError, type OptionalKeys, type PaginatedGrantees, type PaginatedTrustedServers, type PaginationParams, type PaginationResult, type PartialExcept, type Permission, type PermissionAnalytics, type PermissionCheckResult, PermissionError, type PermissionEvent, type PermissionGrantDomain, type PermissionGrantMessage, type PermissionGrantTypedData, type PermissionInfo, type PermissionInputMessage, type PermissionOperation, type PermissionQueryResult, type PermissionStatus, PermissionsController, PersonalServerError, type PersonalServerIdentity, type PersonalServerModel, type PickByType, type PinataListResponse, type PinataPin, PinataStorage, type PinataUploadResponse, type Plugin, type PostRequestParams, type PromiseResult, ProtocolController, type QueryPermissionsParams, type RateLimitInfo, RateLimiter, type RateLimiterConfig, type Refiner, type RegisterGranteeInput, type RegisterGranteeParams, type RegisterGranteeTypedData, type RelayerCallbacks, type RelayerConfig, RelayerError, type RelayerErrorResponse, type RelayerMetrics, type RelayerQueueInfo, type RelayerRequestOptions, type RelayerStatus, type RelayerStorageResponse, type RelayerStoreParams, type RelayerSubmitParams, type RelayerTransactionResponse, type RelayerTransactionStatus, type RelayerWebhookConfig, type RelayerWebhookPayload, type ReplicateAPIResponse, type ReplicateStatus, type Repository, type RequestOptions, type RequireKeys, type RequiredExcept, type RetryConfig, RetryUtility, type RevokePermissionInput, type RevokePermissionParams, type RuntimeConfig, type Schema, SchemaValidationError, SchemaValidator, SerializationError, type Server, type components as ServerComponents, ServerController, type $defs as ServerDefs, type ServerFilesAndPermissionParams, type ServerFilesAndPermissionTypedData, type ServerInfo, type operations as ServerOperations, type paths as ServerPaths, type ServerTrustStatus, ServerUrlMismatchError, type webhooks as ServerWebhooks, type Service, SignatureCache, SignatureError, type SimplifiedPermissionMessage, type StateMachine, type StatusInfo, type StorageCallbacks, type StorageConfig, type StorageDownloadOptions, StorageError, type StorageFile, type StorageListOptions, type StorageListResult, StorageManager, type StorageProvider, type StorageProviderConfig, type StorageRequiredMarker, type StorageUploadResult, type TimeRange, type TransactionOptions, type TransactionReceipt, type Transformer, type TrustServerInput, type TrustServerParams, type TrustServerTypedData, type TrustedServer, type TrustedServerInfo, type 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, VanaBrowserImpl, type VanaChain, type VanaChainConfig, type VanaChainId, type VanaConfig, type VanaConfigWithStorage, type VanaContract, type VanaContract as VanaContractAbi, type VanaContractInstance, type VanaContractName, VanaCore, VanaCoreFactory, VanaError, type VanaInstance, type VanaPlatformAdapter, type WalletConfig, type WalletConfigWithStorage, __contractCache, chains, checkGrantAccess, clearContractCache, type components, convertIpfsUrl, convertIpfsUrlWithFallbacks, createAndStoreGrant, createBrowserPlatformAdapter, createGrantFile, createPlatformAdapterSafe, createValidatedGrant, decryptBlobWithSignedKey, decryptWithPrivateKey, decryptWithWalletPrivateKey, Vana as default, detectPlatform, encryptBlobWithSignedKey, encryptFileKey, encryptWithWalletPublicKey, extractIpfsHash, fetchAndValidateSchema, fetchWithFallbacks, formatEth, formatNumber, formatToken, generateEncryptionKey, generateEncryptionKeyPair, generatePGPKeyPair, getAbi, getAllChains, getChainConfig, getContractAddress, getContractController, getContractInfo, getEncryptionParameters, getGatewayUrls, getGrantFileHash, getGrantTimeRemaining, getPlatformCapabilities, hasStorageConfig, isAPIResponse, isChainConfig, isGrantExpired, isIpfsUrl, isPlatformSupported, isReplicateAPIResponse, isVanaChain, isVanaChainId, isWalletConfig, moksha, mokshaTestnet, type operations, parseReplicateOutput, type paths, retrieveAndValidateGrant, retrieveGrantFile, safeParseJSON, schemaValidator, shortenAddress, storeGrantFile, summarizeGrant, validateDataAgainstSchema, validateDataSchema, validateGrant, validateGrantExpiry, validateGrantFile, validateGranteeAccess, validateOperationAccess, vanaMainnet, type webhooks, withSignatureCache };
37461
+ export { type $defs, type APIResponse, type AddAndTrustServerInput, type AddAndTrustServerParams, type AddAndTrustServerTypedData, type AddRefinerParams, type AddRefinerResult, type AddSchemaParams, type AddSchemaResult, type AllKeys, ApiClient, type ApiClientConfig, type ApiResponse, AsyncQueue, type AsyncResult, type AuthenticationErrorResponse, type Awaited, type BaseConfig, type BaseConfigWithStorage, BaseController, type BatchServerInfoResult, type BatchUploadParams, type BatchUploadResult, type BlockRange, BlockchainError, type BlockchainErrorResponse, type Brand, BrowserPlatformAdapter, type Cache, type CacheConfig, CallbackStorage, type ChainConfig, type ChainConfigWithStorage, type CheckPermissionParams, CircuitBreaker, type ComputeErrorResponse, type ConditionalOptional, type ConfigValidationOptions, type ConfigValidationResult, type ContractAddresses, type ContractCall, type ContractDeployment, ContractFactory, type ContractInfo, type ContractMethodParams, type ContractMethodReturnType, ContractNotFoundError, type Controller, type ControllerContext, type CreateOperationParams, type CreateOperationRequest, type CreateOperationResponse, type CreateSchemaParams, type CreateSchemaResult, DEFAULT_ENCRYPTION_SEED, DEFAULT_IPFS_GATEWAY, DataController, type DataSchema, type DecryptionErrorResponse, type DeepPartial, type DeepReadonly, type DeleteFileParams, type DeleteFileResult, type DownloadFileParams, type DownloadFileResult, type EncryptedUploadParams, type EncryptionInfo, type ErrorResponse, EventEmitter, type EventFilter, type EventLog, type Factory, type FileAccessErrorResponse, type FileAccessPermissions, type FileMetadata, type FilePermissionParams, type FileSharingConfig, type GasEstimate, type GenericRequest, type GenericResponse, type GenericTypedData, type GetFileParams, type GetOperationResponse, type GetUserFilesParams, type GetUserPermissionsOptions, type GetUserTrustedServersParams, GoogleDriveStorage, GrantExpiredError, type GrantFile, type GrantPermissionParams, GrantSchemaError, GrantValidationError, type GrantValidationErrorResponse, type GrantValidationOptions, type GrantValidationResult, type GrantedPermission, type Grantee, type GranteeInfo, GranteeMismatchError, type GranteeQueryOptions, type HttpMethod, IPFS_GATEWAYS, type IdentityResponseModel, type InitPersonalServerParams, type InternalServerErrorResponse, InvalidConfigurationError, IpfsStorage, type LegacyPermissionParams, type MaybeArray, type MaybePromise, MemoryCache, type Middleware, MiddlewarePipeline, NetworkError, type NetworkInfo, type Nominal, type NonNullable, NonceError, type NotFoundErrorResponse, type Observable, type Observer, type OmitByType, type OnChainPermissionGrant, type OperationErrorResponse, OperationNotAllowedError, type OptionalKeys, type PaginatedGrantees, type PaginatedTrustedServers, type PaginationParams, type PaginationResult, type PartialExcept, type Permission, type PermissionAnalytics, type PermissionCheckResult, PermissionError, type PermissionEvent, type PermissionGrantDomain, type PermissionGrantMessage, type PermissionGrantTypedData, type PermissionInfo, type PermissionInputMessage, type PermissionOperation, type PermissionQueryResult, type PermissionStatus, PermissionsController, PersonalServerError, type PersonalServerIdentity, type PersonalServerModel, type PickByType, type PinataListResponse, type PinataPin, PinataStorage, type PinataUploadResponse, type Plugin, type PostRequestParams, type PromiseResult, ProtocolController, type QueryPermissionsParams, type RateLimitInfo, RateLimiter, type RateLimiterConfig, type Refiner, type RegisterGranteeInput, type RegisterGranteeParams, type RegisterGranteeTypedData, type RelayerCallbacks, type RelayerConfig, RelayerError, type RelayerErrorResponse, type RelayerMetrics, type RelayerQueueInfo, type RelayerRequestOptions, type RelayerStatus, type RelayerStorageResponse, type RelayerStoreParams, type RelayerSubmitParams, type RelayerTransactionResponse, type RelayerTransactionStatus, type RelayerWebhookConfig, type RelayerWebhookPayload, type ReplicateAPIResponse, type ReplicateStatus, type Repository, type RequestOptions, type RequireKeys, type RequiredExcept, type RetryConfig, RetryUtility, type RevokePermissionInput, type RevokePermissionParams, type RuntimeConfig, type Schema, SchemaValidationError, SchemaValidator, SerializationError, type Server, type components as ServerComponents, ServerController, type $defs as ServerDefs, type ServerFilesAndPermissionParams, type ServerFilesAndPermissionTypedData, type ServerInfo, type operations as ServerOperations, type paths as ServerPaths, type ServerTrustStatus, ServerUrlMismatchError, type webhooks as ServerWebhooks, type Service, SignatureCache, SignatureError, type SimplifiedPermissionMessage, type StateMachine, type StatusInfo, type StorageCallbacks, type StorageConfig, type StorageDownloadOptions, StorageError, type StorageFile, type StorageListOptions, type StorageListResult, StorageManager, type StorageProvider, type StorageProviderConfig, type StorageRequiredMarker, type StorageUploadResult, type TimeRange, TransactionHandle, type TransactionOptions, type TransactionReceipt, type Transformer, type TrustServerInput, type TrustServerParams, type TrustServerTypedData, type TrustedServer, type TrustedServerInfo, type TrustedServerQueryOptions, type UnencryptedUploadParams, type UntrustServerInput, type UntrustServerParams, type UntrustServerTypedData, type UpdateSchemaIdParams, type UpdateSchemaIdResult, type UploadEncryptedFileResult, type UploadFileParams, type UploadFileResult, type UploadParams, type UploadProgress, type UploadResult, type UserFile, UserRejectedRequestError, type ValidationErrorResponse, type ValidationResult, type Validator, Vana, VanaBrowserImpl, type VanaChain, type VanaChainConfig, type VanaChainId, type VanaConfig, type VanaConfigWithStorage, type VanaContract, type VanaContract as VanaContractAbi, type VanaContractInstance, type VanaContractName, VanaCore, VanaCoreFactory, VanaError, type VanaInstance, type VanaPlatformAdapter, type WalletConfig, type WalletConfigWithStorage, __contractCache, chains, checkGrantAccess, clearContractCache, type components, convertIpfsUrl, convertIpfsUrlWithFallbacks, createAndStoreGrant, createBrowserPlatformAdapter, createGrantFile, createPlatformAdapterSafe, createValidatedGrant, decryptBlobWithSignedKey, decryptWithPrivateKey, decryptWithWalletPrivateKey, Vana as default, detectPlatform, encryptBlobWithSignedKey, encryptFileKey, encryptWithWalletPublicKey, extractIpfsHash, fetchAndValidateSchema, fetchWithFallbacks, formatEth, formatNumber, formatToken, generateEncryptionKey, generateEncryptionKeyPair, generatePGPKeyPair, getAbi, getAllChains, getChainConfig, getContractAddress, getContractController, getContractInfo, getEncryptionParameters, getGatewayUrls, getGrantFileHash, getGrantTimeRemaining, getPlatformCapabilities, hasStorageConfig, isAPIResponse, isChainConfig, isGrantExpired, isIpfsUrl, isPlatformSupported, isReplicateAPIResponse, isVanaChain, isVanaChainId, isWalletConfig, moksha, mokshaTestnet, type operations, parseReplicateOutput, type paths, retrieveAndValidateGrant, retrieveGrantFile, safeParseJSON, schemaValidator, shortenAddress, storeGrantFile, summarizeGrant, validateDataAgainstSchema, validateDataSchema, validateGrant, validateGrantExpiry, validateGrantFile, validateGranteeAccess, validateOperationAccess, vanaMainnet, type webhooks, withSignatureCache };