@opendatalabs/vana-sdk 0.1.0-alpha.2b6935d → 0.1.0-alpha.2e77fcc

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 (171) hide show
  1. package/dist/browser.cjs.map +1 -1
  2. package/dist/browser.d.ts +33 -1
  3. package/dist/browser.js.map +1 -1
  4. package/dist/chains/index.cjs.map +1 -1
  5. package/dist/chains/index.d.ts +30 -1
  6. package/dist/chains/index.js.map +1 -1
  7. package/dist/config/chains.cjs.map +1 -1
  8. package/dist/config/chains.d.ts +99 -0
  9. package/dist/config/chains.js.map +1 -1
  10. package/dist/contracts/contractController.cjs.map +1 -1
  11. package/dist/contracts/contractController.d.ts +66 -10
  12. package/dist/contracts/contractController.js.map +1 -1
  13. package/dist/controllers/base.cjs +33 -0
  14. package/dist/controllers/base.cjs.map +1 -1
  15. package/dist/controllers/base.d.ts +10 -0
  16. package/dist/controllers/base.js +33 -0
  17. package/dist/controllers/base.js.map +1 -1
  18. package/dist/controllers/data.cjs +162 -133
  19. package/dist/controllers/data.cjs.map +1 -1
  20. package/dist/controllers/data.d.ts +222 -184
  21. package/dist/controllers/data.js +162 -133
  22. package/dist/controllers/data.js.map +1 -1
  23. package/dist/controllers/permissions.cjs +208 -60
  24. package/dist/controllers/permissions.cjs.map +1 -1
  25. package/dist/controllers/permissions.d.ts +75 -45
  26. package/dist/controllers/permissions.js +208 -60
  27. package/dist/controllers/permissions.js.map +1 -1
  28. package/dist/controllers/protocol.cjs.map +1 -1
  29. package/dist/controllers/protocol.d.ts +27 -28
  30. package/dist/controllers/protocol.js.map +1 -1
  31. package/dist/controllers/schemas.cjs +23 -21
  32. package/dist/controllers/schemas.cjs.map +1 -1
  33. package/dist/controllers/schemas.d.ts +47 -40
  34. package/dist/controllers/schemas.js +23 -21
  35. package/dist/controllers/schemas.js.map +1 -1
  36. package/dist/controllers/server.cjs +17 -15
  37. package/dist/controllers/server.cjs.map +1 -1
  38. package/dist/controllers/server.d.ts +46 -38
  39. package/dist/controllers/server.js +17 -15
  40. package/dist/controllers/server.js.map +1 -1
  41. package/dist/core/apiClient.cjs +53 -3
  42. package/dist/core/apiClient.cjs.map +1 -1
  43. package/dist/core/apiClient.d.ts +132 -7
  44. package/dist/core/apiClient.js +53 -3
  45. package/dist/core/apiClient.js.map +1 -1
  46. package/dist/core/generics.cjs +30 -3
  47. package/dist/core/generics.cjs.map +1 -1
  48. package/dist/core/generics.d.ts +95 -6
  49. package/dist/core/generics.js +30 -3
  50. package/dist/core/generics.js.map +1 -1
  51. package/dist/core.cjs +4 -1
  52. package/dist/core.cjs.map +1 -1
  53. package/dist/core.d.ts +2 -1
  54. package/dist/core.js +4 -1
  55. package/dist/core.js.map +1 -1
  56. package/dist/index.cjs.map +1 -1
  57. package/dist/index.js.map +1 -1
  58. package/dist/index.node.cjs +2 -3
  59. package/dist/index.node.cjs.map +1 -1
  60. package/dist/index.node.d.ts +33 -13
  61. package/dist/index.node.js +2 -2
  62. package/dist/index.node.js.map +1 -1
  63. package/dist/node.cjs.map +1 -1
  64. package/dist/node.d.ts +39 -1
  65. package/dist/node.js.map +1 -1
  66. package/dist/platform/browser.cjs +160 -2
  67. package/dist/platform/browser.cjs.map +1 -1
  68. package/dist/platform/browser.d.ts +232 -12
  69. package/dist/platform/browser.js +160 -2
  70. package/dist/platform/browser.js.map +1 -1
  71. package/dist/platform/interface.cjs.map +1 -1
  72. package/dist/platform/interface.d.ts +283 -90
  73. package/dist/platform/node.cjs +163 -2
  74. package/dist/platform/node.cjs.map +1 -1
  75. package/dist/platform/node.d.ts +69 -6
  76. package/dist/platform/node.js +163 -2
  77. package/dist/platform/node.js.map +1 -1
  78. package/dist/server/relayerHandler.cjs +136 -98
  79. package/dist/server/relayerHandler.cjs.map +1 -1
  80. package/dist/server/relayerHandler.d.ts +3 -2
  81. package/dist/server/relayerHandler.js +135 -96
  82. package/dist/server/relayerHandler.js.map +1 -1
  83. package/dist/storage/manager.cjs +108 -25
  84. package/dist/storage/manager.cjs.map +1 -1
  85. package/dist/storage/manager.d.ts +119 -25
  86. package/dist/storage/manager.js +108 -25
  87. package/dist/storage/manager.js.map +1 -1
  88. package/dist/storage/providers/callback-storage.cjs +86 -15
  89. package/dist/storage/providers/callback-storage.cjs.map +1 -1
  90. package/dist/storage/providers/callback-storage.d.ts +109 -20
  91. package/dist/storage/providers/callback-storage.js +86 -15
  92. package/dist/storage/providers/callback-storage.js.map +1 -1
  93. package/dist/storage/providers/pinata.cjs.map +1 -1
  94. package/dist/storage/providers/pinata.d.ts +12 -14
  95. package/dist/storage/providers/pinata.js.map +1 -1
  96. package/dist/types/blockchain.cjs.map +1 -1
  97. package/dist/types/blockchain.d.ts +39 -11
  98. package/dist/types/chains.cjs.map +1 -1
  99. package/dist/types/chains.d.ts +74 -7
  100. package/dist/types/chains.js.map +1 -1
  101. package/dist/types/config.cjs.map +1 -1
  102. package/dist/types/config.d.ts +38 -4
  103. package/dist/types/config.js.map +1 -1
  104. package/dist/types/contracts.cjs.map +1 -1
  105. package/dist/types/contracts.d.ts +71 -7
  106. package/dist/types/controller-context.cjs.map +1 -1
  107. package/dist/types/controller-context.d.ts +3 -1
  108. package/dist/types/data.cjs.map +1 -1
  109. package/dist/types/data.d.ts +4 -6
  110. package/dist/types/generics.cjs.map +1 -1
  111. package/dist/types/generics.d.ts +81 -10
  112. package/dist/types/index.cjs.map +1 -1
  113. package/dist/types/index.d.ts +28 -2
  114. package/dist/types/index.js.map +1 -1
  115. package/dist/types/operations.cjs.map +1 -1
  116. package/dist/types/operations.d.ts +178 -15
  117. package/dist/types/operations.js.map +1 -1
  118. package/dist/types/permissions.cjs.map +1 -1
  119. package/dist/types/permissions.d.ts +15 -20
  120. package/dist/types/personal.cjs.map +1 -1
  121. package/dist/types/personal.d.ts +131 -14
  122. package/dist/types/relayer.cjs.map +1 -1
  123. package/dist/types/relayer.d.ts +114 -18
  124. package/dist/types/storage.cjs.map +1 -1
  125. package/dist/types/storage.d.ts +9 -21
  126. package/dist/types/storage.js.map +1 -1
  127. package/dist/types/utils.cjs.map +1 -1
  128. package/dist/types/utils.d.ts +5 -1
  129. package/dist/utils/grantFiles.cjs.map +1 -1
  130. package/dist/utils/grantFiles.d.ts +10 -20
  131. package/dist/utils/grantFiles.js.map +1 -1
  132. package/dist/utils/grantValidation.cjs.map +1 -1
  133. package/dist/utils/grantValidation.d.ts +95 -16
  134. package/dist/utils/grantValidation.js.map +1 -1
  135. package/dist/utils/grants.cjs.map +1 -1
  136. package/dist/utils/grants.d.ts +93 -12
  137. package/dist/utils/grants.js.map +1 -1
  138. package/dist/utils/ipfs.cjs +2 -4
  139. package/dist/utils/ipfs.cjs.map +1 -1
  140. package/dist/utils/ipfs.d.ts +1 -1
  141. package/dist/utils/ipfs.js +2 -4
  142. package/dist/utils/ipfs.js.map +1 -1
  143. package/dist/utils/lazy-import.cjs.map +1 -1
  144. package/dist/utils/lazy-import.d.ts +32 -7
  145. package/dist/utils/lazy-import.js.map +1 -1
  146. package/dist/utils/signatureCache.cjs +8 -2
  147. package/dist/utils/signatureCache.cjs.map +1 -1
  148. package/dist/utils/signatureCache.d.ts +49 -8
  149. package/dist/utils/signatureCache.js +8 -2
  150. package/dist/utils/signatureCache.js.map +1 -1
  151. package/dist/utils/transactionHelpers.cjs.map +1 -1
  152. package/dist/utils/transactionHelpers.d.ts +12 -12
  153. package/dist/utils/transactionHelpers.js.map +1 -1
  154. package/dist/utils/typedDataConverter.cjs.map +1 -1
  155. package/dist/utils/typedDataConverter.d.ts +39 -3
  156. package/dist/utils/typedDataConverter.js.map +1 -1
  157. package/dist/utils/urlResolver.cjs +7 -0
  158. package/dist/utils/urlResolver.cjs.map +1 -1
  159. package/dist/utils/urlResolver.d.ts +22 -4
  160. package/dist/utils/urlResolver.js +7 -0
  161. package/dist/utils/urlResolver.js.map +1 -1
  162. package/dist/utils/wallet.cjs.map +1 -1
  163. package/dist/utils/wallet.d.ts +78 -16
  164. package/dist/utils/wallet.js.map +1 -1
  165. package/package.json +3 -1
  166. package/dist/server/handler.cjs +0 -103
  167. package/dist/server/handler.cjs.map +0 -1
  168. package/dist/server/handler.d.ts +0 -95
  169. package/dist/server/handler.js +0 -79
  170. package/dist/server/handler.js.map +0 -1
  171. /package/dist/tests/{server-handler.test.d.ts → permissions-transaction-options.test.d.ts} +0 -0
