@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.
@@ -36510,7 +36510,7 @@ var PermissionsController = class {
36510
36510
  throw new Error("Failed to store grant file - no URL returned");
36511
36511
  }
36512
36512
  }
36513
- const nonce = await this.getUserNonce();
36513
+ const nonce = await this.getPermissionsUserNonce();
36514
36514
  console.debug(
36515
36515
  "\u{1F50D} Debug - Final grant URL being passed to compose:",
36516
36516
  grantUrl
@@ -36603,7 +36603,7 @@ var PermissionsController = class {
36603
36603
  throw new Error("Failed to store grant file - no URL returned");
36604
36604
  }
36605
36605
  }
36606
- const nonce = await this.getUserNonce();
36606
+ const nonce = await this.getPermissionsUserNonce();
36607
36607
  console.debug(
36608
36608
  "\u{1F50D} Debug - Final grant URL being passed to compose:",
36609
36609
  grantUrl
@@ -36668,14 +36668,8 @@ var PermissionsController = class {
36668
36668
  )
36669
36669
  );
36670
36670
  if (this.context.relayerCallbacks?.submitPermissionGrant) {
36671
- const jsonSafeTypedData = JSON.parse(
36672
- JSON.stringify(
36673
- typedData,
36674
- (_key, value) => typeof value === "bigint" ? value.toString() : value
36675
- )
36676
- );
36677
36671
  return await this.context.relayerCallbacks.submitPermissionGrant(
36678
- jsonSafeTypedData,
36672
+ typedData,
36679
36673
  signature
36680
36674
  );
36681
36675
  } else {
@@ -36745,7 +36739,6 @@ var PermissionsController = class {
36745
36739
  try {
36746
36740
  const addAndTrustServerInput = {
36747
36741
  nonce: BigInt(typedData.message.nonce),
36748
- owner: typedData.message.owner,
36749
36742
  serverAddress: typedData.message.serverAddress,
36750
36743
  serverUrl: typedData.message.serverUrl,
36751
36744
  publicKey: typedData.message.publicKey
@@ -36759,7 +36752,7 @@ var PermissionsController = class {
36759
36752
  throw error;
36760
36753
  }
36761
36754
  throw new BlockchainError(
36762
- `Add and trust server submission failed: ${error instanceof Error ? error.message : "Unknown error"}`,
36755
+ `Add and trust server submission failed444444: ${error instanceof Error ? error.message : "Unknown error"}`,
36763
36756
  error
36764
36757
  );
36765
36758
  }
@@ -36775,14 +36768,8 @@ var PermissionsController = class {
36775
36768
  async submitSignedRevoke(typedData, signature) {
36776
36769
  try {
36777
36770
  if (this.context.relayerCallbacks?.submitPermissionRevoke) {
36778
- const jsonSafeTypedData = JSON.parse(
36779
- JSON.stringify(
36780
- typedData,
36781
- (_key, value) => typeof value === "bigint" ? value.toString() : value
36782
- )
36783
- );
36784
36771
  return await this.context.relayerCallbacks.submitPermissionRevoke(
36785
- jsonSafeTypedData,
36772
+ typedData,
36786
36773
  signature
36787
36774
  );
36788
36775
  } else {
@@ -36964,7 +36951,7 @@ var PermissionsController = class {
36964
36951
  if (!this.context.walletClient.chain?.id) {
36965
36952
  throw new BlockchainError("Chain ID not available");
36966
36953
  }
36967
- const nonce = await this.getUserNonce();
36954
+ const nonce = await this.getPermissionsUserNonce();
36968
36955
  const revokePermissionInput = {
36969
36956
  nonce,
36970
36957
  permissionId: params.permissionId
@@ -36997,7 +36984,10 @@ var PermissionsController = class {
36997
36984
  }
36998
36985
  }
36999
36986
  /**
36987
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
36988
+ *
37000
36989
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
36990
+ * This method is deprecated in favor of more specific nonce methods.
37001
36991
  *
37002
36992
  * The nonce is used to prevent replay attacks in signed transactions and must
37003
36993
  * be incremented with each transaction to maintain security.
@@ -37009,8 +36999,12 @@ var PermissionsController = class {
37009
36999
  * @private
37010
37000
  * @example
37011
37001
  * ```typescript
37002
+ * // Deprecated - use specific methods instead
37012
37003
  * const nonce = await this.getUserNonce();
37013
- * console.log(`Current nonce: ${nonce}`);
37004
+ *
37005
+ * // Use these instead:
37006
+ * const permissionsNonce = await this.getPermissionsUserNonce();
37007
+ * const serversNonce = await this.getServersUserNonce();
37014
37008
  * ```
37015
37009
  */
37016
37010
  async getUserNonce() {
@@ -37039,16 +37033,17 @@ var PermissionsController = class {
37039
37033
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
37040
37034
  * This nonce is used for server-related operations (AddAndTrustServer, TrustServer, UntrustServer).
37041
37035
  *
37042
- * @returns Promise resolving to the current nonce
37036
+ * @returns Promise resolving to the current servers nonce
37037
+ * @throws {NonceError} When reading nonce from contract fails
37043
37038
  * @private
37044
37039
  *
37045
37040
  * @example
37046
37041
  * ```typescript
37047
- * const nonce = await this.getServerNonce();
37048
- * console.log(`Current server nonce: ${nonce}`);
37042
+ * const nonce = await this.getServersUserNonce();
37043
+ * console.log(`Current servers nonce: ${nonce}`);
37049
37044
  * ```
37050
37045
  */
37051
- async getServerNonce() {
37046
+ async getServersUserNonce() {
37052
37047
  try {
37053
37048
  const userAddress = await this.getUserAddress();
37054
37049
  const chainId = await this.context.walletClient.getChainId();
@@ -37070,6 +37065,44 @@ var PermissionsController = class {
37070
37065
  );
37071
37066
  }
37072
37067
  }
37068
+ /**
37069
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
37070
+ * This nonce is used for permission-related operations (addPermission, addServerFilesAndPermissions).
37071
+ *
37072
+ * @returns Promise resolving to the current permissions nonce
37073
+ * @throws {NonceError} When reading nonce from contract fails
37074
+ * @private
37075
+ *
37076
+ * @example
37077
+ * ```typescript
37078
+ * const nonce = await this.getPermissionsUserNonce();
37079
+ * console.log(`Current permissions nonce: ${nonce}`);
37080
+ * ```
37081
+ */
37082
+ async getPermissionsUserNonce() {
37083
+ try {
37084
+ const userAddress = await this.getUserAddress();
37085
+ const chainId = await this.context.walletClient.getChainId();
37086
+ const DataPortabilityPermissionsAddress = getContractAddress(
37087
+ chainId,
37088
+ "DataPortabilityPermissions"
37089
+ );
37090
+ const DataPortabilityPermissionsAbi = getAbi(
37091
+ "DataPortabilityPermissions"
37092
+ );
37093
+ const nonce = await this.context.publicClient.readContract({
37094
+ address: DataPortabilityPermissionsAddress,
37095
+ abi: DataPortabilityPermissionsAbi,
37096
+ functionName: "userNonce",
37097
+ args: [userAddress]
37098
+ });
37099
+ return nonce;
37100
+ } catch (error) {
37101
+ throw new NonceError(
37102
+ `Failed to retrieve permissions nonce: ${error instanceof Error ? error.message : "Unknown error"}`
37103
+ );
37104
+ }
37105
+ }
37073
37106
  /**
37074
37107
  * Composes the EIP-712 typed data for PermissionGrant (new simplified format).
37075
37108
  *
@@ -37431,12 +37464,13 @@ var PermissionsController = class {
37431
37464
  "DataPortabilityServers"
37432
37465
  );
37433
37466
  const DataPortabilityServersAbi = getAbi("DataPortabilityServers");
37467
+ const userAddress = this.context.walletClient.account?.address || await this.getUserAddress();
37434
37468
  const txHash = await this.context.walletClient.writeContract({
37435
37469
  address: DataPortabilityServersAddress,
37436
37470
  abi: DataPortabilityServersAbi,
37437
37471
  functionName: "addAndTrustServerOnBehalf",
37438
37472
  args: [
37439
- params.owner,
37473
+ userAddress,
37440
37474
  {
37441
37475
  serverAddress: params.serverAddress,
37442
37476
  serverUrl: params.serverUrl,
@@ -37499,10 +37533,9 @@ var PermissionsController = class {
37499
37533
  */
37500
37534
  async submitAddAndTrustServerWithSignature(params) {
37501
37535
  try {
37502
- const nonce = await this.getServerNonce();
37536
+ const nonce = await this.getServersUserNonce();
37503
37537
  const addAndTrustServerInput = {
37504
37538
  nonce,
37505
- owner: params.owner,
37506
37539
  serverAddress: params.serverAddress,
37507
37540
  publicKey: params.publicKey,
37508
37541
  serverUrl: params.serverUrl
@@ -37512,7 +37545,6 @@ var PermissionsController = class {
37512
37545
  );
37513
37546
  console.debug("\u{1F50D} AddAndTrustServer Debug Info:", {
37514
37547
  nonce: nonce.toString(),
37515
- owner: params.owner,
37516
37548
  serverAddress: params.serverAddress,
37517
37549
  publicKey: params.publicKey,
37518
37550
  serverUrl: params.serverUrl,
@@ -37564,7 +37596,7 @@ var PermissionsController = class {
37564
37596
  */
37565
37597
  async submitTrustServerWithSignature(params) {
37566
37598
  try {
37567
- const nonce = await this.getServerNonce();
37599
+ const nonce = await this.getServersUserNonce();
37568
37600
  const trustServerInput = {
37569
37601
  nonce,
37570
37602
  serverId: params.serverId
@@ -37659,7 +37691,7 @@ var PermissionsController = class {
37659
37691
  * ```
37660
37692
  */
37661
37693
  async submitUntrustServer(params) {
37662
- const nonce = await this.getUserNonce();
37694
+ const nonce = await this.getServersUserNonce();
37663
37695
  const untrustServerInput = {
37664
37696
  nonce,
37665
37697
  serverId: params.serverId
@@ -37680,7 +37712,7 @@ var PermissionsController = class {
37680
37712
  */
37681
37713
  async submitUntrustServerWithSignature(params) {
37682
37714
  try {
37683
- const nonce = await this.getServerNonce();
37715
+ const nonce = await this.getServersUserNonce();
37684
37716
  const untrustServerInput = {
37685
37717
  nonce,
37686
37718
  serverId: params.serverId
@@ -37988,18 +38020,18 @@ var PermissionsController = class {
37988
38020
  */
37989
38021
  async composeAddAndTrustServerMessage(input) {
37990
38022
  const domain = await this.getServersDomain();
38023
+ console.debug(domain);
37991
38024
  return {
37992
38025
  domain,
37993
38026
  types: {
37994
- AddAndTrustServer: [
38027
+ AddServer: [
37995
38028
  { name: "nonce", type: "uint256" },
37996
- { name: "owner", type: "address" },
37997
38029
  { name: "serverAddress", type: "address" },
37998
- { name: "publicKey", type: "bytes" },
38030
+ { name: "publicKey", type: "string" },
37999
38031
  { name: "serverUrl", type: "string" }
38000
38032
  ]
38001
38033
  },
38002
- primaryType: "AddAndTrustServer",
38034
+ primaryType: "AddServer",
38003
38035
  message: input
38004
38036
  };
38005
38037
  }
@@ -38080,7 +38112,6 @@ var PermissionsController = class {
38080
38112
  contractAddress: DataPortabilityServersAddress,
38081
38113
  input: {
38082
38114
  nonce: addAndTrustServerInput.nonce.toString(),
38083
- owner: addAndTrustServerInput.owner,
38084
38115
  serverAddress: addAndTrustServerInput.serverAddress,
38085
38116
  publicKey: addAndTrustServerInput.publicKey,
38086
38117
  serverUrl: addAndTrustServerInput.serverUrl
@@ -38094,7 +38125,6 @@ var PermissionsController = class {
38094
38125
  args: [
38095
38126
  {
38096
38127
  nonce: addAndTrustServerInput.nonce,
38097
- owner: addAndTrustServerInput.owner,
38098
38128
  serverAddress: addAndTrustServerInput.serverAddress,
38099
38129
  publicKey: addAndTrustServerInput.publicKey,
38100
38130
  serverUrl: addAndTrustServerInput.serverUrl
@@ -38247,7 +38277,7 @@ var PermissionsController = class {
38247
38277
  * ```
38248
38278
  */
38249
38279
  async submitRegisterGranteeWithSignature(params) {
38250
- const nonce = await this.getUserNonce();
38280
+ const nonce = await this.getServersUserNonce();
38251
38281
  const registerGranteeInput = {
38252
38282
  nonce,
38253
38283
  owner: params.owner,
@@ -39397,14 +39427,18 @@ var PermissionsController = class {
39397
39427
  }
39398
39428
  }
39399
39429
  /**
39400
- * Submit permission with signature to the blockchain
39430
+ * Submit permission with signature to the blockchain (supports gasless transactions)
39401
39431
  *
39402
39432
  * @param params - Parameters for adding permission
39403
39433
  * @returns Promise resolving to transaction hash
39434
+ * @throws {RelayerError} When gasless transaction submission fails
39435
+ * @throws {SignatureError} When user rejects the signature request
39436
+ * @throws {BlockchainError} When permission addition fails
39437
+ * @throws {NetworkError} When network communication fails
39404
39438
  */
39405
39439
  async submitAddPermission(params) {
39406
39440
  try {
39407
- const nonce = await this.getUserNonce();
39441
+ const nonce = await this.getPermissionsUserNonce();
39408
39442
  const addPermissionInput = {
39409
39443
  nonce,
39410
39444
  granteeId: params.granteeId,
@@ -39417,48 +39451,64 @@ var PermissionsController = class {
39417
39451
  };
39418
39452
  const typedData = await this.composeServerFilesAndPermissionMessage(addPermissionInput);
39419
39453
  const signature = await this.signTypedData(typedData);
39420
- const chainId = await this.context.walletClient.getChainId();
39421
- const DataPortabilityPermissionsAddress = getContractAddress(
39422
- chainId,
39423
- "DataPortabilityPermissions"
39424
- );
39425
- const DataPortabilityPermissionsAbi = getAbi(
39426
- "DataPortabilityPermissions"
39454
+ return await this.submitSignedAddPermission(typedData, signature);
39455
+ } catch (error) {
39456
+ if (error instanceof RelayerError || error instanceof UserRejectedRequestError || error instanceof SerializationError || error instanceof SignatureError || error instanceof NetworkError || error instanceof NonceError) {
39457
+ throw error;
39458
+ }
39459
+ throw new BlockchainError(
39460
+ `Failed to add permission: ${error instanceof Error ? error.message : "Unknown error"}`,
39461
+ error
39427
39462
  );
39428
- const hash = await this.context.walletClient.writeContract({
39429
- address: DataPortabilityPermissionsAddress,
39430
- abi: DataPortabilityPermissionsAbi,
39431
- functionName: "addPermission",
39432
- args: [
39433
- {
39434
- nonce: addPermissionInput.nonce,
39435
- granteeId: addPermissionInput.granteeId,
39436
- grant: addPermissionInput.grant,
39437
- fileIds: []
39438
- // Note: This should be handled differently for addPermission vs addServerFilesAndPermissions
39439
- },
39463
+ }
39464
+ }
39465
+ /**
39466
+ * Submits an already-signed add permission transaction to the blockchain.
39467
+ * This method supports both relayer-based gasless transactions and direct transactions.
39468
+ *
39469
+ * @param typedData - The EIP-712 typed data for AddPermission
39470
+ * @param signature - The user's signature
39471
+ * @returns Promise resolving to the transaction hash
39472
+ * @throws {RelayerError} When gasless transaction submission fails
39473
+ * @throws {BlockchainError} When permission addition fails
39474
+ * @throws {NetworkError} When network communication fails
39475
+ */
39476
+ async submitSignedAddPermission(typedData, signature) {
39477
+ try {
39478
+ if (this.context.relayerCallbacks?.submitAddPermission) {
39479
+ return await this.context.relayerCallbacks.submitAddPermission(
39480
+ typedData,
39440
39481
  signature
39441
- ],
39442
- chain: this.context.walletClient.chain,
39443
- account: this.context.walletClient.account || null
39444
- });
39445
- return hash;
39482
+ );
39483
+ } else {
39484
+ return await this.submitDirectAddPermissionTransaction(
39485
+ typedData,
39486
+ signature
39487
+ );
39488
+ }
39446
39489
  } catch (error) {
39490
+ if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
39491
+ throw error;
39492
+ }
39447
39493
  throw new BlockchainError(
39448
- `Failed to add permission: ${error instanceof Error ? error.message : "Unknown error"}`,
39494
+ `Add permission submission failed: ${error instanceof Error ? error.message : "Unknown error"}`,
39449
39495
  error
39450
39496
  );
39451
39497
  }
39452
39498
  }
39453
39499
  /**
39454
- * Submit server files and permissions with signature to the blockchain
39500
+ * Submit server files and permissions with signature to the blockchain (supports gasless transactions)
39455
39501
  *
39456
39502
  * @param params - Parameters for adding server files and permissions
39457
39503
  * @returns Promise resolving to transaction hash
39504
+ * @throws {RelayerError} When gasless transaction submission fails
39505
+ * @throws {SignatureError} When user rejects the signature request
39506
+ * @throws {BlockchainError} When server files and permissions addition fails
39507
+ * @throws {NetworkError} When network communication fails
39458
39508
  */
39459
39509
  async submitAddServerFilesAndPermissions(params) {
39460
39510
  try {
39461
- const nonce = await this.getUserNonce();
39511
+ const nonce = await this.getPermissionsUserNonce();
39462
39512
  const serverFilesAndPermissionInput = {
39463
39513
  nonce,
39464
39514
  granteeId: params.granteeId,
@@ -39473,27 +39523,61 @@ var PermissionsController = class {
39473
39523
  serverFilesAndPermissionInput
39474
39524
  );
39475
39525
  const signature = await this.signTypedData(typedData);
39476
- const chainId = await this.context.walletClient.getChainId();
39477
- const DataPortabilityPermissionsAddress = getContractAddress(
39478
- chainId,
39479
- "DataPortabilityPermissions"
39526
+ return await this.submitSignedAddServerFilesAndPermissions(
39527
+ typedData,
39528
+ signature
39480
39529
  );
39481
- const DataPortabilityPermissionsAbi = getAbi(
39482
- "DataPortabilityPermissions"
39530
+ } catch (error) {
39531
+ if (error instanceof RelayerError || error instanceof UserRejectedRequestError || error instanceof SerializationError || error instanceof SignatureError || error instanceof NetworkError || error instanceof NonceError) {
39532
+ throw error;
39533
+ }
39534
+ throw new BlockchainError(
39535
+ `Failed to add server files and permissions: ${error instanceof Error ? error.message : "Unknown error"}`,
39536
+ error
39483
39537
  );
39484
- const hash = await this.context.walletClient.writeContract({
39485
- address: DataPortabilityPermissionsAddress,
39486
- abi: DataPortabilityPermissionsAbi,
39487
- functionName: "addServerFilesAndPermissions",
39488
- // @ts-expect-error - Complex nested array types cause compatibility issues with viem's generated types
39489
- args: [serverFilesAndPermissionInput, signature],
39490
- chain: this.context.walletClient.chain,
39491
- account: this.context.walletClient.account || null
39538
+ }
39539
+ }
39540
+ /**
39541
+ * Submits an already-signed add server files and permissions transaction to the blockchain.
39542
+ * This method supports both relayer-based gasless transactions and direct transactions.
39543
+ *
39544
+ * @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
39545
+ * @param signature - The user's signature
39546
+ * @returns Promise resolving to the transaction hash
39547
+ * @throws {RelayerError} When gasless transaction submission fails
39548
+ * @throws {BlockchainError} When server files and permissions addition fails
39549
+ * @throws {NetworkError} When network communication fails
39550
+ */
39551
+ async submitSignedAddServerFilesAndPermissions(typedData, signature) {
39552
+ try {
39553
+ console.debug("\u{1F50D} submitSignedAddServerFilesAndPermissions Debug Info:", {
39554
+ hasRelayerCallbacks: !!this.context.relayerCallbacks,
39555
+ hasSubmitMethod: !!this.context.relayerCallbacks?.submitAddServerFilesAndPermissions,
39556
+ availableRelayerMethods: this.context.relayerCallbacks ? Object.keys(this.context.relayerCallbacks) : []
39492
39557
  });
39493
- return hash;
39558
+ if (this.context.relayerCallbacks?.submitAddServerFilesAndPermissions) {
39559
+ console.debug(
39560
+ "\u{1F680} Using relayer for submitAddServerFilesAndPermissions"
39561
+ );
39562
+ return await this.context.relayerCallbacks.submitAddServerFilesAndPermissions(
39563
+ typedData,
39564
+ signature
39565
+ );
39566
+ } else {
39567
+ console.debug(
39568
+ "\u{1F4DD} Using direct transaction for submitAddServerFilesAndPermissions"
39569
+ );
39570
+ return await this.submitDirectAddServerFilesAndPermissionsTransaction(
39571
+ typedData,
39572
+ signature
39573
+ );
39574
+ }
39494
39575
  } catch (error) {
39576
+ if (error instanceof RelayerError || error instanceof NetworkError || error instanceof UserRejectedRequestError || error instanceof SignatureError || error instanceof NonceError) {
39577
+ throw error;
39578
+ }
39495
39579
  throw new BlockchainError(
39496
- `Failed to add server files and permissions: ${error instanceof Error ? error.message : "Unknown error"}`,
39580
+ `Add server files and permissions submission failed: ${error instanceof Error ? error.message : "Unknown error"}`,
39497
39581
  error
39498
39582
  );
39499
39583
  }
@@ -39530,6 +39614,71 @@ var PermissionsController = class {
39530
39614
  );
39531
39615
  }
39532
39616
  }
39617
+ /**
39618
+ * Submits a signed add permission transaction directly to the blockchain.
39619
+ *
39620
+ * @param typedData - The typed data structure for the permission addition
39621
+ * @param signature - The cryptographic signature authorizing the transaction
39622
+ * @returns Promise resolving to the transaction hash
39623
+ */
39624
+ async submitDirectAddPermissionTransaction(typedData, signature) {
39625
+ const chainId = await this.context.walletClient.getChainId();
39626
+ const DataPortabilityPermissionsAddress = getContractAddress(
39627
+ chainId,
39628
+ "DataPortabilityPermissions"
39629
+ );
39630
+ const DataPortabilityPermissionsAbi = getAbi("DataPortabilityPermissions");
39631
+ const permissionInput = {
39632
+ nonce: typedData.message.nonce,
39633
+ granteeId: typedData.message.granteeId,
39634
+ grant: typedData.message.grant,
39635
+ fileIds: typedData.message.fileIds || []
39636
+ };
39637
+ const hash = await this.context.walletClient.writeContract({
39638
+ address: DataPortabilityPermissionsAddress,
39639
+ abi: DataPortabilityPermissionsAbi,
39640
+ functionName: "addPermission",
39641
+ args: [permissionInput, signature],
39642
+ account: this.context.walletClient.account || await this.getUserAddress(),
39643
+ chain: this.context.walletClient.chain || null
39644
+ });
39645
+ return hash;
39646
+ }
39647
+ /**
39648
+ * Submits a signed add server files and permissions transaction directly to the blockchain.
39649
+ *
39650
+ * @param typedData - The typed data structure for the server files and permissions addition
39651
+ * @param signature - The cryptographic signature authorizing the transaction
39652
+ * @returns Promise resolving to the transaction hash
39653
+ */
39654
+ async submitDirectAddServerFilesAndPermissionsTransaction(typedData, signature) {
39655
+ const chainId = await this.context.walletClient.getChainId();
39656
+ const DataPortabilityPermissionsAddress = getContractAddress(
39657
+ chainId,
39658
+ "DataPortabilityPermissions"
39659
+ );
39660
+ const DataPortabilityPermissionsAbi = getAbi("DataPortabilityPermissions");
39661
+ const serverFilesAndPermissionInput = {
39662
+ nonce: typedData.message.nonce,
39663
+ granteeId: typedData.message.granteeId,
39664
+ grant: typedData.message.grant,
39665
+ fileUrls: typedData.message.fileUrls,
39666
+ serverAddress: typedData.message.serverAddress,
39667
+ serverUrl: typedData.message.serverUrl,
39668
+ serverPublicKey: typedData.message.serverPublicKey,
39669
+ filePermissions: typedData.message.filePermissions
39670
+ };
39671
+ const hash = await this.context.walletClient.writeContract({
39672
+ address: DataPortabilityPermissionsAddress,
39673
+ abi: DataPortabilityPermissionsAbi,
39674
+ functionName: "addServerFilesAndPermissions",
39675
+ // @ts-expect-error - Complex nested array types cause compatibility issues with viem's generated types
39676
+ args: [serverFilesAndPermissionInput, signature],
39677
+ account: this.context.walletClient.account || await this.getUserAddress(),
39678
+ chain: this.context.walletClient.chain || null
39679
+ });
39680
+ return hash;
39681
+ }
39533
39682
  };
39534
39683
 
39535
39684
  // src/controllers/data.ts
@@ -45203,6 +45352,13 @@ var CircuitBreaker = class {
45203
45352
  import { recoverTypedDataAddress } from "viem";
45204
45353
  async function handleRelayerRequest(sdk, payload) {
45205
45354
  const { typedData, signature, expectedUserAddress } = payload;
45355
+ console.debug({
45356
+ domain: typedData.domain,
45357
+ types: typedData.types,
45358
+ primaryType: typedData.primaryType,
45359
+ message: typedData.message,
45360
+ signature
45361
+ });
45206
45362
  const signerAddress = await recoverTypedDataAddress({
45207
45363
  domain: typedData.domain,
45208
45364
  types: typedData.types,
@@ -45240,7 +45396,7 @@ async function handleRelayerRequest(sdk, payload) {
45240
45396
  typedData,
45241
45397
  signature
45242
45398
  );
45243
- case "AddAndTrustServer":
45399
+ case "AddServer":
45244
45400
  return await sdk.permissions.submitSignedAddAndTrustServer(
45245
45401
  typedData,
45246
45402
  signature
@@ -45255,6 +45411,11 @@ async function handleRelayerRequest(sdk, payload) {
45255
45411
  typedData,
45256
45412
  signature
45257
45413
  );
45414
+ case "ServerFilesAndPermission":
45415
+ return await sdk.permissions.submitSignedAddServerFilesAndPermissions(
45416
+ typedData,
45417
+ signature
45418
+ );
45258
45419
  default:
45259
45420
  throw new Error(`Unsupported operation type: ${typedData.primaryType}`);
45260
45421
  }