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

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.
@@ -36250,7 +36250,7 @@ var PermissionsController = class {
36250
36250
  throw new Error("Failed to store grant file - no URL returned");
36251
36251
  }
36252
36252
  }
36253
- const nonce = await this.getUserNonce();
36253
+ const nonce = await this.getPermissionsUserNonce();
36254
36254
  console.debug(
36255
36255
  "\u{1F50D} Debug - Final grant URL being passed to compose:",
36256
36256
  grantUrl
@@ -36343,7 +36343,7 @@ var PermissionsController = class {
36343
36343
  throw new Error("Failed to store grant file - no URL returned");
36344
36344
  }
36345
36345
  }
36346
- const nonce = await this.getUserNonce();
36346
+ const nonce = await this.getPermissionsUserNonce();
36347
36347
  console.debug(
36348
36348
  "\u{1F50D} Debug - Final grant URL being passed to compose:",
36349
36349
  grantUrl
@@ -36408,14 +36408,8 @@ var PermissionsController = class {
36408
36408
  )
36409
36409
  );
36410
36410
  if (this.context.relayerCallbacks?.submitPermissionGrant) {
36411
- const jsonSafeTypedData = JSON.parse(
36412
- JSON.stringify(
36413
- typedData,
36414
- (_key, value) => typeof value === "bigint" ? value.toString() : value
36415
- )
36416
- );
36417
36411
  return await this.context.relayerCallbacks.submitPermissionGrant(
36418
- jsonSafeTypedData,
36412
+ typedData,
36419
36413
  signature
36420
36414
  );
36421
36415
  } else {
@@ -36485,7 +36479,6 @@ var PermissionsController = class {
36485
36479
  try {
36486
36480
  const addAndTrustServerInput = {
36487
36481
  nonce: BigInt(typedData.message.nonce),
36488
- owner: typedData.message.owner,
36489
36482
  serverAddress: typedData.message.serverAddress,
36490
36483
  serverUrl: typedData.message.serverUrl,
36491
36484
  publicKey: typedData.message.publicKey
@@ -36499,7 +36492,7 @@ var PermissionsController = class {
36499
36492
  throw error;
36500
36493
  }
36501
36494
  throw new BlockchainError(
36502
- `Add and trust server submission failed: ${error instanceof Error ? error.message : "Unknown error"}`,
36495
+ `Add and trust server submission failed444444: ${error instanceof Error ? error.message : "Unknown error"}`,
36503
36496
  error
36504
36497
  );
36505
36498
  }
@@ -36515,14 +36508,8 @@ var PermissionsController = class {
36515
36508
  async submitSignedRevoke(typedData, signature) {
36516
36509
  try {
36517
36510
  if (this.context.relayerCallbacks?.submitPermissionRevoke) {
36518
- const jsonSafeTypedData = JSON.parse(
36519
- JSON.stringify(
36520
- typedData,
36521
- (_key, value) => typeof value === "bigint" ? value.toString() : value
36522
- )
36523
- );
36524
36511
  return await this.context.relayerCallbacks.submitPermissionRevoke(
36525
- jsonSafeTypedData,
36512
+ typedData,
36526
36513
  signature
36527
36514
  );
36528
36515
  } else {
@@ -36704,7 +36691,7 @@ var PermissionsController = class {
36704
36691
  if (!this.context.walletClient.chain?.id) {
36705
36692
  throw new BlockchainError("Chain ID not available");
36706
36693
  }
36707
- const nonce = await this.getUserNonce();
36694
+ const nonce = await this.getPermissionsUserNonce();
36708
36695
  const revokePermissionInput = {
36709
36696
  nonce,
36710
36697
  permissionId: params.permissionId
@@ -36737,7 +36724,10 @@ var PermissionsController = class {
36737
36724
  }
36738
36725
  }
36739
36726
  /**
36727
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
36728
+ *
36740
36729
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
36730
+ * This method is deprecated in favor of more specific nonce methods.
36741
36731
  *
36742
36732
  * The nonce is used to prevent replay attacks in signed transactions and must
36743
36733
  * be incremented with each transaction to maintain security.
@@ -36749,8 +36739,12 @@ var PermissionsController = class {
36749
36739
  * @private
36750
36740
  * @example
36751
36741
  * ```typescript
36742
+ * // Deprecated - use specific methods instead
36752
36743
  * const nonce = await this.getUserNonce();
36753
- * console.log(`Current nonce: ${nonce}`);
36744
+ *
36745
+ * // Use these instead:
36746
+ * const permissionsNonce = await this.getPermissionsUserNonce();
36747
+ * const serversNonce = await this.getServersUserNonce();
36754
36748
  * ```
36755
36749
  */
36756
36750
  async getUserNonce() {
@@ -36779,16 +36773,17 @@ var PermissionsController = class {
36779
36773
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
36780
36774
  * This nonce is used for server-related operations (AddAndTrustServer, TrustServer, UntrustServer).
36781
36775
  *
36782
- * @returns Promise resolving to the current nonce
36776
+ * @returns Promise resolving to the current servers nonce
36777
+ * @throws {NonceError} When reading nonce from contract fails
36783
36778
  * @private
36784
36779
  *
36785
36780
  * @example
36786
36781
  * ```typescript
36787
- * const nonce = await this.getServerNonce();
36788
- * console.log(`Current server nonce: ${nonce}`);
36782
+ * const nonce = await this.getServersUserNonce();
36783
+ * console.log(`Current servers nonce: ${nonce}`);
36789
36784
  * ```
36790
36785
  */
36791
- async getServerNonce() {
36786
+ async getServersUserNonce() {
36792
36787
  try {
36793
36788
  const userAddress = await this.getUserAddress();
36794
36789
  const chainId = await this.context.walletClient.getChainId();
@@ -36810,6 +36805,44 @@ var PermissionsController = class {
36810
36805
  );
36811
36806
  }
36812
36807
  }
36808
+ /**
36809
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
36810
+ * This nonce is used for permission-related operations (addPermission, addServerFilesAndPermissions).
36811
+ *
36812
+ * @returns Promise resolving to the current permissions nonce
36813
+ * @throws {NonceError} When reading nonce from contract fails
36814
+ * @private
36815
+ *
36816
+ * @example
36817
+ * ```typescript
36818
+ * const nonce = await this.getPermissionsUserNonce();
36819
+ * console.log(`Current permissions nonce: ${nonce}`);
36820
+ * ```
36821
+ */
36822
+ async getPermissionsUserNonce() {
36823
+ try {
36824
+ const userAddress = await this.getUserAddress();
36825
+ const chainId = await this.context.walletClient.getChainId();
36826
+ const DataPortabilityPermissionsAddress = getContractAddress(
36827
+ chainId,
36828
+ "DataPortabilityPermissions"
36829
+ );
36830
+ const DataPortabilityPermissionsAbi = getAbi(
36831
+ "DataPortabilityPermissions"
36832
+ );
36833
+ const nonce = await this.context.publicClient.readContract({
36834
+ address: DataPortabilityPermissionsAddress,
36835
+ abi: DataPortabilityPermissionsAbi,
36836
+ functionName: "userNonce",
36837
+ args: [userAddress]
36838
+ });
36839
+ return nonce;
36840
+ } catch (error) {
36841
+ throw new NonceError(
36842
+ `Failed to retrieve permissions nonce: ${error instanceof Error ? error.message : "Unknown error"}`
36843
+ );
36844
+ }
36845
+ }
36813
36846
  /**
36814
36847
  * Composes the EIP-712 typed data for PermissionGrant (new simplified format).
36815
36848
  *
@@ -37171,12 +37204,13 @@ var PermissionsController = class {
37171
37204
  "DataPortabilityServers"
37172
37205
  );
37173
37206
  const DataPortabilityServersAbi = getAbi("DataPortabilityServers");
37207
+ const userAddress = this.context.walletClient.account?.address || await this.getUserAddress();
37174
37208
  const txHash = await this.context.walletClient.writeContract({
37175
37209
  address: DataPortabilityServersAddress,
37176
37210
  abi: DataPortabilityServersAbi,
37177
37211
  functionName: "addAndTrustServerOnBehalf",
37178
37212
  args: [
37179
- params.owner,
37213
+ userAddress,
37180
37214
  {
37181
37215
  serverAddress: params.serverAddress,
37182
37216
  serverUrl: params.serverUrl,
@@ -37239,10 +37273,9 @@ var PermissionsController = class {
37239
37273
  */
37240
37274
  async submitAddAndTrustServerWithSignature(params) {
37241
37275
  try {
37242
- const nonce = await this.getServerNonce();
37276
+ const nonce = await this.getServersUserNonce();
37243
37277
  const addAndTrustServerInput = {
37244
37278
  nonce,
37245
- owner: params.owner,
37246
37279
  serverAddress: params.serverAddress,
37247
37280
  publicKey: params.publicKey,
37248
37281
  serverUrl: params.serverUrl
@@ -37252,7 +37285,6 @@ var PermissionsController = class {
37252
37285
  );
37253
37286
  console.debug("\u{1F50D} AddAndTrustServer Debug Info:", {
37254
37287
  nonce: nonce.toString(),
37255
- owner: params.owner,
37256
37288
  serverAddress: params.serverAddress,
37257
37289
  publicKey: params.publicKey,
37258
37290
  serverUrl: params.serverUrl,
@@ -37304,7 +37336,7 @@ var PermissionsController = class {
37304
37336
  */
37305
37337
  async submitTrustServerWithSignature(params) {
37306
37338
  try {
37307
- const nonce = await this.getServerNonce();
37339
+ const nonce = await this.getServersUserNonce();
37308
37340
  const trustServerInput = {
37309
37341
  nonce,
37310
37342
  serverId: params.serverId
@@ -37399,7 +37431,7 @@ var PermissionsController = class {
37399
37431
  * ```
37400
37432
  */
37401
37433
  async submitUntrustServer(params) {
37402
- const nonce = await this.getUserNonce();
37434
+ const nonce = await this.getServersUserNonce();
37403
37435
  const untrustServerInput = {
37404
37436
  nonce,
37405
37437
  serverId: params.serverId
@@ -37420,7 +37452,7 @@ var PermissionsController = class {
37420
37452
  */
37421
37453
  async submitUntrustServerWithSignature(params) {
37422
37454
  try {
37423
- const nonce = await this.getServerNonce();
37455
+ const nonce = await this.getServersUserNonce();
37424
37456
  const untrustServerInput = {
37425
37457
  nonce,
37426
37458
  serverId: params.serverId
@@ -37728,18 +37760,18 @@ var PermissionsController = class {
37728
37760
  */
37729
37761
  async composeAddAndTrustServerMessage(input) {
37730
37762
  const domain = await this.getServersDomain();
37763
+ console.debug(domain);
37731
37764
  return {
37732
37765
  domain,
37733
37766
  types: {
37734
- AddAndTrustServer: [
37767
+ AddServer: [
37735
37768
  { name: "nonce", type: "uint256" },
37736
- { name: "owner", type: "address" },
37737
37769
  { name: "serverAddress", type: "address" },
37738
- { name: "publicKey", type: "bytes" },
37770
+ { name: "publicKey", type: "string" },
37739
37771
  { name: "serverUrl", type: "string" }
37740
37772
  ]
37741
37773
  },
37742
- primaryType: "AddAndTrustServer",
37774
+ primaryType: "AddServer",
37743
37775
  message: input
37744
37776
  };
37745
37777
  }
@@ -37820,7 +37852,6 @@ var PermissionsController = class {
37820
37852
  contractAddress: DataPortabilityServersAddress,
37821
37853
  input: {
37822
37854
  nonce: addAndTrustServerInput.nonce.toString(),
37823
- owner: addAndTrustServerInput.owner,
37824
37855
  serverAddress: addAndTrustServerInput.serverAddress,
37825
37856
  publicKey: addAndTrustServerInput.publicKey,
37826
37857
  serverUrl: addAndTrustServerInput.serverUrl
@@ -37834,7 +37865,6 @@ var PermissionsController = class {
37834
37865
  args: [
37835
37866
  {
37836
37867
  nonce: addAndTrustServerInput.nonce,
37837
- owner: addAndTrustServerInput.owner,
37838
37868
  serverAddress: addAndTrustServerInput.serverAddress,
37839
37869
  publicKey: addAndTrustServerInput.publicKey,
37840
37870
  serverUrl: addAndTrustServerInput.serverUrl
@@ -37987,7 +38017,7 @@ var PermissionsController = class {
37987
38017
  * ```
37988
38018
  */
37989
38019
  async submitRegisterGranteeWithSignature(params) {
37990
- const nonce = await this.getUserNonce();
38020
+ const nonce = await this.getServersUserNonce();
37991
38021
  const registerGranteeInput = {
37992
38022
  nonce,
37993
38023
  owner: params.owner,
@@ -39137,14 +39167,18 @@ var PermissionsController = class {
39137
39167
  }
39138
39168
  }
39139
39169
  /**
39140
- * Submit permission with signature to the blockchain
39170
+ * Submit permission with signature to the blockchain (supports gasless transactions)
39141
39171
  *
39142
39172
  * @param params - Parameters for adding permission
39143
39173
  * @returns Promise resolving to transaction hash
39174
+ * @throws {RelayerError} When gasless transaction submission fails
39175
+ * @throws {SignatureError} When user rejects the signature request
39176
+ * @throws {BlockchainError} When permission addition fails
39177
+ * @throws {NetworkError} When network communication fails
39144
39178
  */
39145
39179
  async submitAddPermission(params) {
39146
39180
  try {
39147
- const nonce = await this.getUserNonce();
39181
+ const nonce = await this.getPermissionsUserNonce();
39148
39182
  const addPermissionInput = {
39149
39183
  nonce,
39150
39184
  granteeId: params.granteeId,
@@ -39157,48 +39191,64 @@ var PermissionsController = class {
39157
39191
  };
39158
39192
  const typedData = await this.composeServerFilesAndPermissionMessage(addPermissionInput);
39159
39193
  const signature = await this.signTypedData(typedData);
39160
- const chainId = await this.context.walletClient.getChainId();
39161
- const DataPortabilityPermissionsAddress = getContractAddress(
39162
- chainId,
39163
- "DataPortabilityPermissions"
39164
- );
39165
- const DataPortabilityPermissionsAbi = getAbi(
39166
- "DataPortabilityPermissions"
39194
+ return await this.submitSignedAddPermission(typedData, signature);
39195
+ } catch (error) {
39196
+ if (error instanceof RelayerError || error instanceof UserRejectedRequestError || error instanceof SerializationError || error instanceof SignatureError || error instanceof NetworkError || error instanceof NonceError) {
39197
+ throw error;
39198
+ }
39199
+ throw new BlockchainError(
39200
+ `Failed to add permission: ${error instanceof Error ? error.message : "Unknown error"}`,
39201
+ error
39167
39202
  );
39168
- const hash = await this.context.walletClient.writeContract({
39169
- address: DataPortabilityPermissionsAddress,
39170
- abi: DataPortabilityPermissionsAbi,
39171
- functionName: "addPermission",
39172
- args: [
39173
- {
39174
- nonce: addPermissionInput.nonce,
39175
- granteeId: addPermissionInput.granteeId,
39176
- grant: addPermissionInput.grant,
39177
- fileIds: []
39178
- // Note: This should be handled differently for addPermission vs addServerFilesAndPermissions
39179
- },
39203
+ }
39204
+ }
39205
+ /**
39206
+ * Submits an already-signed add permission transaction to the blockchain.
39207
+ * This method supports both relayer-based gasless transactions and direct transactions.
39208
+ *
39209
+ * @param typedData - The EIP-712 typed data for AddPermission
39210
+ * @param signature - The user's signature
39211
+ * @returns Promise resolving to the transaction hash
39212
+ * @throws {RelayerError} When gasless transaction submission fails
39213
+ * @throws {BlockchainError} When permission addition fails
39214
+ * @throws {NetworkError} When network communication fails
39215
+ */
39216
+ async submitSignedAddPermission(typedData, signature) {
39217
+ try {
39218
+ if (this.context.relayerCallbacks?.submitAddPermission) {
39219
+ return await this.context.relayerCallbacks.submitAddPermission(
39220
+ typedData,
39180
39221
  signature
39181
- ],
39182
- chain: this.context.walletClient.chain,
39183
- account: this.context.walletClient.account || null
39184
- });
39185
- return hash;
39222
+ );
39223
+ } else {
39224
+ return await this.submitDirectAddPermissionTransaction(
39225
+ typedData,
39226
+ signature
39227
+ );
39228
+ }
39186
39229
  } catch (error) {
39230
+ if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
39231
+ throw error;
39232
+ }
39187
39233
  throw new BlockchainError(
39188
- `Failed to add permission: ${error instanceof Error ? error.message : "Unknown error"}`,
39234
+ `Add permission submission failed: ${error instanceof Error ? error.message : "Unknown error"}`,
39189
39235
  error
39190
39236
  );
39191
39237
  }
39192
39238
  }
39193
39239
  /**
39194
- * Submit server files and permissions with signature to the blockchain
39240
+ * Submit server files and permissions with signature to the blockchain (supports gasless transactions)
39195
39241
  *
39196
39242
  * @param params - Parameters for adding server files and permissions
39197
39243
  * @returns Promise resolving to transaction hash
39244
+ * @throws {RelayerError} When gasless transaction submission fails
39245
+ * @throws {SignatureError} When user rejects the signature request
39246
+ * @throws {BlockchainError} When server files and permissions addition fails
39247
+ * @throws {NetworkError} When network communication fails
39198
39248
  */
39199
39249
  async submitAddServerFilesAndPermissions(params) {
39200
39250
  try {
39201
- const nonce = await this.getUserNonce();
39251
+ const nonce = await this.getPermissionsUserNonce();
39202
39252
  const serverFilesAndPermissionInput = {
39203
39253
  nonce,
39204
39254
  granteeId: params.granteeId,
@@ -39213,27 +39263,61 @@ var PermissionsController = class {
39213
39263
  serverFilesAndPermissionInput
39214
39264
  );
39215
39265
  const signature = await this.signTypedData(typedData);
39216
- const chainId = await this.context.walletClient.getChainId();
39217
- const DataPortabilityPermissionsAddress = getContractAddress(
39218
- chainId,
39219
- "DataPortabilityPermissions"
39266
+ return await this.submitSignedAddServerFilesAndPermissions(
39267
+ typedData,
39268
+ signature
39220
39269
  );
39221
- const DataPortabilityPermissionsAbi = getAbi(
39222
- "DataPortabilityPermissions"
39270
+ } catch (error) {
39271
+ if (error instanceof RelayerError || error instanceof UserRejectedRequestError || error instanceof SerializationError || error instanceof SignatureError || error instanceof NetworkError || error instanceof NonceError) {
39272
+ throw error;
39273
+ }
39274
+ throw new BlockchainError(
39275
+ `Failed to add server files and permissions: ${error instanceof Error ? error.message : "Unknown error"}`,
39276
+ error
39223
39277
  );
39224
- const hash = await this.context.walletClient.writeContract({
39225
- address: DataPortabilityPermissionsAddress,
39226
- abi: DataPortabilityPermissionsAbi,
39227
- functionName: "addServerFilesAndPermissions",
39228
- // @ts-expect-error - Complex nested array types cause compatibility issues with viem's generated types
39229
- args: [serverFilesAndPermissionInput, signature],
39230
- chain: this.context.walletClient.chain,
39231
- account: this.context.walletClient.account || null
39278
+ }
39279
+ }
39280
+ /**
39281
+ * Submits an already-signed add server files and permissions transaction to the blockchain.
39282
+ * This method supports both relayer-based gasless transactions and direct transactions.
39283
+ *
39284
+ * @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
39285
+ * @param signature - The user's signature
39286
+ * @returns Promise resolving to the transaction hash
39287
+ * @throws {RelayerError} When gasless transaction submission fails
39288
+ * @throws {BlockchainError} When server files and permissions addition fails
39289
+ * @throws {NetworkError} When network communication fails
39290
+ */
39291
+ async submitSignedAddServerFilesAndPermissions(typedData, signature) {
39292
+ try {
39293
+ console.debug("\u{1F50D} submitSignedAddServerFilesAndPermissions Debug Info:", {
39294
+ hasRelayerCallbacks: !!this.context.relayerCallbacks,
39295
+ hasSubmitMethod: !!this.context.relayerCallbacks?.submitAddServerFilesAndPermissions,
39296
+ availableRelayerMethods: this.context.relayerCallbacks ? Object.keys(this.context.relayerCallbacks) : []
39232
39297
  });
39233
- return hash;
39298
+ if (this.context.relayerCallbacks?.submitAddServerFilesAndPermissions) {
39299
+ console.debug(
39300
+ "\u{1F680} Using relayer for submitAddServerFilesAndPermissions"
39301
+ );
39302
+ return await this.context.relayerCallbacks.submitAddServerFilesAndPermissions(
39303
+ typedData,
39304
+ signature
39305
+ );
39306
+ } else {
39307
+ console.debug(
39308
+ "\u{1F4DD} Using direct transaction for submitAddServerFilesAndPermissions"
39309
+ );
39310
+ return await this.submitDirectAddServerFilesAndPermissionsTransaction(
39311
+ typedData,
39312
+ signature
39313
+ );
39314
+ }
39234
39315
  } catch (error) {
39316
+ if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
39317
+ throw error;
39318
+ }
39235
39319
  throw new BlockchainError(
39236
- `Failed to add server files and permissions: ${error instanceof Error ? error.message : "Unknown error"}`,
39320
+ `Add server files and permissions submission failed: ${error instanceof Error ? error.message : "Unknown error"}`,
39237
39321
  error
39238
39322
  );
39239
39323
  }
@@ -39270,6 +39354,71 @@ var PermissionsController = class {
39270
39354
  );
39271
39355
  }
39272
39356
  }
39357
+ /**
39358
+ * Submits a signed add permission transaction directly to the blockchain.
39359
+ *
39360
+ * @param typedData - The typed data structure for the permission addition
39361
+ * @param signature - The cryptographic signature authorizing the transaction
39362
+ * @returns Promise resolving to the transaction hash
39363
+ */
39364
+ async submitDirectAddPermissionTransaction(typedData, signature) {
39365
+ const chainId = await this.context.walletClient.getChainId();
39366
+ const DataPortabilityPermissionsAddress = getContractAddress(
39367
+ chainId,
39368
+ "DataPortabilityPermissions"
39369
+ );
39370
+ const DataPortabilityPermissionsAbi = getAbi("DataPortabilityPermissions");
39371
+ const permissionInput = {
39372
+ nonce: typedData.message.nonce,
39373
+ granteeId: typedData.message.granteeId,
39374
+ grant: typedData.message.grant,
39375
+ fileIds: typedData.message.fileIds || []
39376
+ };
39377
+ const hash = await this.context.walletClient.writeContract({
39378
+ address: DataPortabilityPermissionsAddress,
39379
+ abi: DataPortabilityPermissionsAbi,
39380
+ functionName: "addPermission",
39381
+ args: [permissionInput, signature],
39382
+ account: this.context.walletClient.account || await this.getUserAddress(),
39383
+ chain: this.context.walletClient.chain || null
39384
+ });
39385
+ return hash;
39386
+ }
39387
+ /**
39388
+ * Submits a signed add server files and permissions transaction directly to the blockchain.
39389
+ *
39390
+ * @param typedData - The typed data structure for the server files and permissions addition
39391
+ * @param signature - The cryptographic signature authorizing the transaction
39392
+ * @returns Promise resolving to the transaction hash
39393
+ */
39394
+ async submitDirectAddServerFilesAndPermissionsTransaction(typedData, signature) {
39395
+ const chainId = await this.context.walletClient.getChainId();
39396
+ const DataPortabilityPermissionsAddress = getContractAddress(
39397
+ chainId,
39398
+ "DataPortabilityPermissions"
39399
+ );
39400
+ const DataPortabilityPermissionsAbi = getAbi("DataPortabilityPermissions");
39401
+ const serverFilesAndPermissionInput = {
39402
+ nonce: typedData.message.nonce,
39403
+ granteeId: typedData.message.granteeId,
39404
+ grant: typedData.message.grant,
39405
+ fileUrls: typedData.message.fileUrls,
39406
+ serverAddress: typedData.message.serverAddress,
39407
+ serverUrl: typedData.message.serverUrl,
39408
+ serverPublicKey: typedData.message.serverPublicKey,
39409
+ filePermissions: typedData.message.filePermissions
39410
+ };
39411
+ const hash = await this.context.walletClient.writeContract({
39412
+ address: DataPortabilityPermissionsAddress,
39413
+ abi: DataPortabilityPermissionsAbi,
39414
+ functionName: "addServerFilesAndPermissions",
39415
+ // @ts-expect-error - Complex nested array types cause compatibility issues with viem's generated types
39416
+ args: [serverFilesAndPermissionInput, signature],
39417
+ account: this.context.walletClient.account || await this.getUserAddress(),
39418
+ chain: this.context.walletClient.chain || null
39419
+ });
39420
+ return hash;
39421
+ }
39273
39422
  };
39274
39423
 
39275
39424
  // src/controllers/data.ts