@@ -242,35 +242,33 @@ class DataController extends BaseController {
242
242
  }
243
243
  }
244
244
  /**
245
- * Decrypts a file owned by the user using their wallet signature.
245
+ * Decrypts a file using wallet-derived decryption key.
246
246
  *
247
247
  * @remarks
248
- * This is the high-level convenience method for decrypting user files, serving as the
249
- * symmetrical counterpart to the `upload` method. It handles the complete decryption
250
- * workflow including key generation, URL protocol detection, content fetching, and
251
- * decryption.
248
+ * Counterpart to `upload()` for decrypting user files. Automatically
249
+ * generates decryption key from wallet, fetches encrypted content,
250
+ * and decrypts. Supports IPFS (with gateway fallback) and HTTP URLs.
251
+ *
252
+ * @param file - UserFile object from `getUserFiles()`
253
+ * @param options - Decryption options
254
+ * @param options.seed - Custom encryption seed.
255
+ * Defaults to standard Vana seed.
256
+ *
257
+ * @returns Decrypted content as Blob
258
+ *
259
+ * @throws {Error} No wallet connected.
260
+ * Connect wallet before decrypting.
261
+ * @throws {Error} Network error accessing file.
262
+ * Check CORS settings or server availability.
263
+ * @throws {Error} File not found (404).
264
+ * File no longer available at stored URL.
265
+ * @throws {Error} Access denied (403).
266
+ * No permission to access file.
267
+ * @throws {Error} Invalid file format.
268
+ * File not encrypted with Vana protocol.
269
+ * @throws {Error} Wrong encryption key.
270
+ * Verify seed matches upload or use default.
252
271
  *
253
- * The method automatically:
254
- * - Generates the decryption key from the user's wallet signature
255
- * - Determines the appropriate fetch method based on the file URL protocol
256
- * - Fetches the encrypted content from IPFS or standard HTTP URLs
257
- * - Decrypts the content using the generated key
258
- *
259
- * For IPFS URLs, the method uses gateway fallback for improved reliability. For
260
- * standard HTTP URLs, it uses a simple fetch. If you need custom authentication
261
- * headers or specific gateway configurations, use the low-level primitives directly.
262
- *
263
- * @param file - The user file to decrypt (typically from getUserFiles)
264
- * @param encryptionSeed - Optional custom encryption seed (defaults to Vana standard)
265
- * @returns Promise resolving to the decrypted file content as a Blob
266
- * @throws {Error} "No addresses available in wallet client" - When wallet is not connected
267
- * @throws {Error} "Network error: Cannot access the file URL" - When file URL is inaccessible (CORS, server down)
268
- * @throws {Error} "File not found: The encrypted file is no longer available" - When file returns 404
269
- * @throws {Error} "Access denied" - When file returns 403 (no permission)
270
- * @throws {Error} "File is empty or could not be retrieved" - When file has no content
271
- * @throws {Error} "Invalid file format: This file doesn't appear to be encrypted with the Vana protocol" - When file is not properly encrypted
272
- * @throws {Error} "Wrong encryption key" - When decryption fails due to incorrect key/seed
273
- * @throws {Error} "Failed to decrypt file: {error}" - General decryption failures
274
272
  * @example
275
273
  * ```typescript
276
274
  * // Basic file decryption
@@ -386,35 +384,38 @@ class DataController extends BaseController {
386
384
  }
387
385
  }
388
386
  /**
389
- * Retrieves all data files owned by a specific user address.
387
+ * Retrieves all files owned by a specific user address.
390
388
  *
391
389
  * @remarks
392
- * This method queries the Vana subgraph to find files directly owned by the user.
393
- * It efficiently handles large datasets by using the File entity's owner field
394
- * and returns complete file metadata without additional contract calls.
395
- *
396
- * **Deduplication Behavior:**
397
- * The method automatically deduplicates files by ID, keeping only the latest version
398
- * (highest timestamp) when duplicate file IDs are found. This handles cases where
399
- * the subgraph may contain multiple entries for the same file due to re-indexing
400
- * or blockchain reorganizations.
401
- * @param params - The query parameters object
402
- * @param params.owner - The wallet address of the file owner to query
403
- * @param params.subgraphUrl - Optional subgraph URL to override the default endpoint
404
- * @returns A Promise that resolves to an array of UserFile objects with metadata, sorted by latest timestamp first
405
- * @throws {Error} When subgraphUrl is not provided and not configured - "subgraphUrl is required"
406
- * @throws {Error} When subgraph request fails - "Subgraph request failed: {status} {statusText}"
407
- * @throws {Error} When subgraph returns errors - "Subgraph errors: {error messages}"
408
- * @throws {Error} When JSON parsing fails - "Failed to fetch user files from subgraph: {error}"
390
+ * Queries the Vana subgraph for files owned by the specified address.
391
+ * Automatically deduplicates by file ID, keeping the latest version
392
+ * when duplicates exist from re-indexing or chain reorganizations.
393
+ * Enriches results with DLP proof data when available.
394
+ *
395
+ * @param params - Query configuration
396
+ * @param params.owner - Wallet address of the file owner
397
+ * @param params.subgraphUrl - Subgraph endpoint override.
398
+ * Defaults to context configuration.
399
+ *
400
+ * @returns Array of UserFile objects sorted by timestamp (newest first)
401
+ *
402
+ * @throws {Error} Subgraph URL not configured.
403
+ * Provide `subgraphUrl` parameter or configure in Vana constructor.
404
+ * @throws {Error} Subgraph request failed.
405
+ * Check network connectivity and subgraph availability.
406
+ * @throws {Error} Subgraph returned errors.
407
+ * Review query parameters and subgraph logs.
408
+ *
409
409
  * @example
410
410
  * ```typescript
411
- * // Query files for a specific user
412
411
  * const files = await vana.data.getUserFiles({
413
- * owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
412
+ * owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36"
414
413
  * });
415
414
  *
416
415
  * files.forEach(file => {
417
- * console.log(`File ${file.id}: ${file.url} (Schema: ${file.schemaId})`);
416
+ * console.log(`File ${file.id}: ${file.url}`);
417
+ * console.log(` Schema: ${file.schemaId}`);
418
+ * console.log(` DLPs: ${file.dlpIds?.join(", ") || "none"}`);
418
419
  * });
419
420
  * ```
420
421
  */
