@opendatalabs/vana-sdk 0.1.0-alpha.a25bcc7 → 0.1.0-alpha.a27f5bd

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 (175) 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 +195 -156
  19. package/dist/controllers/data.cjs.map +1 -1
  20. package/dist/controllers/data.d.ts +222 -184
  21. package/dist/controllers/data.js +195 -156
  22. package/dist/controllers/data.js.map +1 -1
  23. package/dist/controllers/permissions.cjs +311 -244
  24. package/dist/controllers/permissions.cjs.map +1 -1
  25. package/dist/controllers/permissions.d.ts +48 -83
  26. package/dist/controllers/permissions.js +311 -244
  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 +19 -17
  32. package/dist/controllers/schemas.cjs.map +1 -1
  33. package/dist/controllers/schemas.d.ts +47 -40
  34. package/dist/controllers/schemas.js +19 -17
  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 +33 -13
  52. package/dist/core.cjs.map +1 -1
  53. package/dist/core.d.ts +4 -2
  54. package/dist/core.js +33 -13
  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 +5 -3
  59. package/dist/index.node.cjs.map +1 -1
  60. package/dist/index.node.d.ts +35 -13
  61. package/dist/index.node.js +4 -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 +258 -0
  79. package/dist/server/relayerHandler.cjs.map +1 -0
  80. package/dist/server/relayerHandler.d.ts +38 -0
  81. package/dist/server/relayerHandler.js +234 -0
  82. package/dist/server/relayerHandler.js.map +1 -0
  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/tests/factories/mockFactory.d.ts +2 -2
  97. package/dist/tests/relayer-integration.test.d.ts +1 -0
  98. package/dist/tests/relayer-unified.test.d.ts +1 -0
  99. package/dist/tests/server-relayer-handler.test.d.ts +1 -0
  100. package/dist/types/blockchain.cjs.map +1 -1
  101. package/dist/types/blockchain.d.ts +39 -11
  102. package/dist/types/chains.cjs.map +1 -1
  103. package/dist/types/chains.d.ts +74 -7
  104. package/dist/types/chains.js.map +1 -1
  105. package/dist/types/config.cjs.map +1 -1
  106. package/dist/types/config.d.ts +78 -191
  107. package/dist/types/config.js.map +1 -1
  108. package/dist/types/contracts.cjs.map +1 -1
  109. package/dist/types/contracts.d.ts +71 -7
  110. package/dist/types/controller-context.cjs.map +1 -1
  111. package/dist/types/controller-context.d.ts +6 -3
  112. package/dist/types/data.cjs.map +1 -1
  113. package/dist/types/data.d.ts +4 -6
  114. package/dist/types/generics.cjs.map +1 -1
  115. package/dist/types/generics.d.ts +81 -10
  116. package/dist/types/index.cjs.map +1 -1
  117. package/dist/types/index.d.ts +29 -3
  118. package/dist/types/index.js.map +1 -1
  119. package/dist/types/operations.cjs.map +1 -1
  120. package/dist/types/operations.d.ts +178 -15
  121. package/dist/types/operations.js.map +1 -1
  122. package/dist/types/permissions.cjs.map +1 -1
  123. package/dist/types/permissions.d.ts +15 -20
  124. package/dist/types/personal.cjs.map +1 -1
  125. package/dist/types/personal.d.ts +131 -14
  126. package/dist/types/relayer.cjs.map +1 -1
  127. package/dist/types/relayer.d.ts +281 -35
  128. package/dist/types/storage.cjs.map +1 -1
  129. package/dist/types/storage.d.ts +9 -21
  130. package/dist/types/storage.js.map +1 -1
  131. package/dist/utils/grantFiles.cjs.map +1 -1
  132. package/dist/utils/grantFiles.d.ts +10 -20
  133. package/dist/utils/grantFiles.js.map +1 -1
  134. package/dist/utils/grantValidation.cjs.map +1 -1
  135. package/dist/utils/grantValidation.d.ts +95 -16
  136. package/dist/utils/grantValidation.js.map +1 -1
  137. package/dist/utils/grants.cjs.map +1 -1
  138. package/dist/utils/grants.d.ts +93 -12
  139. package/dist/utils/grants.js.map +1 -1
  140. package/dist/utils/ipfs.cjs +2 -4
  141. package/dist/utils/ipfs.cjs.map +1 -1
  142. package/dist/utils/ipfs.d.ts +1 -1
  143. package/dist/utils/ipfs.js +2 -4
  144. package/dist/utils/ipfs.js.map +1 -1
  145. package/dist/utils/lazy-import.cjs.map +1 -1
  146. package/dist/utils/lazy-import.d.ts +32 -7
  147. package/dist/utils/lazy-import.js.map +1 -1
  148. package/dist/utils/signatureCache.cjs +8 -2
  149. package/dist/utils/signatureCache.cjs.map +1 -1
  150. package/dist/utils/signatureCache.d.ts +49 -8
  151. package/dist/utils/signatureCache.js +8 -2
  152. package/dist/utils/signatureCache.js.map +1 -1
  153. package/dist/utils/transactionHelpers.cjs.map +1 -1
  154. package/dist/utils/transactionHelpers.d.ts +12 -12
  155. package/dist/utils/transactionHelpers.js.map +1 -1
  156. package/dist/utils/typedDataConverter.cjs.map +1 -1
  157. package/dist/utils/typedDataConverter.d.ts +39 -3
  158. package/dist/utils/typedDataConverter.js.map +1 -1
  159. package/dist/utils/urlResolver.cjs +7 -0
  160. package/dist/utils/urlResolver.cjs.map +1 -1
  161. package/dist/utils/urlResolver.d.ts +22 -4
  162. package/dist/utils/urlResolver.js +7 -0
  163. package/dist/utils/urlResolver.js.map +1 -1
  164. package/dist/utils/wallet.cjs +2 -1
  165. package/dist/utils/wallet.cjs.map +1 -1
  166. package/dist/utils/wallet.d.ts +78 -16
  167. package/dist/utils/wallet.js +2 -1
  168. package/dist/utils/wallet.js.map +1 -1
  169. package/package.json +3 -1
  170. package/dist/server/handler.cjs +0 -101
  171. package/dist/server/handler.cjs.map +0 -1
  172. package/dist/server/handler.d.ts +0 -87
  173. package/dist/server/handler.js +0 -77
  174. package/dist/server/handler.js.map +0 -1
  175. /package/dist/tests/{server-handler.test.d.ts → permissions-revoke-relayer.test.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/controllers/base.ts"],"sourcesContent":["/**\n * Base controller class providing common functionality for all controllers.\n *\n * @remarks\n * This abstract class establishes the foundation for all Vana SDK controllers,\n * providing shared utilities like wallet validation and context management.\n * All controllers should extend this base class to ensure consistency and\n * shared behavior across the SDK.\n *\n * The class follows the Single Responsibility Principle by handling only\n * the core controller concerns while leaving specific functionality to\n * implementing classes.\n *\n * @category Controllers\n */\n\nimport type { WalletClient } from \"viem\";\nimport type { ControllerContext } from \"../types/controller-context\";\nimport { ReadOnlyError } from \"../errors\";\n\n/**\n * Abstract base controller that all Vana SDK controllers extend.\n *\n * @remarks\n * Provides common functionality and patterns used across all controllers,\n * including wallet validation and context management. This ensures\n * consistency and reduces code duplication throughout the SDK.\n *\n * Key features:\n * - Wallet client validation with TypeScript assertion signatures\n * - Consistent error handling for read-only scenarios\n * - Shared context management patterns\n * - Type-safe wallet operations\n *\n * @example\n * ```typescript\n * class MyController extends BaseController {\n * async performWalletOperation() {\n * this.assertWallet(); // Ensures wallet is available\n * // Now this.context.walletClient is guaranteed to be available\n * const address = await this.context.walletClient.getAddresses();\n * return address[0];\n * }\n * }\n * ```\n */\nexport abstract class BaseController {\n /**\n * Creates a new controller instance with the provided context.\n *\n * @param context - The controller context containing clients and configuration\n */\n constructor(protected readonly context: ControllerContext) {}\n\n /**\n * Asserts that a wallet client with an account is available for operations requiring signing.\n *\n * @remarks\n * This method uses TypeScript assertion signatures to narrow the type of\n * `this.context` to guarantee that `walletClient` with an account is available\n * after the call succeeds. This provides compile-time safety for wallet operations\n * while enabling clear error messages for read-only scenarios.\n *\n * The assertion signature ensures that after calling this method,\n * TypeScript knows that `this.context.walletClient` is definitely available\n * with a configured account.\n *\n * @throws {ReadOnlyError} When no wallet client is configured\n * @throws {Error} When wallet client exists but no account is configured\n *\n * @example\n * ```typescript\n * async performWalletOperation() {\n * this.assertWallet(); // Type assertion + runtime check\n *\n * // TypeScript now knows walletClient and account are available\n * const account = this.context.walletClient.account;\n * const address = typeof account === 'string' ? account : account.address;\n * }\n * ```\n */\n protected assertWallet(): asserts this is {\n context: ControllerContext & { walletClient: WalletClient };\n } {\n if (!this.context.walletClient) {\n // Get the calling method name from the stack trace for better error messages\n const stack = new Error().stack;\n const callingMethod =\n stack?.split(\"\\n\")[2]?.match(/at \\w+\\.(\\w+)/)?.[1] ?? \"this operation\";\n\n throw new ReadOnlyError(\n callingMethod,\n \"Initialize the SDK with a walletClient to perform this operation\",\n );\n }\n\n if (!this.context.walletClient.account) {\n // Get the calling method name from the stack trace for better error messages\n const stack = new Error().stack;\n const callingMethod =\n stack?.split(\"\\n\")[2]?.match(/at \\w+\\.(\\w+)/)?.[1] ?? \"this operation\";\n\n throw new Error(\n `No wallet account connected. Cannot perform ${callingMethod} without an account.`,\n );\n }\n }\n}\n"],"mappings":"AAkBA,SAAS,qBAAqB;AA4BvB,MAAe,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnC,YAA+B,SAA4B;AAA5B;AAAA,EAA6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6BlD,eAER;AACA,QAAI,CAAC,KAAK,QAAQ,cAAc;AAE9B,YAAM,QAAQ,IAAI,MAAM,EAAE;AAC1B,YAAM,gBACJ,OAAO,MAAM,IAAI,EAAE,CAAC,GAAG,MAAM,eAAe,IAAI,CAAC,KAAK;AAExD,YAAM,IAAI;AAAA,QACR;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,QAAI,CAAC,KAAK,QAAQ,aAAa,SAAS;AAEtC,YAAM,QAAQ,IAAI,MAAM,EAAE;AAC1B,YAAM,gBACJ,OAAO,MAAM,IAAI,EAAE,CAAC,GAAG,MAAM,eAAe,IAAI,CAAC,KAAK;AAExD,YAAM,IAAI;AAAA,QACR,+CAA+C,aAAa;AAAA,MAC9D;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/controllers/base.ts"],"sourcesContent":["/**\n * Base controller class providing common functionality for all controllers.\n *\n * @remarks\n * This abstract class establishes the foundation for all Vana SDK controllers,\n * providing shared utilities like wallet validation and context management.\n * All controllers should extend this base class to ensure consistency and\n * shared behavior across the SDK.\n *\n * The class follows the Single Responsibility Principle by handling only\n * the core controller concerns while leaving specific functionality to\n * implementing classes.\n *\n * @category Controllers\n */\n\nimport type { WalletClient } from \"viem\";\nimport type { ControllerContext } from \"../types/controller-context\";\nimport type { TransactionOptions } from \"../types/operations\";\nimport { ReadOnlyError } from \"../errors\";\n\n/**\n * Abstract base controller that all Vana SDK controllers extend.\n *\n * @remarks\n * Provides common functionality and patterns used across all controllers,\n * including wallet validation and context management. This ensures\n * consistency and reduces code duplication throughout the SDK.\n *\n * Key features:\n * - Wallet client validation with TypeScript assertion signatures\n * - Consistent error handling for read-only scenarios\n * - Shared context management patterns\n * - Type-safe wallet operations\n *\n * @example\n * ```typescript\n * class MyController extends BaseController {\n * async performWalletOperation() {\n * this.assertWallet(); // Ensures wallet is available\n * // Now this.context.walletClient is guaranteed to be available\n * const address = await this.context.walletClient.getAddresses();\n * return address[0];\n * }\n * }\n * ```\n */\nexport abstract class BaseController {\n /**\n * Creates a new controller instance with the provided context.\n *\n * @param context - The controller context containing clients and configuration\n */\n constructor(protected readonly context: ControllerContext) {}\n\n /**\n * Asserts that a wallet client with an account is available for operations requiring signing.\n *\n * @remarks\n * This method uses TypeScript assertion signatures to narrow the type of\n * `this.context` to guarantee that `walletClient` with an account is available\n * after the call succeeds. This provides compile-time safety for wallet operations\n * while enabling clear error messages for read-only scenarios.\n *\n * The assertion signature ensures that after calling this method,\n * TypeScript knows that `this.context.walletClient` is definitely available\n * with a configured account.\n *\n * @throws {ReadOnlyError} When no wallet client is configured\n * @throws {Error} When wallet client exists but no account is configured\n *\n * @example\n * ```typescript\n * async performWalletOperation() {\n * this.assertWallet(); // Type assertion + runtime check\n *\n * // TypeScript now knows walletClient and account are available\n * const account = this.context.walletClient.account;\n * const address = typeof account === 'string' ? account : account.address;\n * }\n * ```\n */\n protected assertWallet(): asserts this is {\n context: ControllerContext & { walletClient: WalletClient };\n } {\n if (!this.context.walletClient) {\n // Get the calling method name from the stack trace for better error messages\n const stack = new Error().stack;\n const callingMethod =\n stack?.split(\"\\n\")[2]?.match(/at \\w+\\.(\\w+)/)?.[1] ?? \"this operation\";\n\n throw new ReadOnlyError(\n callingMethod,\n \"Initialize the SDK with a walletClient to perform this operation\",\n );\n }\n\n if (!this.context.walletClient.account) {\n // Get the calling method name from the stack trace for better error messages\n const stack = new Error().stack;\n const callingMethod =\n stack?.split(\"\\n\")[2]?.match(/at \\w+\\.(\\w+)/)?.[1] ?? \"this operation\";\n\n throw new Error(\n `No wallet account connected. Cannot perform ${callingMethod} without an account.`,\n );\n }\n }\n\n /**\n * Helper to safely spread transaction options for viem compatibility.\n * Handles EIP-1559 vs legacy gas pricing correctly.\n *\n * @param options - Transaction options to spread\n * @returns Properly formatted options for viem\n * @internal\n */\n protected spreadTransactionOptions(options?: TransactionOptions) {\n if (!options) return {};\n\n const baseOptions: any = {\n ...(options.nonce !== undefined && { nonce: options.nonce }),\n ...(options.gas !== undefined && { gas: options.gas }),\n };\n\n // EIP-1559 and legacy gasPrice are mutually exclusive in viem\n // If EIP-1559 params are provided, use them and exclude gasPrice\n if (\n options.maxFeePerGas !== undefined ||\n options.maxPriorityFeePerGas !== undefined\n ) {\n return {\n ...baseOptions,\n ...(options.maxFeePerGas !== undefined && {\n maxFeePerGas: options.maxFeePerGas,\n }),\n ...(options.maxPriorityFeePerGas !== undefined && {\n maxPriorityFeePerGas: options.maxPriorityFeePerGas,\n }),\n };\n }\n\n // Otherwise, use legacy gasPrice if provided\n if (options.gasPrice !== undefined) {\n return {\n ...baseOptions,\n gasPrice: options.gasPrice,\n };\n }\n\n return baseOptions;\n }\n}\n"],"mappings":"AAmBA,SAAS,qBAAqB;AA4BvB,MAAe,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnC,YAA+B,SAA4B;AAA5B;AAAA,EAA6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6BlD,eAER;AACA,QAAI,CAAC,KAAK,QAAQ,cAAc;AAE9B,YAAM,QAAQ,IAAI,MAAM,EAAE;AAC1B,YAAM,gBACJ,OAAO,MAAM,IAAI,EAAE,CAAC,GAAG,MAAM,eAAe,IAAI,CAAC,KAAK;AAExD,YAAM,IAAI;AAAA,QACR;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,QAAI,CAAC,KAAK,QAAQ,aAAa,SAAS;AAEtC,YAAM,QAAQ,IAAI,MAAM,EAAE;AAC1B,YAAM,gBACJ,OAAO,MAAM,IAAI,EAAE,CAAC,GAAG,MAAM,eAAe,IAAI,CAAC,KAAK;AAExD,YAAM,IAAI;AAAA,QACR,+CAA+C,aAAa;AAAA,MAC9D;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUU,yBAAyB,SAA8B;AAC/D,QAAI,CAAC,QAAS,QAAO,CAAC;AAEtB,UAAM,cAAmB;AAAA,MACvB,GAAI,QAAQ,UAAU,UAAa,EAAE,OAAO,QAAQ,MAAM;AAAA,MAC1D,GAAI,QAAQ,QAAQ,UAAa,EAAE,KAAK,QAAQ,IAAI;AAAA,IACtD;AAIA,QACE,QAAQ,iBAAiB,UACzB,QAAQ,yBAAyB,QACjC;AACA,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAI,QAAQ,iBAAiB,UAAa;AAAA,UACxC,cAAc,QAAQ;AAAA,QACxB;AAAA,QACA,GAAI,QAAQ,yBAAyB,UAAa;AAAA,UAChD,sBAAsB,QAAQ;AAAA,QAChC;AAAA,MACF;AAAA,IACF;AAGA,QAAI,QAAQ,aAAa,QAAW;AAClC,aAAO;AAAA,QACL,GAAG;AAAA,QACH,UAAU,QAAQ;AAAA,MACpB;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -84,9 +84,8 @@ class DataController extends import_base.BaseController {
