@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.
@@ -634,8 +634,6 @@ interface ServerInfo {
634
634
  * @category Permissions
635
635
  */
636
636
  interface AddAndTrustServerParams {
637
- /** Server owner address */
638
- owner: Address;
639
637
  /** Server address */
640
638
  serverAddress: Address;
641
639
  /** Server URL */
@@ -670,8 +668,6 @@ interface UntrustServerParams {
670
668
  interface AddAndTrustServerInput {
671
669
  /** User nonce */
672
670
  nonce: bigint;
673
- /** Server owner address */
674
- owner: Address;
675
671
  /** Server address */
676
672
  serverAddress: Address;
677
673
  /** Server URL */
@@ -712,13 +708,13 @@ interface AddAndTrustServerTypedData {
712
708
  domain: PermissionGrantDomain;
713
709
  /** EIP-712 types */
714
710
  types: {
715
- AddAndTrustServer: Array<{
711
+ AddServer: Array<{
716
712
  name: string;
717
713
  type: string;
718
714
  }>;
719
715
  };
720
716
  /** Primary type */
721
- primaryType: "AddAndTrustServer";
717
+ primaryType: "AddServer";
722
718
  /** Message to sign */
723
719
  message: AddAndTrustServerInput;
724
720
  }
@@ -1143,6 +1139,22 @@ interface RelayerCallbacks {
1143
1139
  * @returns Promise resolving to the transaction hash
1144
1140
  */
1145
1141
  submitAddAndTrustServer?: (typedData: AddAndTrustServerTypedData, signature: Hash) => Promise<Hash>;
1142
+ /**
1143
+ * Submit a signed permission addition transaction for relay
1144
+ *
1145
+ * @param typedData - The EIP-712 typed data that was signed
1146
+ * @param signature - The user's signature
1147
+ * @returns Promise resolving to the transaction hash
1148
+ */
1149
+ submitAddPermission?: (typedData: GenericTypedData, signature: Hash) => Promise<Hash>;
1150
+ /**
1151
+ * Submit a signed server files and permissions transaction for relay
1152
+ *
1153
+ * @param typedData - The EIP-712 typed data that was signed
1154
+ * @param signature - The user's signature
1155
+ * @returns Promise resolving to the transaction hash
1156
+ */
1157
+ submitAddServerFilesAndPermissions?: (typedData: ServerFilesAndPermissionTypedData, signature: Hash) => Promise<Hash>;
1146
1158
  /**
1147
1159
  * Submit a file addition for relay
1148
1160
  *
@@ -30031,7 +30043,10 @@ declare class PermissionsController {
30031
30043
  */
30032
30044
  submitRevokeWithSignature(params: RevokePermissionParams): Promise<Hash>;
30033
30045
  /**
30046
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30047
+ *
30034
30048
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
30049
+ * This method is deprecated in favor of more specific nonce methods.
30035
30050
  *
30036
30051
  * The nonce is used to prevent replay attacks in signed transactions and must
30037
30052
  * be incremented with each transaction to maintain security.
@@ -30043,8 +30058,12 @@ declare class PermissionsController {
30043
30058
  * @private
30044
30059
  * @example
30045
30060
  * ```typescript
30061
+ * // Deprecated - use specific methods instead
30046
30062
  * const nonce = await this.getUserNonce();
30047
- * console.log(`Current nonce: ${nonce}`);
30063
+ *
30064
+ * // Use these instead:
30065
+ * const permissionsNonce = await this.getPermissionsUserNonce();
30066
+ * const serversNonce = await this.getServersUserNonce();
30048
30067
  * ```
30049
30068
  */
30050
30069
  private getUserNonce;
@@ -30052,16 +30071,32 @@ declare class PermissionsController {
30052
30071
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
30053
30072
  * This nonce is used for server-related operations (AddAndTrustServer, TrustServer, UntrustServer).
30054
30073
  *
30055
- * @returns Promise resolving to the current nonce
30074
+ * @returns Promise resolving to the current servers nonce
30075
+ * @throws {NonceError} When reading nonce from contract fails
30056
30076
  * @private
30057
30077
  *
30058
30078
  * @example
30059
30079
  * ```typescript
30060
- * const nonce = await this.getServerNonce();
30061
- * console.log(`Current server nonce: ${nonce}`);
30080
+ * const nonce = await this.getServersUserNonce();
30081
+ * console.log(`Current servers nonce: ${nonce}`);
30062
30082
  * ```
30063
30083
  */
30064
- private getServerNonce;
30084
+ private getServersUserNonce;
30085
+ /**
30086
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
30087
+ * This nonce is used for permission-related operations (addPermission, addServerFilesAndPermissions).
30088
+ *
30089
+ * @returns Promise resolving to the current permissions nonce
30090
+ * @throws {NonceError} When reading nonce from contract fails
30091
+ * @private
30092
+ *
30093
+ * @example
30094
+ * ```typescript
30095
+ * const nonce = await this.getPermissionsUserNonce();
30096
+ * console.log(`Current permissions nonce: ${nonce}`);
30097
+ * ```
30098
+ */
30099
+ private getPermissionsUserNonce;
30065
30100
  /**
30066
30101
  * Composes the EIP-712 typed data for PermissionGrant (new simplified format).
30067
30102
  *
@@ -30760,19 +30795,51 @@ declare class PermissionsController {
30760
30795
  */
30761
30796
  getPermissions(permissionId: bigint): Promise<PermissionInfo>;
30762
30797
  /**
30763
- * Submit permission with signature to the blockchain
30798
+ * Submit permission with signature to the blockchain (supports gasless transactions)
30764
30799
  *
30765
30800
  * @param params - Parameters for adding permission
30766
30801
  * @returns Promise resolving to transaction hash
30802
+ * @throws {RelayerError} When gasless transaction submission fails
30803
+ * @throws {SignatureError} When user rejects the signature request
30804
+ * @throws {BlockchainError} When permission addition fails
30805
+ * @throws {NetworkError} When network communication fails
30767
30806
  */
30768
30807
  submitAddPermission(params: ServerFilesAndPermissionParams): Promise<Hash>;
30769
30808
  /**
30770
- * Submit server files and permissions with signature to the blockchain
30809
+ * Submits an already-signed add permission transaction to the blockchain.
30810
+ * This method supports both relayer-based gasless transactions and direct transactions.
30811
+ *
30812
+ * @param typedData - The EIP-712 typed data for AddPermission
30813
+ * @param signature - The user's signature
30814
+ * @returns Promise resolving to the transaction hash
30815
+ * @throws {RelayerError} When gasless transaction submission fails
30816
+ * @throws {BlockchainError} When permission addition fails
30817
+ * @throws {NetworkError} When network communication fails
30818
+ */
30819
+ submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30820
+ /**
30821
+ * Submit server files and permissions with signature to the blockchain (supports gasless transactions)
30771
30822
  *
30772
30823
  * @param params - Parameters for adding server files and permissions
30773
30824
  * @returns Promise resolving to transaction hash
30825
+ * @throws {RelayerError} When gasless transaction submission fails
30826
+ * @throws {SignatureError} When user rejects the signature request
30827
+ * @throws {BlockchainError} When server files and permissions addition fails
30828
+ * @throws {NetworkError} When network communication fails
30774
30829
  */
30775
30830
  submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<Hash>;
30831
+ /**
30832
+ * Submits an already-signed add server files and permissions transaction to the blockchain.
30833
+ * This method supports both relayer-based gasless transactions and direct transactions.
30834
+ *
30835
+ * @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
30836
+ * @param signature - The user's signature
30837
+ * @returns Promise resolving to the transaction hash
30838
+ * @throws {RelayerError} When gasless transaction submission fails
30839
+ * @throws {BlockchainError} When server files and permissions addition fails
30840
+ * @throws {NetworkError} When network communication fails
30841
+ */
30842
+ submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<Hash>;
30776
30843
  /**
30777
30844
  * Submit permission revocation with signature to the blockchain
30778
30845
  *
@@ -30780,6 +30847,22 @@ declare class PermissionsController {
30780
30847
  * @returns Promise resolving to transaction hash
30781
30848
  */
30782
30849
  submitRevokePermission(permissionId: bigint): Promise<Hash>;
30850
+ /**
30851
+ * Submits a signed add permission transaction directly to the blockchain.
30852
+ *
30853
+ * @param typedData - The typed data structure for the permission addition
30854
+ * @param signature - The cryptographic signature authorizing the transaction
30855
+ * @returns Promise resolving to the transaction hash
30856
+ */
30857
+ private submitDirectAddPermissionTransaction;
30858
+ /**
30859
+ * Submits a signed add server files and permissions transaction directly to the blockchain.
30860
+ *
30861
+ * @param typedData - The typed data structure for the server files and permissions addition
30862
+ * @param signature - The cryptographic signature authorizing the transaction
30863
+ * @returns Promise resolving to the transaction hash
30864
+ */
30865
+ private submitDirectAddServerFilesAndPermissionsTransaction;
30783
30866
  }
30784
30867
 
30785
30868
  /**
@@ -36388,6 +36471,9 @@ interface RelayerRequestPayload {
36388
36471
  * - PermissionRevoke: Permission revocations
36389
36472
  * - TrustServer: Trust server operations
36390
36473
  * - UntrustServer: Untrust server operations
36474
+ * - AddServer: Add and trust server operations
36475
+ * - RegisterGrantee: Register grantee operations
36476
+ * - ServerFilesAndPermission: Batch operation for server, files, and permissions
36391
36477
  *
36392
36478
  * @param sdk - Initialized Vana SDK instance
36393
36479
  * @param payload - Request payload containing typed data, signature, and optional security check
@@ -634,8 +634,6 @@ interface ServerInfo {
634
634
  * @category Permissions
635
635
  */
636
636
  interface AddAndTrustServerParams {
637
- /** Server owner address */
638
- owner: Address;
639
637
  /** Server address */
640
638
  serverAddress: Address;
641
639
  /** Server URL */
@@ -670,8 +668,6 @@ interface UntrustServerParams {
670
668
  interface AddAndTrustServerInput {
671
669
  /** User nonce */
672
670
  nonce: bigint;
673
- /** Server owner address */
674
- owner: Address;
675
671
  /** Server address */
676
672
  serverAddress: Address;
677
673
  /** Server URL */
@@ -712,13 +708,13 @@ interface AddAndTrustServerTypedData {
712
708
  domain: PermissionGrantDomain;
713
709
  /** EIP-712 types */
714
710
  types: {
715
- AddAndTrustServer: Array<{
711
+ AddServer: Array<{
716
712
  name: string;
717
713
  type: string;
718
714
  }>;
719
715
  };
720
716
  /** Primary type */
721
- primaryType: "AddAndTrustServer";
717
+ primaryType: "AddServer";
722
718
  /** Message to sign */
723
719
  message: AddAndTrustServerInput;
724
720
  }
@@ -1143,6 +1139,22 @@ interface RelayerCallbacks {
1143
1139
  * @returns Promise resolving to the transaction hash
1144
1140
  */
1145
1141
  submitAddAndTrustServer?: (typedData: AddAndTrustServerTypedData, signature: Hash) => Promise<Hash>;
1142
+ /**
1143
+ * Submit a signed permission addition transaction for relay
1144
+ *
1145
+ * @param typedData - The EIP-712 typed data that was signed
1146
+ * @param signature - The user's signature
1147
+ * @returns Promise resolving to the transaction hash
1148
+ */
1149
+ submitAddPermission?: (typedData: GenericTypedData, signature: Hash) => Promise<Hash>;
1150
+ /**
1151
+ * Submit a signed server files and permissions transaction for relay
1152
+ *
1153
+ * @param typedData - The EIP-712 typed data that was signed
1154
+ * @param signature - The user's signature
1155
+ * @returns Promise resolving to the transaction hash
1156
+ */
1157
+ submitAddServerFilesAndPermissions?: (typedData: ServerFilesAndPermissionTypedData, signature: Hash) => Promise<Hash>;
1146
1158
  /**
1147
1159
  * Submit a file addition for relay
1148
1160
  *
@@ -30031,7 +30043,10 @@ declare class PermissionsController {
30031
30043
  */
30032
30044
  submitRevokeWithSignature(params: RevokePermissionParams): Promise<Hash>;
30033
30045
  /**
30046
+ * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
30047
+ *
30034
30048
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
30049
+ * This method is deprecated in favor of more specific nonce methods.
30035
30050
  *
30036
30051
  * The nonce is used to prevent replay attacks in signed transactions and must
30037
30052
  * be incremented with each transaction to maintain security.
@@ -30043,8 +30058,12 @@ declare class PermissionsController {
30043
30058
  * @private
30044
30059
  * @example
30045
30060
  * ```typescript
30061
+ * // Deprecated - use specific methods instead
30046
30062
  * const nonce = await this.getUserNonce();
30047
- * console.log(`Current nonce: ${nonce}`);
30063
+ *
30064
+ * // Use these instead:
30065
+ * const permissionsNonce = await this.getPermissionsUserNonce();
30066
+ * const serversNonce = await this.getServersUserNonce();
30048
30067
  * ```
30049
30068
  */
30050
30069
  private getUserNonce;
@@ -30052,16 +30071,32 @@ declare class PermissionsController {
30052
30071
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
30053
30072
  * This nonce is used for server-related operations (AddAndTrustServer, TrustServer, UntrustServer).
30054
30073
  *
30055
- * @returns Promise resolving to the current nonce
30074
+ * @returns Promise resolving to the current servers nonce
30075
+ * @throws {NonceError} When reading nonce from contract fails
30056
30076
  * @private
30057
30077
  *
30058
30078
  * @example
30059
30079
  * ```typescript
30060
- * const nonce = await this.getServerNonce();
30061
- * console.log(`Current server nonce: ${nonce}`);
30080
+ * const nonce = await this.getServersUserNonce();
30081
+ * console.log(`Current servers nonce: ${nonce}`);
30062
30082
  * ```
30063
30083
  */
30064
- private getServerNonce;
30084
+ private getServersUserNonce;
30085
+ /**
30086
+ * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
30087
+ * This nonce is used for permission-related operations (addPermission, addServerFilesAndPermissions).
30088
+ *
30089
+ * @returns Promise resolving to the current permissions nonce
30090
+ * @throws {NonceError} When reading nonce from contract fails
30091
+ * @private
30092
+ *
30093
+ * @example
30094
+ * ```typescript
30095
+ * const nonce = await this.getPermissionsUserNonce();
30096
+ * console.log(`Current permissions nonce: ${nonce}`);
30097
+ * ```
30098
+ */
30099
+ private getPermissionsUserNonce;
30065
30100
  /**
30066
30101
  * Composes the EIP-712 typed data for PermissionGrant (new simplified format).
30067
30102
  *
@@ -30760,19 +30795,51 @@ declare class PermissionsController {
30760
30795
  */
30761
30796
  getPermissions(permissionId: bigint): Promise<PermissionInfo>;
30762
30797
  /**
30763
- * Submit permission with signature to the blockchain
30798
+ * Submit permission with signature to the blockchain (supports gasless transactions)
30764
30799
  *
30765
30800
  * @param params - Parameters for adding permission
30766
30801
  * @returns Promise resolving to transaction hash
30802
+ * @throws {RelayerError} When gasless transaction submission fails
30803
+ * @throws {SignatureError} When user rejects the signature request
30804
+ * @throws {BlockchainError} When permission addition fails
30805
+ * @throws {NetworkError} When network communication fails
30767
30806
  */
30768
30807
  submitAddPermission(params: ServerFilesAndPermissionParams): Promise<Hash>;
30769
30808
  /**
30770
- * Submit server files and permissions with signature to the blockchain
30809
+ * Submits an already-signed add permission transaction to the blockchain.
30810
+ * This method supports both relayer-based gasless transactions and direct transactions.
30811
+ *
30812
+ * @param typedData - The EIP-712 typed data for AddPermission
30813
+ * @param signature - The user's signature
30814
+ * @returns Promise resolving to the transaction hash
30815
+ * @throws {RelayerError} When gasless transaction submission fails
30816
+ * @throws {BlockchainError} When permission addition fails
30817
+ * @throws {NetworkError} When network communication fails
30818
+ */
30819
+ submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<Hash>;
30820
+ /**
30821
+ * Submit server files and permissions with signature to the blockchain (supports gasless transactions)
30771
30822
  *
30772
30823
  * @param params - Parameters for adding server files and permissions
30773
30824
  * @returns Promise resolving to transaction hash
30825
+ * @throws {RelayerError} When gasless transaction submission fails
30826
+ * @throws {SignatureError} When user rejects the signature request
30827
+ * @throws {BlockchainError} When server files and permissions addition fails
30828
+ * @throws {NetworkError} When network communication fails
30774
30829
  */
30775
30830
  submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<Hash>;
30831
+ /**
30832
+ * Submits an already-signed add server files and permissions transaction to the blockchain.
30833
+ * This method supports both relayer-based gasless transactions and direct transactions.
30834
+ *
30835
+ * @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
30836
+ * @param signature - The user's signature
30837
+ * @returns Promise resolving to the transaction hash
30838
+ * @throws {RelayerError} When gasless transaction submission fails
30839
+ * @throws {BlockchainError} When server files and permissions addition fails
30840
+ * @throws {NetworkError} When network communication fails
30841
+ */
30842
+ submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<Hash>;
30776
30843
  /**
30777
30844
  * Submit permission revocation with signature to the blockchain
30778
30845
  *
@@ -30780,6 +30847,22 @@ declare class PermissionsController {
30780
30847
  * @returns Promise resolving to transaction hash
30781
30848
  */
30782
30849
  submitRevokePermission(permissionId: bigint): Promise<Hash>;
30850
+ /**
30851
+ * Submits a signed add permission transaction directly to the blockchain.
30852
+ *
30853
+ * @param typedData - The typed data structure for the permission addition
30854
+ * @param signature - The cryptographic signature authorizing the transaction
30855
+ * @returns Promise resolving to the transaction hash
30856
+ */
30857
+ private submitDirectAddPermissionTransaction;
30858
+ /**
30859
+ * Submits a signed add server files and permissions transaction directly to the blockchain.
30860
+ *
30861
+ * @param typedData - The typed data structure for the server files and permissions addition
30862
+ * @param signature - The cryptographic signature authorizing the transaction
30863
+ * @returns Promise resolving to the transaction hash
30864
+ */
30865
+ private submitDirectAddServerFilesAndPermissionsTransaction;
30783
30866
  }
30784
30867
 
30785
30868
  /**
@@ -36388,6 +36471,9 @@ interface RelayerRequestPayload {
36388
36471
  * - PermissionRevoke: Permission revocations
36389
36472
  * - TrustServer: Trust server operations
36390
36473
  * - UntrustServer: Untrust server operations
36474
+ * - AddServer: Add and trust server operations
36475
+ * - RegisterGrantee: Register grantee operations
36476
+ * - ServerFilesAndPermission: Batch operation for server, files, and permissions
36391
36477
  *
36392
36478
  * @param sdk - Initialized Vana SDK instance
36393
36479
  * @param payload - Request payload containing typed data, signature, and optional security check