@@ -1214,18 +1215,26 @@ class DataController extends BaseController {
1214
1215
  }
1215
1216
  }
1216
1217
  /**
1217
- * Gets the total number of files in the registry from the contract.
1218
+ * Retrieves total file count from Data Registry.
1219
+ *
1220
+ * @remarks
1221
+ * Queries blockchain for complete file count across all users.
1222
+ * Useful for pagination and network statistics.
1223
+ *
1224
+ * @returns Total number of registered files
1225
+ *
1226
+ * @throws {Error} Chain ID not available.
1227
+ * Ensure network connection.
1228
+ * @throws {Error} Contract read failed.
1229
+ * Check RPC availability.
1218
1230
  *
1219
- * @returns Promise resolving to the total file count
1220
1231
  * @example
1221
1232
  * ```typescript
1222
- * const totalFiles = await vana.data.getTotalFilesCount();
1223
- * console.log(`Total files in registry: ${totalFiles}`);
1233
+ * const total = await vana.data.getTotalFilesCount();
1234
+ * console.log(`Total files: ${total}`);
1224
1235
  *
1225
- * // Use for pagination calculations
1226
- * const filesPerPage = 20;
1227
- * const totalPages = Math.ceil(totalFiles / filesPerPage);
1228
- * console.log(`Total pages: ${totalPages}`);
1236
+ * // Calculate pagination
1237
+ * const pages = Math.ceil(total / 20);
1229
1238
  * ```
1230
1239
  */
