@opendatalabs/vana-sdk 0.1.0-alpha.61efc06 → 0.1.0-alpha.64b26ef

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.
@@ -5451,6 +5451,16 @@ declare const contractAbis: {
5451
5451
  }];
5452
5452
  readonly name: "Upgraded";
5453
5453
  readonly type: "event";
5454
+ }, {
5455
+ readonly inputs: readonly [];
5456
+ readonly name: "DATA_PORTABILITY_ROLE";
5457
+ readonly outputs: readonly [{
5458
+ readonly internalType: "bytes32";
5459
+ readonly name: "";
5460
+ readonly type: "bytes32";
5461
+ }];
5462
+ readonly stateMutability: "view";
5463
+ readonly type: "function";
5454
5464
  }, {
5455
5465
  readonly inputs: readonly [];
5456
5466
  readonly name: "DEFAULT_ADMIN_ROLE";
@@ -5523,6 +5533,33 @@ declare const contractAbis: {
5523
5533
  readonly outputs: readonly [];
5524
5534
  readonly stateMutability: "nonpayable";
5525
5535
  readonly type: "function";
5536
+ }, {
5537
+ readonly inputs: readonly [{
5538
+ readonly internalType: "uint256";
5539
+ readonly name: "fileId";
5540
+ readonly type: "uint256";
5541
+ }, {
5542
+ readonly components: readonly [{
5543
+ readonly internalType: "address";
5544
+ readonly name: "account";
5545
+ readonly type: "address";
5546
+ }, {
5547
+ readonly internalType: "string";
5548
+ readonly name: "key";
5549
+ readonly type: "string";
5550
+ }];
5551
+ readonly internalType: "struct IDataRegistry.Permission[]";
5552
+ readonly name: "permissions";
5553
+ readonly type: "tuple[]";
5554
+ }, {
5555
+ readonly internalType: "uint256";
5556
+ readonly name: "schemaId";
5557
+ readonly type: "uint256";
5558
+ }];
5559
+ readonly name: "addFilePermissionsAndSchema";
5560
+ readonly outputs: readonly [];
5561
+ readonly stateMutability: "nonpayable";
5562
+ readonly type: "function";
5526
5563
  }, {
5527
5564
  readonly inputs: readonly [{
5528
5565
  readonly internalType: "string";
@@ -34766,19 +34803,31 @@ declare class DataController {
34766
34803
  */
34767
34804
  addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
34768
34805
  /**
34769
- * Submits a file permission transaction and returns the transaction hash immediately.
34806
+ * Submits a file permission transaction to the blockchain.
34770
34807
  *
34771
- * This is the lower-level method that provides maximum control over transaction timing.
34808
+ * @remarks
34809
+ * This method supports gasless transactions via relayer callbacks when configured.
34810
+ * It encrypts the user's encryption key with the recipient's public key before submission.
34772
34811
  * Use this when you want to handle transaction confirmation and event parsing separately.
34773
34812
  *
34774
- * @param fileId - The ID of the file to add permissions for
34775
- * @param account - The address of the account to grant permission to
34776
- * @param publicKey - The public key to encrypt the user's encryption key with
34777
- * @returns Promise resolving to the transaction hash
34813
+ * @param fileId - The ID of the file to grant permission for
34814
+ * @param account - The recipient's wallet address that will access the file
34815
+ * @param publicKey - The recipient's public key for encryption.
34816
+ * Obtain via `vana.server.getIdentity(account).public_key`
34817
+ * @returns Promise resolving to TransactionHandle for tracking the transaction
34818
+ * @throws {Error} When chain ID is not available
34819
+ * @throws {Error} When encryption key generation fails
34820
+ * @throws {Error} When public key encryption fails
34821
+ *
34778
34822
  * @example
34779
34823
  * ```typescript
34780
- * const txHash = await vana.data.submitFilePermission(fileId, account, publicKey);
34781
- * console.log(`Transaction submitted: ${txHash}`);
34824
+ * const tx = await vana.data.submitFilePermission(
34825
+ * fileId,
34826
+ * "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
34827
+ * recipientPublicKey
34828
+ * );
34829
+ * const result = await tx.waitForEvents();
34830
+ * console.log(`Permission granted with ID: ${result.permissionId}`);
34782
34831
  * ```
34783
34832
  */
34784
34833
  submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
@@ -3038,6 +3038,19 @@ var init_DataRegistryImplementation = __esm({
3038
3038
  name: "Upgraded",
3039
3039
  type: "event"
3040
3040
  },
3041
+ {
3042
+ inputs: [],
3043
+ name: "DATA_PORTABILITY_ROLE",
3044
+ outputs: [
3045
+ {
3046
+ internalType: "bytes32",
3047
+ name: "",
3048
+ type: "bytes32"
3049
+ }
3050
+ ],
3051
+ stateMutability: "view",
3052
+ type: "function"
3053
+ },
3041
3054
  {
3042
3055
  inputs: [],
3043
3056
  name: "DEFAULT_ADMIN_ROLE",
@@ -3132,6 +3145,41 @@ var init_DataRegistryImplementation = __esm({
3132
3145
  stateMutability: "nonpayable",
3133
3146
  type: "function"
3134
3147
  },
3148
+ {
3149
+ inputs: [
3150
+ {
3151
+ internalType: "uint256",
3152
+ name: "fileId",
3153
+ type: "uint256"
3154
+ },
3155
+ {
3156
+ components: [
3157
+ {
3158
+ internalType: "address",
3159
+ name: "account",
3160
+ type: "address"
3161
+ },
3162
+ {
3163
+ internalType: "string",
3164
+ name: "key",
3165
+ type: "string"
3166
+ }
3167
+ ],
3168
+ internalType: "struct IDataRegistry.Permission[]",
3169
+ name: "permissions",
3170
+ type: "tuple[]"
3171
+ },
3172
+ {
3173
+ internalType: "uint256",
3174
+ name: "schemaId",
3175
+ type: "uint256"
3176
+ }
3177
+ ],
3178
+ name: "addFilePermissionsAndSchema",
3179
+ outputs: [],
3180
+ stateMutability: "nonpayable",
3181
+ type: "function"
3182
+ },
3135
3183
  {
3136
3184
  inputs: [
3137
3185
  {
@@ -43443,19 +43491,31 @@ var DataController = class {
43443
43491
  return await this.submitFilePermission(fileId, account, publicKey);
43444
43492
  }
43445
43493
  /**
43446
- * Submits a file permission transaction and returns the transaction hash immediately.
43494
+ * Submits a file permission transaction to the blockchain.
43447
43495
  *
43448
- * This is the lower-level method that provides maximum control over transaction timing.
43496
+ * @remarks
43497
+ * This method supports gasless transactions via relayer callbacks when configured.
43498
+ * It encrypts the user's encryption key with the recipient's public key before submission.
43449
43499
  * Use this when you want to handle transaction confirmation and event parsing separately.
43450
43500
  *
43451
- * @param fileId - The ID of the file to add permissions for
43452
- * @param account - The address of the account to grant permission to
43453
- * @param publicKey - The public key to encrypt the user's encryption key with
43454
- * @returns Promise resolving to the transaction hash
43501
+ * @param fileId - The ID of the file to grant permission for
43502
+ * @param account - The recipient's wallet address that will access the file
43503
+ * @param publicKey - The recipient's public key for encryption.
43504
+ * Obtain via `vana.server.getIdentity(account).public_key`
43505
+ * @returns Promise resolving to TransactionHandle for tracking the transaction
43506
+ * @throws {Error} When chain ID is not available
43507
+ * @throws {Error} When encryption key generation fails
43508
+ * @throws {Error} When public key encryption fails
43509
+ *
43455
43510
  * @example
43456
43511
  * ```typescript
43457
- * const txHash = await vana.data.submitFilePermission(fileId, account, publicKey);
43458
- * console.log(`Transaction submitted: ${txHash}`);
43512
+ * const tx = await vana.data.submitFilePermission(
43513
+ * fileId,
43514
+ * "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
43515
+ * recipientPublicKey
43516
+ * );
43517
+ * const result = await tx.waitForEvents();
43518
+ * console.log(`Permission granted with ID: ${result.permissionId}`);
43459
43519
  * ```
43460
43520
  */
43461
43521
  async submitFilePermission(fileId, account, publicKey) {