84
84
  } catch (error) {
85
85
  isValid = false;
86
86
  if (error instanceof Error) {
87
- const errorDetails = error.errors;
88
- if (errorDetails && Array.isArray(errorDetails)) {
89
- validationErrors = errorDetails;
87
+ if (typeof error === "object" && "errors" in error && Array.isArray(error.errors)) {
88
+ validationErrors = error.errors;
90
89
  } else {
91
90
  validationErrors = [error.message];
92
91
  }
@@ -125,27 +124,26 @@ class DataController extends import_base.BaseController {
125
124
  );
126
125
  }
127
126
  let result;
128
- if (this.context.relayerCallbacks?.submitFileAdditionComplete) {
129
- result = await this.context.relayerCallbacks.submitFileAdditionComplete(
130
- {
127
+ if (this.context.relayer) {
128
+ const request = {
129
+ type: "direct",
130
+ operation: "submitFileAdditionComplete",
131
+ params: {
131
132
  url: uploadResult.url,
132
133
  userAddress,
133
134
  permissions: encryptedPermissions,
134
135
  schemaId: schemaId ?? 0,
135
136
  ownerAddress: owner
136
137
  }
137
- );
138
- } else if (this.context.relayerCallbacks?.submitFileAddition) {
139
- const needsComplexRegistration = schemaId !== void 0 || encryptedPermissions.length > 0;
140
- if (needsComplexRegistration) {
141
- throw new Error(
142
- "The configured relay callback does not support schemas or permissions. Please update your relay server implementation to provide the `submitFileAdditionComplete` callback."
143
- );
138
+ };
139
+ const response = await this.context.relayer(request);
140
+ if (response.type === "error") {
141
+ throw new Error(response.error);
144
142
  }
145
- result = await this.context.relayerCallbacks.submitFileAddition(
146
- uploadResult.url,
147
- userAddress
148
- );
143
+ if (response.type !== "direct" || !("fileId" in response.result)) {
144
+ throw new Error("Invalid response from relayer");
145
+ }
146
+ result = response.result;
149
147
  } else {
150
148
  const txResult = await this.addFileWithEncryptedPermissionsAndSchema(
151
149
  uploadResult.url,
@@ -260,35 +258,33 @@ class DataController extends import_base.BaseController {
260
258
  }
261
259
  }
262
260
  /**
263
- * Decrypts a file owned by the user using their wallet signature.
261
+ * Decrypts a file using wallet-derived decryption key.
264
262
  *
265
263
  * @remarks
266
- * This is the high-level convenience method for decrypting user files, serving as the
267
- * symmetrical counterpart to the `upload` method. It handles the complete decryption
268
- * workflow including key generation, URL protocol detection, content fetching, and
269
- * decryption.
264
+ * Counterpart to `upload()` for decrypting user files. Automatically
265
+ * generates decryption key from wallet, fetches encrypted content,
266
+ * and decrypts. Supports IPFS (with gateway fallback) and HTTP URLs.
267
+ *
268
+ * @param file - UserFile object from `getUserFiles()`
269
+ * @param options - Decryption options
270
+ * @param options.seed - Custom encryption seed.
271
+ * Defaults to standard Vana seed.
272
+ *
273
+ * @returns Decrypted content as Blob
274
+ *
275
+ * @throws {Error} No wallet connected.
276
+ * Connect wallet before decrypting.
277
+ * @throws {Error} Network error accessing file.
278
+ * Check CORS settings or server availability.
279
+ * @throws {Error} File not found (404).
280
+ * File no longer available at stored URL.
281
+ * @throws {Error} Access denied (403).
282
+ * No permission to access file.
283
+ * @throws {Error} Invalid file format.
284
+ * File not encrypted with Vana protocol.
285
+ * @throws {Error} Wrong encryption key.
286
+ * Verify seed matches upload or use default.
270
287
  *
271
- * The method automatically:
272
- * - Generates the decryption key from the user's wallet signature
273
- * - Determines the appropriate fetch method based on the file URL protocol
274
- * - Fetches the encrypted content from IPFS or standard HTTP URLs
275
- * - Decrypts the content using the generated key
276
- *
277
- * For IPFS URLs, the method uses gateway fallback for improved reliability. For
278
- * standard HTTP URLs, it uses a simple fetch. If you need custom authentication
279
- * headers or specific gateway configurations, use the low-level primitives directly.
280
- *
281
- * @param file - The user file to decrypt (typically from getUserFiles)
282
- * @param encryptionSeed - Optional custom encryption seed (defaults to Vana standard)
283
- * @returns Promise resolving to the decrypted file content as a Blob
284
- * @throws {Error} "No addresses available in wallet client" - When wallet is not connected
285
- * @throws {Error} "Network error: Cannot access the file URL" - When file URL is inaccessible (CORS, server down)
286
- * @throws {Error} "File not found: The encrypted file is no longer available" - When file returns 404
287
- * @throws {Error} "Access denied" - When file returns 403 (no permission)
288
- * @throws {Error} "File is empty or could not be retrieved" - When file has no content
289
- * @throws {Error} "Invalid file format: This file doesn't appear to be encrypted with the Vana protocol" - When file is not properly encrypted
290
- * @throws {Error} "Wrong encryption key" - When decryption fails due to incorrect key/seed
291
- * @throws {Error} "Failed to decrypt file: {error}" - General decryption failures
292
288
  * @example
293
289
  * ```typescript
294
290
  * // Basic file decryption
@@ -404,35 +400,38 @@ class DataController extends import_base.BaseController {
404
400
  }
405
401
  }
406
402
  /**
407
- * Retrieves all data files owned by a specific user address.
403
+ * Retrieves all files owned by a specific user address.
408
404
  *
409
405
  * @remarks
410
- * This method queries the Vana subgraph to find files directly owned by the user.
411
- * It efficiently handles large datasets by using the File entity's owner field
412
- * and returns complete file metadata without additional contract calls.
413
- *
414
- * **Deduplication Behavior:**
415
- * The method automatically deduplicates files by ID, keeping only the latest version
416
- * (highest timestamp) when duplicate file IDs are found. This handles cases where
417
- * the subgraph may contain multiple entries for the same file due to re-indexing
418
- * or blockchain reorganizations.
419
- * @param params - The query parameters object
420
- * @param params.owner - The wallet address of the file owner to query
421
- * @param params.subgraphUrl - Optional subgraph URL to override the default endpoint
422
- * @returns A Promise that resolves to an array of UserFile objects with metadata, sorted by latest timestamp first
423
- * @throws {Error} When subgraphUrl is not provided and not configured - "subgraphUrl is required"
424
- * @throws {Error} When subgraph request fails - "Subgraph request failed: {status} {statusText}"
425
- * @throws {Error} When subgraph returns errors - "Subgraph errors: {error messages}"
426
- * @throws {Error} When JSON parsing fails - "Failed to fetch user files from subgraph: {error}"
406
+ * Queries the Vana subgraph for files owned by the specified address.
407
+ * Automatically deduplicates by file ID, keeping the latest version
408
+ * when duplicates exist from re-indexing or chain reorganizations.
409
+ * Enriches results with DLP proof data when available.
410
+ *
411
+ * @param params - Query configuration
412
+ * @param params.owner - Wallet address of the file owner
413
+ * @param params.subgraphUrl - Subgraph endpoint override.
414
+ * Defaults to context configuration.
415
+ *
416
+ * @returns Array of UserFile objects sorted by timestamp (newest first)
417
+ *
418
+ * @throws {Error} Subgraph URL not configured.
419
+ * Provide `subgraphUrl` parameter or configure in Vana constructor.
420
+ * @throws {Error} Subgraph request failed.
421
+ * Check network connectivity and subgraph availability.
422
+ * @throws {Error} Subgraph returned errors.
423
+ * Review query parameters and subgraph logs.
424
+ *
427
425
  * @example
428
426
  * ```typescript
429
- * // Query files for a specific user
430
427
  * const files = await vana.data.getUserFiles({
431
- * owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
428
+ * owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36"
432
429
  * });
433
430
  *
434
431
  * files.forEach(file => {
435
- * console.log(`File ${file.id}: ${file.url} (Schema: ${file.schemaId})`);
432
+ * console.log(`File ${file.id}: ${file.url}`);
433
+ * console.log(` Schema: ${file.schemaId}`);
434
+ * console.log(` DLPs: ${file.dlpIds?.join(", ") || "none"}`);
436
435
  * });
437
436
  * ```
438
437
  */
@@ -1232,18 +1231,26 @@ class DataController extends import_base.BaseController {
1232
1231
  }
1233
1232
  }
1234
1233
  /**
1235
- * Gets the total number of files in the registry from the contract.
1234
+ * Retrieves total file count from Data Registry.
1235
+ *
1236
+ * @remarks
1237
+ * Queries blockchain for complete file count across all users.
1238
+ * Useful for pagination and network statistics.
1239
+ *
1240
+ * @returns Total number of registered files
1241
+ *
1242
+ * @throws {Error} Chain ID not available.
1243
+ * Ensure network connection.
1244
+ * @throws {Error} Contract read failed.
1245
+ * Check RPC availability.
1236
1246
  *
1237
- * @returns Promise resolving to the total file count
1238
1247
  * @example
1239
1248
  * ```typescript
1240
- * const totalFiles = await vana.data.getTotalFilesCount();
1241
- * console.log(`Total files in registry: ${totalFiles}`);
1249
+ * const total = await vana.data.getTotalFilesCount();
1250
+ * console.log(`Total files: ${total}`);
1242
1251
  *
1243
- * // Use for pagination calculations
1244
- * const filesPerPage = 20;
1245
- * const totalPages = Math.ceil(totalFiles / filesPerPage);
1246
- * console.log(`Total pages: ${totalPages}`);
1252
+ * // Calculate pagination
1253
+ * const pages = Math.ceil(total / 20);
1247
1254
  * ```
1248
1255
  */
1249
1256
  async getTotalFilesCount() {
@@ -1270,32 +1277,32 @@ class DataController extends import_base.BaseController {
1270
1277
  }
1271
1278
  }
1272
1279
  /**
1273
- * Retrieves details for a specific file by its ID.
1280
+ * Retrieves file metadata by ID from the blockchain.
1281
+ *
1282
+ * @remarks
1283
+ * Queries DataRegistry contract directly for file details.
1284
+ * Works for any file ID regardless of ownership, enabling
1285
+ * cross-user file discovery and verification.
1286
+ *
1287
+ * @param fileId - Numeric file ID to retrieve
1288
+ *
1289
+ * @returns UserFile object with metadata
1290
+ *
1291
+ * @throws {Error} Chain ID not available.
1292
+ * Ensure proper network connection.
1293
+ * @throws {Error} File not found.
1294
+ * Verify file ID exists on-chain.
1295
+ * @throws {Error} Contract call failed.
1296
+ * Check network and RPC availability.
1274
1297
  *
1275
- * @param fileId - The file ID to look up
1276
- * @returns Promise resolving to UserFile object
1277
- * @throws {Error} "Chain ID not available" - When wallet chain is not configured
1278
- * @throws {Error} "File not found" - When file ID doesn't exist or returns empty data
1279
- * @throws {Error} "Failed to fetch file {fileId}: {error}" - General contract read failures
1280
1298
  * @example
1281
1299
  * ```typescript
1282
- * try {
1283
- * const file = await vana.data.getFileById(123);
1284
- * console.log('File details:', {
1285
- * id: file.id,
1286
- * url: file.url,
1287
- * owner: file.ownerAddress,
1288
- * addedAt: file.addedAtBlock
1289
- * });
1290
- * } catch (error) {
1291
- * console.error('File not found or error retrieving file:', error);
1292
- * }
1300
+ * const file = await vana.data.getFileById(123);
1301
+ * console.log(`File ${file.id}:`);
1302
+ * console.log(` URL: ${file.url}`);
1303
+ * console.log(` Owner: ${file.ownerAddress}`);
1304
+ * console.log(` Block: ${file.addedAtBlock}`);
1293
1305
  * ```
1294
- *
1295
- * This method queries the DataRegistry contract directly
1296
- * to get file details for any file ID, regardless of user ownership.
1297
- * This is useful for file lookup functionality where users can search
1298
- * for specific files by ID.
1299
1306
  */
1300
1307
  async getFileById(fileId) {
1301
1308
  try {
@@ -1366,7 +1373,7 @@ class DataController extends import_base.BaseController {
1366
1373
  * console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
1367
1374
  * ```
1368
1375
  */
1369
- async registerFileWithSchema(url, schemaId) {
1376
+ async registerFileWithSchema(url, schemaId, options) {
1370
1377
  this.assertWallet();
1371
1378
  try {
1372
1379
  const chainId = this.context.publicClient.chain?.id;
@@ -1384,7 +1391,8 @@ class DataController extends import_base.BaseController {
1384
1391
  functionName: "addFileWithSchema",
1385
1392
  args: [url, BigInt(schemaId)],
1386
1393
  account,
1387
- chain: this.context.walletClient.chain ?? null
1394
+ chain: this.context.walletClient.chain ?? null,
1395
+ ...this.spreadTransactionOptions(options)
1388
1396
  });
1389
1397
  const { tx } = await import("../utils/transactionHelpers");
1390
1398
  return tx({
@@ -1422,7 +1430,7 @@ class DataController extends import_base.BaseController {
1422
1430
  * with specific permissions on the DataRegistry contract. It can be used
1423
1431
  * by both direct transactions and relayer services.
1424
1432
  */
1425
- async addFileWithPermissions(url, ownerAddress, permissions = []) {
1433
+ async addFileWithPermissions(url, ownerAddress, permissions = [], options) {
1426
1434
  this.assertWallet();
1427
1435
  try {
1428
1436
  const chainId = this.context.publicClient.chain?.id;
@@ -1440,7 +1448,8 @@ class DataController extends import_base.BaseController {
1440
1448
  functionName: "addFileWithPermissions",
1441
1449
  args: [url, ownerAddress, permissions],
1442
1450
  account,
1443
- chain: this.context.walletClient.chain ?? null
1451
+ chain: this.context.walletClient.chain ?? null,
1452
+ ...this.spreadTransactionOptions(options)
1444
1453
  });
1445
1454
  const { tx } = await import("../utils/transactionHelpers");
1446
1455
  return tx({
@@ -1495,7 +1504,7 @@ class DataController extends import_base.BaseController {
1495
1504
  * console.log(`File ${result.fileId} registered in tx ${result.hash}`);
1496
1505
  * ```
1497
1506
  */
1498
- async addFileWithPermissionsAndSchema(url, ownerAddress, permissions = [], schemaId = 0) {
1507
+ async addFileWithPermissionsAndSchema(url, ownerAddress, permissions = [], schemaId = 0, options) {
1499
1508
  this.assertWallet();
1500
1509
  try {
1501
1510
  let encryptedPermissions = [];
@@ -1529,7 +1538,8 @@ class DataController extends import_base.BaseController {
1529
1538
  url,
1530
1539
  ownerAddress,
1531
1540
  encryptedPermissions,
1532
- schemaId
1541
+ schemaId,
1542
+ options
1533
1543
  );
1534
1544
  } catch (error) {
1535
1545
  console.error("Failed to add file with permissions and schema:", error);
@@ -1576,7 +1586,7 @@ class DataController extends import_base.BaseController {
1576
1586
  * console.log(`File registered in tx ${result.hash}`);
1577
1587
  * ```
1578
1588
  */
1579
- async addFileWithEncryptedPermissionsAndSchema(url, ownerAddress, permissions = [], schemaId = 0) {
1589
+ async addFileWithEncryptedPermissionsAndSchema(url, ownerAddress, permissions = [], schemaId = 0, options) {
1580
1590
  try {
1581
1591
  const chainId = this.context.publicClient.chain?.id;
1582
1592
  if (!chainId) {
@@ -1593,7 +1603,8 @@ class DataController extends import_base.BaseController {
1593
1603
  functionName: "addFileWithPermissionsAndSchema",
1594
1604
  args: [url, ownerAddress, permissions, BigInt(schemaId)],
1595
1605
  account,
1596
- chain: this.context.walletClient.chain ?? null
1606
+ chain: this.context.walletClient.chain ?? null,
1607
+ ...this.spreadTransactionOptions(options)
1597
1608
  });
1598
1609
  const { tx } = await import("../utils/transactionHelpers");
1599
1610
  return tx({
@@ -1610,34 +1621,38 @@ class DataController extends import_base.BaseController {
1610
1621
  }
1611
1622
  }
1612
1623
  /**
1613
- * Adds a new refiner to the DataRefinerRegistry.
1624
+ * Registers a data refiner for processing templates.
1614
1625
  *
1615
1626
  * @remarks
1616
- * Refiners are data processing templates that define how raw data should be
1617
- * transformed into structured formats. Each refiner is associated with a DLP
1618
- * (Data Liquidity Pool), has a specific schema for output, and includes
1619
- * instructions for the refinement process.
1620
- *
1621
- * @param params - Refiner configuration parameters
1622
- * @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
1623
- * @param params.name - Human-readable name for the refiner
1624
- * @param params.schemaId - Schema ID that defines the output format
1625
- * @param params.refinementInstructionUrl - URL containing processing instructions
1626
- * @returns Promise resolving to the new refiner ID and transaction hash
1627
- * @throws {Error} When chain ID is not available - "Chain ID not available"
1628
- * @throws {Error} When transaction fails - "Failed to add refiner: {error}"
1627
+ * Refiners define data transformation rules for DLPs.
1628
+ * Associates schema, instructions, and processing logic.
1629
+ *
1630
+ * @param params - Refiner configuration
1631
+ * @param params.dlpId - Data Liquidity Pool ID
1632
+ * @param params.name - Refiner display name
1633
+ * @param params.schemaId - Output schema ID.
1634
+ * Obtain via `vana.schemas.list()`.
1635
+ * @param params.refinementInstructionUrl - Processing instructions URL
1636
+ *
1637
+ * @returns Refiner ID and transaction hash
1638
+ *
1639
+ * @throws {Error} Chain ID not available.
1640
+ * Ensure network connection.
1641
+ * @throws {Error} Transaction failed.
1642
+ * Check wallet balance and network status.
1643
+ *
1629
1644
  * @example
1630
1645
  * ```typescript
1631
1646
  * const result = await vana.data.addRefiner({
1632
1647
  * dlpId: 1,
1633
- * name: "Social Media Sentiment Analyzer",
1648
+ * name: "Sentiment Analyzer",
1634
1649
  * schemaId: 42,
1635
1650
  * refinementInstructionUrl: "ipfs://QmXxx..."
1636
1651
  * });
1637
- * console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
1652
+ * console.log(`Refiner ${result.refinerId} created`);
1638
1653
  * ```
1639
1654
  */
1640
- async addRefiner(params) {
1655
+ async addRefiner(params, options) {
1641
1656
  this.assertWallet();
1642
1657
  try {
1643
1658
  const chainId = this.context.publicClient.chain?.id;
@@ -1663,7 +1678,8 @@ class DataController extends import_base.BaseController {
1663
1678
  params.refinementInstructionUrl
1664
1679
  ],
1665
1680
  account,
1666
- chain: this.context.walletClient.chain ?? null
1681
+ chain: this.context.walletClient.chain ?? null,
1682
+ ...this.spreadTransactionOptions(options)
1667
1683
  });
1668
1684
  const { tx } = await import("../utils/transactionHelpers");
1669
1685
  const txResult = tx({
@@ -1692,26 +1708,29 @@ class DataController extends import_base.BaseController {
1692
1708
  }
1693
1709
  }
1694
1710
  /**
1695
- * Retrieves a refiner by its ID.
1711
+ * Retrieves refiner configuration by ID.
1696
1712
  *
1697
1713
  * @remarks
1698
- * Queries the DataRefinerRegistry contract to get complete information about
1699
- * a specific refiner including its DLP association, schema, and instructions.
1714
+ * Queries DataRefinerRegistry for refiner details.
1715
+ * Returns DLP association, schema, and processing instructions.
1716
+ *
1717
+ * @param refinerId - Numeric refiner ID
1718
+ *
1719
+ * @returns Refiner configuration object
1720
+ *
1721
+ * @throws {Error} Chain ID not available.
1722
+ * Ensure network connection.
1723
+ * @throws {Error} Refiner not found.
1724
+ * Verify refiner ID exists.
1725
+ * @throws {Error} Contract read failed.
1726
+ * Check network and RPC status.
1700
1727
  *
1701
- * @param refinerId - The numeric refiner ID to retrieve
1702
- * @returns Promise resolving to the refiner information object
1703
- * @throws {Error} When chain ID is not available - "Chain ID not available"
1704
- * @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
1705
- * @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
1706
1728
  * @example
1707
1729
  * ```typescript
1708
1730
  * const refiner = await vana.data.getRefiner(1);
1709
- * console.log({
1710
- * name: refiner.name,
1711
- * dlp: refiner.dlpId,
1712
- * schema: refiner.schemaId,
1713
- * instructions: refiner.refinementInstructionUrl
1714
- * });
1731
+ * console.log(`Refiner: ${refiner.name}`);
1732
+ * console.log(`DLP: ${refiner.dlpId}`);
1733
+ * console.log(`Schema: ${refiner.schemaId}`);
1715
1734
  * ```
1716
1735
  */
1717
1736
  async getRefiner(refinerId) {
@@ -1752,21 +1771,27 @@ class DataController extends import_base.BaseController {
1752
1771
  }
1753
1772
  }
1754
1773
  /**
1755
- * Validates if a schema ID exists in the registry.
1774
+ * Validates schema ID existence.
1756
1775
  *
1757
1776
  * @remarks
1758
- * Checks the DataRefinerRegistry contract to determine if a given schema ID
1759
- * has been registered and is available for use.
1777
+ * Verifies schema registration in DataRegistry.
1778
+ * Check before using schemas for uploads.
1779
+ *
1780
+ * @param schemaId - Numeric schema ID to validate
1781
+ *
1782
+ * @returns True if schema exists, false otherwise
1783
+ *
1784
+ * @throws {Error} Chain ID not available.
1785
+ * Ensure network connection.
1786
+ * @throws {Error} Contract read failed.
1787
+ * Check RPC availability.
1760
1788
  *
1761
- * @param schemaId - The numeric schema ID to validate
1762
- * @returns Promise resolving to true if schema exists, false otherwise
1763
1789
  * @example
1764
1790
  * ```typescript
1765
- * const isValid = await vana.data.isValidSchemaId(42);
1766
- * if (isValid) {
1767
- * console.log('Schema 42 is available for use');
1768
- * } else {
1769
- * console.log('Schema 42 does not exist');
1791
+ * const valid = await vana.data.isValidSchemaId(42);
1792
+ * if (valid) {
1793
+ * // Safe to use schema 42
1794
+ * await vana.data.upload({ schemaId: 42, ... });
1770
1795
  * }
1771
1796
  * ```
1772
1797
  */
@@ -1854,7 +1879,7 @@ class DataController extends import_base.BaseController {
1854
1879
  * console.log(`Schema updated in tx ${result.transactionHash}`);
1855
1880
  * ```
1856
1881
  */
1857
- async updateSchemaId(params) {
1882
+ async updateSchemaId(params, options) {
1858
1883
  this.assertWallet();
1859
1884
  try {
1860
1885
  const chainId = this.context.publicClient.chain?.id;
@@ -1874,7 +1899,8 @@ class DataController extends import_base.BaseController {
1874
1899
  functionName: "updateSchemaId",
1875
1900
  args: [BigInt(params.refinerId), BigInt(params.newSchemaId)],
1876
1901
  account,
1877
- chain: this.context.walletClient.chain ?? null
1902
+ chain: this.context.walletClient.chain ?? null,
1903
+ ...this.spreadTransactionOptions(options)
1878
1904
  });
1879
1905
  await this.context.publicClient.waitForTransactionReceipt({ hash });
1880
1906
  return {
@@ -1929,12 +1955,24 @@ class DataController extends import_base.BaseController {
1929
1955
  };
1930
1956
  })
1931
1957
  );
1932
- if (this.context.relayerCallbacks?.submitFileAdditionWithPermissions) {
1933
- const result = await this.context.relayerCallbacks.submitFileAdditionWithPermissions(
1934
- uploadResult.url,
1935
- userAddress,
1936
- encryptedPermissions
1937
- );
1958
+ if (this.context.relayer) {
1959
+ const request = {
1960
+ type: "direct",
1961
+ operation: "submitFileAdditionWithPermissions",
1962
+ params: {
1963
+ url: uploadResult.url,
1964
+ userAddress,
1965
+ permissions: encryptedPermissions
1966
+ }
1967
+ };
1968
+ const response = await this.context.relayer(request);
1969
+ if (response.type === "error") {
1970
+ throw new Error(response.error);
1971
+ }
1972
+ if (response.type !== "direct" || !("fileId" in response.result)) {
1973
+ throw new Error("Invalid response from relayer");
1974
+ }
1975
+ const result = response.result;
1938
1976
  return {
1939
1977
  fileId: result.fileId,
1940
1978
  url: uploadResult.url,
@@ -2068,10 +2106,10 @@ class DataController extends import_base.BaseController {
2068
2106
  * console.log(`Transaction: ${result.transactionHash}`);
2069
2107
  * ```
2070
2108
  */
2071
- async addPermissionToFile(params) {
2109
+ async addPermissionToFile(params, options) {
2072
2110
  this.assertWallet();
2073
2111
  const { fileId, account, publicKey } = params;
2074
- return await this.submitFilePermission(fileId, account, publicKey);
2112
+ return await this.submitFilePermission(fileId, account, publicKey, options);
2075
2113
  }
2076
2114
  /**
2077
2115
  * Submits a file permission transaction to the blockchain.
@@ -2101,7 +2139,7 @@ class DataController extends import_base.BaseController {
2101
2139
  * console.log(`Permission granted with ID: ${result.permissionId}`);
2102
2140
  * ```
2103
2141
  */
2104
- async submitFilePermission(fileId, account, publicKey) {
2142
+ async submitFilePermission(fileId, account, publicKey, options) {
2105
2143
  this.assertWallet();
2106
2144
  try {
2107
2145
  const userEncryptionKey = await (0, import_encryption.generateEncryptionKey)(
@@ -2128,7 +2166,8 @@ class DataController extends import_base.BaseController {
2128
2166
  functionName: "addFilePermission",
2129
2167
  args: [BigInt(fileId), account, encryptedKey],
2130
2168
  account: walletAccount,
2131
- chain: this.context.walletClient.chain ?? null
2169
+ chain: this.context.walletClient.chain ?? null,
2170
+ ...this.spreadTransactionOptions(options)
2132
2171
  });
2133
2172
  const { tx } = await import("../utils/transactionHelpers");
2134
2173
  return tx({