1231
1240
  async getTotalFilesCount() {
@@ -1252,32 +1261,32 @@ class DataController extends BaseController {
1252
1261
  }
1253
1262
  }
1254
1263
  /**
1255
- * Retrieves details for a specific file by its ID.
1264
+ * Retrieves file metadata by ID from the blockchain.
1265
+ *
1266
+ * @remarks
1267
+ * Queries DataRegistry contract directly for file details.
1268
+ * Works for any file ID regardless of ownership, enabling
1269
+ * cross-user file discovery and verification.
1270
+ *
1271
+ * @param fileId - Numeric file ID to retrieve
1272
+ *
1273
+ * @returns UserFile object with metadata
1274
+ *
1275
+ * @throws {Error} Chain ID not available.
1276
+ * Ensure proper network connection.
1277
+ * @throws {Error} File not found.
1278
+ * Verify file ID exists on-chain.
1279
+ * @throws {Error} Contract call failed.
1280
+ * Check network and RPC availability.
1256
1281
  *
1257
- * @param fileId - The file ID to look up
1258
- * @returns Promise resolving to UserFile object
1259
- * @throws {Error} "Chain ID not available" - When wallet chain is not configured
1260
- * @throws {Error} "File not found" - When file ID doesn't exist or returns empty data
1261
- * @throws {Error} "Failed to fetch file {fileId}: {error}" - General contract read failures
1262
1282
  * @example
1263
1283
  * ```typescript
1264
- * try {
1265
- * const file = await vana.data.getFileById(123);
1266
- * console.log('File details:', {
1267
- * id: file.id,
1268
- * url: file.url,
1269
- * owner: file.ownerAddress,
1270
- * addedAt: file.addedAtBlock
1271
- * });
1272
- * } catch (error) {
1273
- * console.error('File not found or error retrieving file:', error);
1274
- * }
1284
+ * const file = await vana.data.getFileById(123);
1285
+ * console.log(`File ${file.id}:`);
1286
+ * console.log(` URL: ${file.url}`);
1287
+ * console.log(` Owner: ${file.ownerAddress}`);
1288
+ * console.log(` Block: ${file.addedAtBlock}`);
1275
1289
  * ```
1276
- *
1277
- * This method queries the DataRegistry contract directly
1278
- * to get file details for any file ID, regardless of user ownership.
1279
- * This is useful for file lookup functionality where users can search
1280
- * for specific files by ID.
1281
1290
  */
