@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.
@@ -36656,7 +36656,7 @@ var PermissionsController = class {
36656
36656
  throw new Error("Failed to store grant file - no URL returned");
36657
36657
  }
36658
36658
  }
36659
- const nonce = await this.getUserNonce();
36659
+ const nonce = await this.getPermissionsUserNonce();
36660
36660
  console.debug(
36661
36661
  "\u{1F50D} Debug - Final grant URL being passed to compose:",
36662
36662
  grantUrl
@@ -36749,7 +36749,7 @@ var PermissionsController = class {
36749
36749
  throw new Error("Failed to store grant file - no URL returned");
36750
36750
  }
36751
36751
  }
36752
- const nonce = await this.getUserNonce();
36752
+ const nonce = await this.getPermissionsUserNonce();
36753
36753
  console.debug(
36754
36754
  "\u{1F50D} Debug - Final grant URL being passed to compose:",
36755
36755
  grantUrl
@@ -36814,14 +36814,8 @@ var PermissionsController = class {
36814
36814
  )
36815
36815
  );
36816
36816
  if (this.context.relayerCallbacks?.submitPermissionGrant) {
36817
- const jsonSafeTypedData = JSON.parse(
36818
- JSON.stringify(
36819
- typedData,
36820
- (_key, value) => typeof value === "bigint" ? value.toString() : value
36821
- )
36822
- );
36823
36817
  return await this.context.relayerCallbacks.submitPermissionGrant(
36824
- jsonSafeTypedData,
36818
+ typedData,
36825
36819
  signature
36826
36820
  );
36827
36821
  } else {
@@ -36891,7 +36885,6 @@ var PermissionsController = class {
36891
36885
  try {
36892
36886
  const addAndTrustServerInput = {
36893
36887
  nonce: BigInt(typedData.message.nonce),
36894
- owner: typedData.message.owner,
36895
36888
  serverAddress: typedData.message.serverAddress,
36896
36889
  serverUrl: typedData.message.serverUrl,
36897
36890
  publicKey: typedData.message.publicKey
@@ -36905,7 +36898,7 @@ var PermissionsController = class {
36905
36898
  throw error;
36906
36899
  }
36907
36900
  throw new BlockchainError(
36908
- `Add and trust server submission failed: ${error instanceof Error ? error.message : "Unknown error"}`,
36901
+ `Add and trust server submission failed444444: ${error instanceof Error ? error.message : "Unknown error"}`,
36909
36902
  error
36910
36903
  );
36911
36904
  }
@@ -36921,14 +36914,8 @@ var PermissionsController = class {
36921
36914
  async submitSignedRevoke(typedData, signature) {
36922
36915
  try {
36923
36916
  if (this.context.relayerCallbacks?.submitPermissionRevoke) {
36924
- const jsonSafeTypedData = JSON.parse(
36925
- JSON.stringify(
36926
- typedData,
36927
- (_key, value) => typeof value === "bigint" ? value.toString() : value
36928
- )
36929
- );
36930
36917
  return await this.context.relayerCallbacks.submitPermissionRevoke(
36931
- jsonSafeTypedData,
36918
+ typedData,
36932
36919
  signature
36933
36920
  );
36934
36921
  } else {
@@ -37110,7 +37097,7 @@ var PermissionsController = class {
37110
37097
  if (!this.context.walletClient.chain?.id) {
37111
37098
  throw new BlockchainError("Chain ID not available");
37112
37099
  }
37113
- const nonce = await this.getUserNonce();
37100
+ const nonce = await this.getPermissionsUserNonce();
37114
37101
  const revokePermissionInput = {
37115
37102
  nonce,
37116
37103
  permissionId: params.permissionId
@@ -37143,7 +37130,10 @@ var PermissionsController = class {
37143
37130
  }
37144
37131
  }
37145
37132
  /**
37133
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
37134
+ *
37146
37135
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
37136
+ * This method is deprecated in favor of more specific nonce methods.
37147
37137
  *
37148
37138
  * The nonce is used to prevent replay attacks in signed transactions and must
37149
37139
  * be incremented with each transaction to maintain security.
@@ -37155,8 +37145,12 @@ var PermissionsController = class {
37155
37145
  * @private
37156
37146
  * @example
37157
37147
  * ```typescript
37148
+ * // Deprecated - use specific methods instead
37158
37149
  * const nonce = await this.getUserNonce();
37159
- * console.log(`Current nonce: ${nonce}`);
37150
+ *
37151
+ * // Use these instead:
37152
+ * const permissionsNonce = await this.getPermissionsUserNonce();
37153
+ * const serversNonce = await this.getServersUserNonce();
37160
37154
  * ```
37161
37155
  */
37162
37156
  async getUserNonce() {
@@ -37185,16 +37179,17 @@ var PermissionsController = class {
37185
37179
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
37186
37180
  * This nonce is used for server-related operations (AddAndTrustServer, TrustServer, UntrustServer).
37187
37181
  *
37188
- * @returns Promise resolving to the current nonce
37182
+ * @returns Promise resolving to the current servers nonce
37183
+ * @throws {NonceError} When reading nonce from contract fails
37189
37184
  * @private
37190
37185
  *
37191
37186
  * @example
37192
37187
  * ```typescript
37193
- * const nonce = await this.getServerNonce();
37194
- * console.log(`Current server nonce: ${nonce}`);
37188
+ * const nonce = await this.getServersUserNonce();
37189
+ * console.log(`Current servers nonce: ${nonce}`);
37195
37190
  * ```
37196
37191
  */
37197
- async getServerNonce() {
37192
+ async getServersUserNonce() {
37198
37193
  try {
37199
37194
  const userAddress = await this.getUserAddress();
37200
37195
  const chainId = await this.context.walletClient.getChainId();
@@ -37216,6 +37211,44 @@ var PermissionsController = class {
37216
37211
  );
37217
37212
  }
37218
37213
  }
37214
+ /**
37215
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
37216
+ * This nonce is used for permission-related operations (addPermission, addServerFilesAndPermissions).
37217
+ *
37218
+ * @returns Promise resolving to the current permissions nonce
37219
+ * @throws {NonceError} When reading nonce from contract fails
37220
+ * @private
37221
+ *
37222
+ * @example
37223
+ * ```typescript
37224
+ * const nonce = await this.getPermissionsUserNonce();
37225
+ * console.log(`Current permissions nonce: ${nonce}`);
37226
+ * ```
37227
+ */
37228
+ async getPermissionsUserNonce() {
37229
+ try {
37230
+ const userAddress = await this.getUserAddress();
37231
+ const chainId = await this.context.walletClient.getChainId();
37232
+ const DataPortabilityPermissionsAddress = getContractAddress(
37233
+ chainId,
37234
+ "DataPortabilityPermissions"
37235
+ );
37236
+ const DataPortabilityPermissionsAbi = getAbi(
37237
+ "DataPortabilityPermissions"
37238
+ );
37239
+ const nonce = await this.context.publicClient.readContract({
37240
+ address: DataPortabilityPermissionsAddress,
37241
+ abi: DataPortabilityPermissionsAbi,
37242
+ functionName: "userNonce",
37243
+ args: [userAddress]
37244
+ });
37245
+ return nonce;
37246
+ } catch (error) {
37247
+ throw new NonceError(
37248
+ `Failed to retrieve permissions nonce: ${error instanceof Error ? error.message : "Unknown error"}`
37249
+ );
37250
+ }
37251
+ }
37219
37252
  /**
37220
37253
  * Composes the EIP-712 typed data for PermissionGrant (new simplified format).
37221
37254
  *
@@ -37577,12 +37610,13 @@ var PermissionsController = class {
37577
37610
  "DataPortabilityServers"
37578
37611
  );
37579
37612
  const DataPortabilityServersAbi = getAbi("DataPortabilityServers");
37613
+ const userAddress = this.context.walletClient.account?.address || await this.getUserAddress();
37580
37614
  const txHash = await this.context.walletClient.writeContract({
37581
37615
  address: DataPortabilityServersAddress,
37582
37616
  abi: DataPortabilityServersAbi,
37583
37617
  functionName: "addAndTrustServerOnBehalf",
37584
37618
  args: [
37585
- params.owner,
37619
+ userAddress,
37586
37620
  {
37587
37621
  serverAddress: params.serverAddress,
37588
37622
  serverUrl: params.serverUrl,
@@ -37645,10 +37679,9 @@ var PermissionsController = class {
37645
37679
  */
37646
37680
  async submitAddAndTrustServerWithSignature(params) {
37647
37681
  try {
37648
- const nonce = await this.getServerNonce();
37682
+ const nonce = await this.getServersUserNonce();
37649
37683
  const addAndTrustServerInput = {
37650
37684
  nonce,
37651
- owner: params.owner,
37652
37685
  serverAddress: params.serverAddress,
37653
37686
  publicKey: params.publicKey,
37654
37687
  serverUrl: params.serverUrl
@@ -37658,7 +37691,6 @@ var PermissionsController = class {
37658
37691
  );
37659
37692
  console.debug("\u{1F50D} AddAndTrustServer Debug Info:", {
37660
37693
  nonce: nonce.toString(),
37661
- owner: params.owner,
37662
37694
  serverAddress: params.serverAddress,
37663
37695
  publicKey: params.publicKey,
37664
37696
  serverUrl: params.serverUrl,
@@ -37710,7 +37742,7 @@ var PermissionsController = class {
37710
37742
  */
37711
37743
  async submitTrustServerWithSignature(params) {
37712
37744
  try {
37713
- const nonce = await this.getServerNonce();
37745
+ const nonce = await this.getServersUserNonce();
37714
37746
  const trustServerInput = {
37715
37747
  nonce,
37716
37748
  serverId: params.serverId
@@ -37805,7 +37837,7 @@ var PermissionsController = class {
37805
37837
  * ```
37806
37838
  */
37807
37839
  async submitUntrustServer(params) {
37808
- const nonce = await this.getUserNonce();
37840
+ const nonce = await this.getServersUserNonce();
37809
37841
  const untrustServerInput = {
37810
37842
  nonce,
37811
37843
  serverId: params.serverId
@@ -37826,7 +37858,7 @@ var PermissionsController = class {
37826
37858
  */
37827
37859
  async submitUntrustServerWithSignature(params) {
37828
37860
  try {
37829
- const nonce = await this.getServerNonce();
37861
+ const nonce = await this.getServersUserNonce();
37830
37862
  const untrustServerInput = {
37831
37863
  nonce,
37832
37864
  serverId: params.serverId
@@ -38134,18 +38166,18 @@ var PermissionsController = class {
38134
38166
  */
38135
38167
  async composeAddAndTrustServerMessage(input) {
38136
38168
  const domain = await this.getServersDomain();
38169
+ console.debug(domain);
38137
38170
  return {
38138
38171
  domain,
38139
38172
  types: {
38140
- AddAndTrustServer: [
38173
+ AddServer: [
38141
38174
  { name: "nonce", type: "uint256" },
38142
- { name: "owner", type: "address" },
38143
38175
  { name: "serverAddress", type: "address" },
38144
- { name: "publicKey", type: "bytes" },
38176
+ { name: "publicKey", type: "string" },
38145
38177
  { name: "serverUrl", type: "string" }
38146
38178
  ]
38147
38179
  },
38148
- primaryType: "AddAndTrustServer",
38180
+ primaryType: "AddServer",
38149
38181
  message: input
38150
38182
  };
38151
38183
  }
@@ -38226,7 +38258,6 @@ var PermissionsController = class {
38226
38258
  contractAddress: DataPortabilityServersAddress,
38227
38259
  input: {
38228
38260
  nonce: addAndTrustServerInput.nonce.toString(),
38229
- owner: addAndTrustServerInput.owner,
38230
38261
  serverAddress: addAndTrustServerInput.serverAddress,
38231
38262
  publicKey: addAndTrustServerInput.publicKey,
38232
38263
  serverUrl: addAndTrustServerInput.serverUrl
@@ -38240,7 +38271,6 @@ var PermissionsController = class {
38240
38271
  args: [
38241
38272
  {
38242
38273
  nonce: addAndTrustServerInput.nonce,
38243
- owner: addAndTrustServerInput.owner,
38244
38274
  serverAddress: addAndTrustServerInput.serverAddress,
38245
38275
  publicKey: addAndTrustServerInput.publicKey,
38246
38276
  serverUrl: addAndTrustServerInput.serverUrl
@@ -38393,7 +38423,7 @@ var PermissionsController = class {
38393
38423
  * ```
38394
38424
  */
38395
38425
  async submitRegisterGranteeWithSignature(params) {
38396
- const nonce = await this.getUserNonce();
38426
+ const nonce = await this.getServersUserNonce();
38397
38427
  const registerGranteeInput = {
38398
38428
  nonce,
38399
38429
  owner: params.owner,
@@ -39543,14 +39573,18 @@ var PermissionsController = class {
39543
39573
  }
39544
39574
  }
39545
39575
  /**
39546
- * Submit permission with signature to the blockchain
39576
+ * Submit permission with signature to the blockchain (supports gasless transactions)
39547
39577
  *
39548
39578
  * @param params - Parameters for adding permission
39549
39579
  * @returns Promise resolving to transaction hash
39580
+ * @throws {RelayerError} When gasless transaction submission fails
39581
+ * @throws {SignatureError} When user rejects the signature request
39582
+ * @throws {BlockchainError} When permission addition fails
39583
+ * @throws {NetworkError} When network communication fails
39550
39584
  */
39551
39585
  async submitAddPermission(params) {
39552
39586
  try {
39553
- const nonce = await this.getUserNonce();
39587
+ const nonce = await this.getPermissionsUserNonce();
39554
39588
  const addPermissionInput = {
39555
39589
  nonce,
39556
39590
  granteeId: params.granteeId,
@@ -39563,48 +39597,64 @@ var PermissionsController = class {
39563
39597
  };
39564
39598
  const typedData = await this.composeServerFilesAndPermissionMessage(addPermissionInput);
39565
39599
  const signature = await this.signTypedData(typedData);
39566
- const chainId = await this.context.walletClient.getChainId();
39567
- const DataPortabilityPermissionsAddress = getContractAddress(
39568
- chainId,
39569
- "DataPortabilityPermissions"
39570
- );
39571
- const DataPortabilityPermissionsAbi = getAbi(
39572
- "DataPortabilityPermissions"
39600
+ return await this.submitSignedAddPermission(typedData, signature);
39601
+ } catch (error) {
39602
+ if (error instanceof RelayerError || error instanceof UserRejectedRequestError || error instanceof SerializationError || error instanceof SignatureError || error instanceof NetworkError || error instanceof NonceError) {
39603
+ throw error;
39604
+ }
39605
+ throw new BlockchainError(
39606
+ `Failed to add permission: ${error instanceof Error ? error.message : "Unknown error"}`,
39607
+ error
39573
39608
  );
39574
- const hash = await this.context.walletClient.writeContract({
39575
- address: DataPortabilityPermissionsAddress,
39576
- abi: DataPortabilityPermissionsAbi,
39577
- functionName: "addPermission",
39578
- args: [
39579
- {
39580
- nonce: addPermissionInput.nonce,
39581
- granteeId: addPermissionInput.granteeId,
39582
- grant: addPermissionInput.grant,
39583
- fileIds: []
39584
- // Note: This should be handled differently for addPermission vs addServerFilesAndPermissions
39585
- },
39609
+ }
39610
+ }
39611
+ /**
39612
+ * Submits an already-signed add permission transaction to the blockchain.
39613
+ * This method supports both relayer-based gasless transactions and direct transactions.
39614
+ *
39615
+ * @param typedData - The EIP-712 typed data for AddPermission
39616
+ * @param signature - The user's signature
39617
+ * @returns Promise resolving to the transaction hash
39618
+ * @throws {RelayerError} When gasless transaction submission fails
39619
+ * @throws {BlockchainError} When permission addition fails
39620
+ * @throws {NetworkError} When network communication fails
39621
+ */
39622
+ async submitSignedAddPermission(typedData, signature) {
39623
+ try {
39624
+ if (this.context.relayerCallbacks?.submitAddPermission) {
39625
+ return await this.context.relayerCallbacks.submitAddPermission(
39626
+ typedData,
39586
39627
  signature
39587
- ],
39588
- chain: this.context.walletClient.chain,
39589
- account: this.context.walletClient.account || null
39590
- });
39591
- return hash;
39628
+ );
39629
+ } else {
39630
+ return await this.submitDirectAddPermissionTransaction(
39631
+ typedData,
39632
+ signature
39633
+ );
39634
+ }
39592
39635
  } catch (error) {
39636
+ if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
39637
+ throw error;
39638
+ }
39593
39639
  throw new BlockchainError(
39594
- `Failed to add permission: ${error instanceof Error ? error.message : "Unknown error"}`,
39640
+ `Add permission submission failed: ${error instanceof Error ? error.message : "Unknown error"}`,
39595
39641
  error
39596
39642
  );
39597
39643
  }
39598
39644
  }
39599
39645
  /**
39600
- * Submit server files and permissions with signature to the blockchain
39646
+ * Submit server files and permissions with signature to the blockchain (supports gasless transactions)
39601
39647
  *
39602
39648
  * @param params - Parameters for adding server files and permissions
39603
39649
  * @returns Promise resolving to transaction hash
39650
+ * @throws {RelayerError} When gasless transaction submission fails
39651
+ * @throws {SignatureError} When user rejects the signature request
39652
+ * @throws {BlockchainError} When server files and permissions addition fails
39653
+ * @throws {NetworkError} When network communication fails
39604
39654
  */
39605
39655
  async submitAddServerFilesAndPermissions(params) {
39606
39656
  try {
39607
- const nonce = await this.getUserNonce();
39657
+ const nonce = await this.getPermissionsUserNonce();
39608
39658
  const serverFilesAndPermissionInput = {
39609
39659
  nonce,
39610
39660
  granteeId: params.granteeId,
@@ -39619,27 +39669,61 @@ var PermissionsController = class {
39619
39669
  serverFilesAndPermissionInput
39620
39670
  );
39621
39671
  const signature = await this.signTypedData(typedData);
39622
- const chainId = await this.context.walletClient.getChainId();
39623
- const DataPortabilityPermissionsAddress = getContractAddress(
39624
- chainId,
39625
- "DataPortabilityPermissions"
39672
+ return await this.submitSignedAddServerFilesAndPermissions(
39673
+ typedData,
39674
+ signature
39626
39675
  );
39627
- const DataPortabilityPermissionsAbi = getAbi(
39628
- "DataPortabilityPermissions"
39676
+ } catch (error) {
39677
+ if (error instanceof RelayerError || error instanceof UserRejectedRequestError || error instanceof SerializationError || error instanceof SignatureError || error instanceof NetworkError || error instanceof NonceError) {
39678
+ throw error;
39679
+ }
39680
+ throw new BlockchainError(
39681
+ `Failed to add server files and permissions: ${error instanceof Error ? error.message : "Unknown error"}`,
39682
+ error
39629
39683
  );
39630
- const hash = await this.context.walletClient.writeContract({
39631
- address: DataPortabilityPermissionsAddress,
39632
- abi: DataPortabilityPermissionsAbi,
39633
- functionName: "addServerFilesAndPermissions",
39634
- // @ts-expect-error - Complex nested array types cause compatibility issues with viem's generated types
39635
- args: [serverFilesAndPermissionInput, signature],
39636
- chain: this.context.walletClient.chain,
39637
- account: this.context.walletClient.account || null
39684
+ }
39685
+ }
39686
+ /**
39687
+ * Submits an already-signed add server files and permissions transaction to the blockchain.
39688
+ * This method supports both relayer-based gasless transactions and direct transactions.
39689
+ *
39690
+ * @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
39691
+ * @param signature - The user's signature
39692
+ * @returns Promise resolving to the transaction hash
39693
+ * @throws {RelayerError} When gasless transaction submission fails
39694
+ * @throws {BlockchainError} When server files and permissions addition fails
39695
+ * @throws {NetworkError} When network communication fails
39696
+ */
39697
+ async submitSignedAddServerFilesAndPermissions(typedData, signature) {
39698
+ try {
39699
+ console.debug("\u{1F50D} submitSignedAddServerFilesAndPermissions Debug Info:", {
39700
+ hasRelayerCallbacks: !!this.context.relayerCallbacks,
39701
+ hasSubmitMethod: !!this.context.relayerCallbacks?.submitAddServerFilesAndPermissions,
39702
+ availableRelayerMethods: this.context.relayerCallbacks ? Object.keys(this.context.relayerCallbacks) : []
39638
39703
  });
39639
- return hash;
39704
+ if (this.context.relayerCallbacks?.submitAddServerFilesAndPermissions) {
39705
+ console.debug(
39706
+ "\u{1F680} Using relayer for submitAddServerFilesAndPermissions"
39707
+ );
39708
+ return await this.context.relayerCallbacks.submitAddServerFilesAndPermissions(
39709
+ typedData,
39710
+ signature
39711
+ );
39712
+ } else {
39713
+ console.debug(
39714
+ "\u{1F4DD} Using direct transaction for submitAddServerFilesAndPermissions"
39715
+ );
39716
+ return await this.submitDirectAddServerFilesAndPermissionsTransaction(
39717
+ typedData,
39718
+ signature
39719
+ );
39720
+ }
39640
39721
  } catch (error) {
39722
+ if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
39723
+ throw error;
39724
+ }
39641
39725
  throw new BlockchainError(
39642
- `Failed to add server files and permissions: ${error instanceof Error ? error.message : "Unknown error"}`,
39726
+ `Add server files and permissions submission failed: ${error instanceof Error ? error.message : "Unknown error"}`,
39643
39727
  error
39644
39728
  );
39645
39729
  }
@@ -39676,6 +39760,71 @@ var PermissionsController = class {
39676
39760
  );
39677
39761
  }
39678
39762
  }
39763
+ /**
39764
+ * Submits a signed add permission transaction directly to the blockchain.
39765
+ *
39766
+ * @param typedData - The typed data structure for the permission addition
39767
+ * @param signature - The cryptographic signature authorizing the transaction
39768
+ * @returns Promise resolving to the transaction hash
39769
+ */
39770
+ async submitDirectAddPermissionTransaction(typedData, signature) {
39771
+ const chainId = await this.context.walletClient.getChainId();
39772
+ const DataPortabilityPermissionsAddress = getContractAddress(
39773
+ chainId,
39774
+ "DataPortabilityPermissions"
39775
+ );
39776
+ const DataPortabilityPermissionsAbi = getAbi("DataPortabilityPermissions");
39777
+ const permissionInput = {
39778
+ nonce: typedData.message.nonce,
39779
+ granteeId: typedData.message.granteeId,
39780
+ grant: typedData.message.grant,
39781
+ fileIds: typedData.message.fileIds || []
39782
+ };
39783
+ const hash = await this.context.walletClient.writeContract({
39784
+ address: DataPortabilityPermissionsAddress,
39785
+ abi: DataPortabilityPermissionsAbi,
39786
+ functionName: "addPermission",
39787
+ args: [permissionInput, signature],
39788
+ account: this.context.walletClient.account || await this.getUserAddress(),
39789
+ chain: this.context.walletClient.chain || null
39790
+ });
39791
+ return hash;
39792
+ }
39793
+ /**
39794
+ * Submits a signed add server files and permissions transaction directly to the blockchain.
39795
+ *
39796
+ * @param typedData - The typed data structure for the server files and permissions addition
39797
+ * @param signature - The cryptographic signature authorizing the transaction
39798
+ * @returns Promise resolving to the transaction hash
39799
+ */
39800
+ async submitDirectAddServerFilesAndPermissionsTransaction(typedData, signature) {
39801
+ const chainId = await this.context.walletClient.getChainId();
39802
+ const DataPortabilityPermissionsAddress = getContractAddress(
39803
+ chainId,
39804
+ "DataPortabilityPermissions"
39805
+ );
39806
+ const DataPortabilityPermissionsAbi = getAbi("DataPortabilityPermissions");
39807
+ const serverFilesAndPermissionInput = {
39808
+ nonce: typedData.message.nonce,
39809
+ granteeId: typedData.message.granteeId,
39810
+ grant: typedData.message.grant,
39811
+ fileUrls: typedData.message.fileUrls,
39812
+ serverAddress: typedData.message.serverAddress,
39813
+ serverUrl: typedData.message.serverUrl,
39814
+ serverPublicKey: typedData.message.serverPublicKey,
39815
+ filePermissions: typedData.message.filePermissions
39816
+ };
39817
+ const hash = await this.context.walletClient.writeContract({
39818
+ address: DataPortabilityPermissionsAddress,
39819
+ abi: DataPortabilityPermissionsAbi,
39820
+ functionName: "addServerFilesAndPermissions",
39821
+ // @ts-expect-error - Complex nested array types cause compatibility issues with viem's generated types
39822
+ args: [serverFilesAndPermissionInput, signature],
39823
+ account: this.context.walletClient.account || await this.getUserAddress(),
39824
+ chain: this.context.walletClient.chain || null
39825
+ });
39826
+ return hash;
39827
+ }
39679
39828
  };
39680
39829
 
39681
39830
  // src/controllers/data.ts
@@ -45343,6 +45492,13 @@ var CircuitBreaker = class {
45343
45492
  var import_viem10 = require("viem");
45344
45493
  async function handleRelayerRequest(sdk, payload) {
45345
45494
  const { typedData, signature, expectedUserAddress } = payload;
45495
+ console.debug({
45496
+ domain: typedData.domain,
45497
+ types: typedData.types,
45498
+ primaryType: typedData.primaryType,
45499
+ message: typedData.message,
45500
+ signature
45501
+ });
45346
45502
  const signerAddress = await (0, import_viem10.recoverTypedDataAddress)({
45347
45503
  domain: typedData.domain,
45348
45504
  types: typedData.types,
@@ -45380,7 +45536,7 @@ async function handleRelayerRequest(sdk, payload) {
45380
45536
  typedData,
45381
45537
  signature
45382
45538
  );
45383
- case "AddAndTrustServer":
45539
+ case "AddServer":
45384
45540
  return await sdk.permissions.submitSignedAddAndTrustServer(
45385
45541
  typedData,
45386
45542
  signature
@@ -45395,6 +45551,11 @@ async function handleRelayerRequest(sdk, payload) {
45395
45551
  typedData,
45396
45552
  signature
45397
45553
  );
45554
+ case "ServerFilesAndPermission":
45555
+ return await sdk.permissions.submitSignedAddServerFilesAndPermissions(
45556
+ typedData,
45557
+ signature
45558
+ );
45398
45559
  default:
45399
45560
  throw new Error(`Unsupported operation type: ${typedData.primaryType}`);
45400
45561
  }