1282
1291
  async getFileById(fileId) {
1283
1292
  try {
@@ -1348,7 +1357,7 @@ class DataController extends BaseController {
1348
1357
  * console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
1349
1358
  * ```
1350
1359
  */
1351
- async registerFileWithSchema(url, schemaId) {
1360
+ async registerFileWithSchema(url, schemaId, options) {
1352
1361
  this.assertWallet();
1353
1362
  try {
1354
1363
  const chainId = this.context.publicClient.chain?.id;
@@ -1366,7 +1375,8 @@ class DataController extends BaseController {
1366
1375
  functionName: "addFileWithSchema",
1367
1376
  args: [url, BigInt(schemaId)],
1368
1377
  account,
1369
- chain: this.context.walletClient.chain ?? null
1378
+ chain: this.context.walletClient.chain ?? null,
1379
+ ...this.spreadTransactionOptions(options)
1370
1380
  });
1371
1381
  const { tx } = await import("../utils/transactionHelpers");
1372
1382
  return tx({
@@ -1404,7 +1414,7 @@ class DataController extends BaseController {
1404
1414
  * with specific permissions on the DataRegistry contract. It can be used
1405
1415
  * by both direct transactions and relayer services.
1406
1416
  */
1407
- async addFileWithPermissions(url, ownerAddress, permissions = []) {
1417
+ async addFileWithPermissions(url, ownerAddress, permissions = [], options) {
1408
1418
  this.assertWallet();
1409
1419
  try {
1410
1420
  const chainId = this.context.publicClient.chain?.id;
@@ -1422,7 +1432,8 @@ class DataController extends BaseController {
1422
1432
  functionName: "addFileWithPermissions",
1423
1433
  args: [url, ownerAddress, permissions],
1424
1434
  account,
1425
- chain: this.context.walletClient.chain ?? null
1435
+ chain: this.context.walletClient.chain ?? null,
1436
+ ...this.spreadTransactionOptions(options)
1426
1437
  });
1427
1438
  const { tx } = await import("../utils/transactionHelpers");
1428
1439
  return tx({
@@ -1477,7 +1488,7 @@ class DataController extends BaseController {
1477
1488
  * console.log(`File ${result.fileId} registered in tx ${result.hash}`);
1478
1489
  * ```
1479
1490
  */
1480
- async addFileWithPermissionsAndSchema(url, ownerAddress, permissions = [], schemaId = 0) {
1491
+ async addFileWithPermissionsAndSchema(url, ownerAddress, permissions = [], schemaId = 0, options) {
1481
1492
  this.assertWallet();
1482
1493
  try {
1483
1494
  let encryptedPermissions = [];
@@ -1511,7 +1522,8 @@ class DataController extends BaseController {
1511
1522
  url,
1512
1523
  ownerAddress,
1513
1524
  encryptedPermissions,
1514
- schemaId
1525
+ schemaId,
1526
+ options
1515
1527
  );
1516
1528
  } catch (error) {
1517
1529
  console.error("Failed to add file with permissions and schema:", error);
@@ -1558,7 +1570,7 @@ class DataController extends BaseController {
1558
1570
  * console.log(`File registered in tx ${result.hash}`);
1559
1571
  * ```
1560
1572
  */
1561
- async addFileWithEncryptedPermissionsAndSchema(url, ownerAddress, permissions = [], schemaId = 0) {
1573
+ async addFileWithEncryptedPermissionsAndSchema(url, ownerAddress, permissions = [], schemaId = 0, options) {
1562
1574
  try {
1563
1575
  const chainId = this.context.publicClient.chain?.id;
1564
1576
  if (!chainId) {
@@ -1575,7 +1587,8 @@ class DataController extends BaseController {
1575
1587
  functionName: "addFileWithPermissionsAndSchema",
1576
1588
  args: [url, ownerAddress, permissions, BigInt(schemaId)],
1577
1589
  account,
1578
- chain: this.context.walletClient.chain ?? null
1590
+ chain: this.context.walletClient.chain ?? null,
1591
+ ...this.spreadTransactionOptions(options)
1579
1592
  });
1580
1593
  const { tx } = await import("../utils/transactionHelpers");
1581
1594
  return tx({
@@ -1592,34 +1605,38 @@ class DataController extends BaseController {
1592
1605
  }
1593
1606
  }
1594
1607
  /**
1595
- * Adds a new refiner to the DataRefinerRegistry.
1608
+ * Registers a data refiner for processing templates.
1596
1609
  *
1597
1610
  * @remarks
1598
- * Refiners are data processing templates that define how raw data should be
1599
- * transformed into structured formats. Each refiner is associated with a DLP
1600
- * (Data Liquidity Pool), has a specific schema for output, and includes
1601
- * instructions for the refinement process.
1602
- *
1603
- * @param params - Refiner configuration parameters
1604
- * @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
1605
- * @param params.name - Human-readable name for the refiner
1606
- * @param params.schemaId - Schema ID that defines the output format
1607
- * @param params.refinementInstructionUrl - URL containing processing instructions
1608
- * @returns Promise resolving to the new refiner ID and transaction hash
1609
- * @throws {Error} When chain ID is not available - "Chain ID not available"
1610
- * @throws {Error} When transaction fails - "Failed to add refiner: {error}"
1611
+ * Refiners define data transformation rules for DLPs.
1612
+ * Associates schema, instructions, and processing logic.
1613
+ *
1614
+ * @param params - Refiner configuration
1615
+ * @param params.dlpId - Data Liquidity Pool ID
1616
+ * @param params.name - Refiner display name
1617
+ * @param params.schemaId - Output schema ID.
1618
+ * Obtain via `vana.schemas.list()`.
1619
+ * @param params.refinementInstructionUrl - Processing instructions URL
1620
+ *
1621
+ * @returns Refiner ID and transaction hash
1622
+ *
1623
+ * @throws {Error} Chain ID not available.
1624
+ * Ensure network connection.
1625
+ * @throws {Error} Transaction failed.
1626
+ * Check wallet balance and network status.
1627
+ *
1611
1628
  * @example
1612
1629
  * ```typescript
1613
1630
  * const result = await vana.data.addRefiner({
1614
1631
  * dlpId: 1,
1615
- * name: "Social Media Sentiment Analyzer",
1632
+ * name: "Sentiment Analyzer",
1616
1633
  * schemaId: 42,
1617
1634
  * refinementInstructionUrl: "ipfs://QmXxx..."
1618
1635
  * });
1619
- * console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
1636
+ * console.log(`Refiner ${result.refinerId} created`);
1620
1637
  * ```
1621
1638
  */
1622
- async addRefiner(params) {
1639
+ async addRefiner(params, options) {
1623
1640
  this.assertWallet();
1624
1641
  try {
1625
1642
  const chainId = this.context.publicClient.chain?.id;
@@ -1645,7 +1662,8 @@ class DataController extends BaseController {
1645
1662
  params.refinementInstructionUrl
1646
1663
  ],
1647
1664
  account,
1648
- chain: this.context.walletClient.chain ?? null
1665
+ chain: this.context.walletClient.chain ?? null,
1666
+ ...this.spreadTransactionOptions(options)
1649
1667
  });
1650
1668
  const { tx } = await import("../utils/transactionHelpers");
1651
1669
  const txResult = tx({
@@ -1674,26 +1692,29 @@ class DataController extends BaseController {
1674
1692
  }
1675
1693
  }
1676
1694
  /**
1677
- * Retrieves a refiner by its ID.
1695
+ * Retrieves refiner configuration by ID.
1678
1696
  *
1679
1697
  * @remarks
1680
- * Queries the DataRefinerRegistry contract to get complete information about
1681
- * a specific refiner including its DLP association, schema, and instructions.
1698
+ * Queries DataRefinerRegistry for refiner details.
1699
+ * Returns DLP association, schema, and processing instructions.
1700
+ *
1701
+ * @param refinerId - Numeric refiner ID
1702
+ *
1703
+ * @returns Refiner configuration object
1704
+ *
1705
+ * @throws {Error} Chain ID not available.
1706
+ * Ensure network connection.
1707
+ * @throws {Error} Refiner not found.
1708
+ * Verify refiner ID exists.
1709
+ * @throws {Error} Contract read failed.
1710
+ * Check network and RPC status.
1682
1711
  *
1683
- * @param refinerId - The numeric refiner ID to retrieve
1684
- * @returns Promise resolving to the refiner information object
1685
- * @throws {Error} When chain ID is not available - "Chain ID not available"
1686
- * @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
1687
- * @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
1688
1712
  * @example
1689
1713
  * ```typescript
1690
1714
  * const refiner = await vana.data.getRefiner(1);
1691
- * console.log({
1692
- * name: refiner.name,
1693
- * dlp: refiner.dlpId,
1694
- * schema: refiner.schemaId,
1695
- * instructions: refiner.refinementInstructionUrl
1696
- * });
1715
+ * console.log(`Refiner: ${refiner.name}`);
1716
+ * console.log(`DLP: ${refiner.dlpId}`);
1717
+ * console.log(`Schema: ${refiner.schemaId}`);
1697
1718
  * ```
1698
1719
  */
1699
1720
  async getRefiner(refinerId) {
@@ -1734,21 +1755,27 @@ class DataController extends BaseController {
1734
1755
  }
1735
1756
  }
1736
1757
  /**
1737
- * Validates if a schema ID exists in the registry.
1758
+ * Validates schema ID existence.
1738
1759
  *
1739
1760
  * @remarks
1740
- * Checks the DataRefinerRegistry contract to determine if a given schema ID
1741
- * has been registered and is available for use.
1761
+ * Verifies schema registration in DataRegistry.
1762
+ * Check before using schemas for uploads.
1763
+ *
1764
+ * @param schemaId - Numeric schema ID to validate
1765
+ *
1766
+ * @returns True if schema exists, false otherwise
1767
+ *
1768
+ * @throws {Error} Chain ID not available.
1769
+ * Ensure network connection.
1770
+ * @throws {Error} Contract read failed.
1771
+ * Check RPC availability.
1742
1772
  *
1743
- * @param schemaId - The numeric schema ID to validate
1744
- * @returns Promise resolving to true if schema exists, false otherwise
1745
1773
  * @example
1746
1774
  * ```typescript
1747
- * const isValid = await vana.data.isValidSchemaId(42);
1748
- * if (isValid) {
1749
- * console.log('Schema 42 is available for use');
1750
- * } else {
1751
- * console.log('Schema 42 does not exist');
1775
+ * const valid = await vana.data.isValidSchemaId(42);
1776
+ * if (valid) {
1777
+ * // Safe to use schema 42
1778
+ * await vana.data.upload({ schemaId: 42, ... });
1752
1779
  * }
1753
1780
  * ```
1754
1781
  */
@@ -1836,7 +1863,7 @@ class DataController extends BaseController {
1836
1863
  * console.log(`Schema updated in tx ${result.transactionHash}`);
1837
1864
  * ```
1838
1865
  */
1839
- async updateSchemaId(params) {
1866
+ async updateSchemaId(params, options) {
1840
1867
  this.assertWallet();
1841
1868
  try {
1842
1869
  const chainId = this.context.publicClient.chain?.id;
@@ -1856,7 +1883,8 @@ class DataController extends BaseController {
1856
1883
  functionName: "updateSchemaId",
1857
1884
  args: [BigInt(params.refinerId), BigInt(params.newSchemaId)],
1858
1885
  account,
1859
- chain: this.context.walletClient.chain ?? null
1886
+ chain: this.context.walletClient.chain ?? null,
1887
+ ...this.spreadTransactionOptions(options)
1860
1888
  });
1861
1889
  await this.context.publicClient.waitForTransactionReceipt({ hash });
1862
1890
  return {
@@ -2062,10 +2090,10 @@ class DataController extends BaseController {
2062
2090
  * console.log(`Transaction: ${result.transactionHash}`);
2063
2091
  * ```
2064
2092
  */
2065
- async addPermissionToFile(params) {
2093
+ async addPermissionToFile(params, options) {
2066
2094
  this.assertWallet();
2067
2095
  const { fileId, account, publicKey } = params;
2068
- return await this.submitFilePermission(fileId, account, publicKey);
2096
+ return await this.submitFilePermission(fileId, account, publicKey, options);
2069
2097
  }
2070
2098
  /**
2071
2099
  * Submits a file permission transaction to the blockchain.
@@ -2095,7 +2123,7 @@ class DataController extends BaseController {
2095
2123
  * console.log(`Permission granted with ID: ${result.permissionId}`);
2096
2124
  * ```
2097
2125
  */
2098
- async submitFilePermission(fileId, account, publicKey) {
2126
+ async submitFilePermission(fileId, account, publicKey, options) {
2099
2127
  this.assertWallet();
2100
2128
  try {
2101
2129
  const userEncryptionKey = await generateEncryptionKey(
@@ -2122,7 +2150,8 @@ class DataController extends BaseController {
2122
2150
  functionName: "addFilePermission",
2123
2151
  args: [BigInt(fileId), account, encryptedKey],
2124
2152
  account: walletAccount,
2125
- chain: this.context.walletClient.chain ?? null
2153
+ chain: this.context.walletClient.chain ?? null,
2154
+ ...this.spreadTransactionOptions(options)
2126
2155
  });
2127
2156
  const { tx } = await import("../utils/transactionHelpers");
2128
2157
  return tx({