@opendatalabs/vana-sdk 0.1.0-alpha.81526eb → 0.1.0-alpha.82bbb39
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.
- package/dist/chains.browser.cjs +2 -2
- package/dist/chains.browser.cjs.map +1 -1
- package/dist/chains.browser.js +2 -2
- package/dist/chains.browser.js.map +1 -1
- package/dist/chains.cjs +2 -2
- package/dist/chains.cjs.map +1 -1
- package/dist/chains.js +2 -2
- package/dist/chains.js.map +1 -1
- package/dist/chains.node.cjs +2 -2
- package/dist/chains.node.cjs.map +1 -1
- package/dist/chains.node.js +2 -2
- package/dist/chains.node.js.map +1 -1
- package/dist/index.browser.d.ts +187 -26
- package/dist/index.browser.js +224 -57
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +224 -57
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.cts +187 -26
- package/dist/index.node.d.ts +187 -26
- package/dist/index.node.js +224 -57
- package/dist/index.node.js.map +1 -1
- package/package.json +1 -1
package/dist/index.node.d.ts
CHANGED
|
@@ -1284,6 +1284,13 @@ interface BaseConfig {
|
|
|
1284
1284
|
* @example ['https://gateway.pinata.cloud', 'https://ipfs.io']
|
|
1285
1285
|
*/
|
|
1286
1286
|
ipfsGateways?: string[];
|
|
1287
|
+
/**
|
|
1288
|
+
* Default personal server base URL for server operations.
|
|
1289
|
+
* Required for ServerController methods like getIdentity(), createOperation(), etc.
|
|
1290
|
+
*
|
|
1291
|
+
* @example 'https://my-personal-server.example.com'
|
|
1292
|
+
*/
|
|
1293
|
+
defaultPersonalServerUrl?: string;
|
|
1287
1294
|
}
|
|
1288
1295
|
/**
|
|
1289
1296
|
* Base configuration interface that requires storage for storage-dependent operations
|
|
@@ -1312,6 +1319,13 @@ interface BaseConfigWithStorage {
|
|
|
1312
1319
|
* @example ['https://gateway.pinata.cloud', 'https://ipfs.io']
|
|
1313
1320
|
*/
|
|
1314
1321
|
ipfsGateways?: string[];
|
|
1322
|
+
/**
|
|
1323
|
+
* Default personal server base URL for server operations.
|
|
1324
|
+
* Required for ServerController methods like getIdentity(), createOperation(), etc.
|
|
1325
|
+
*
|
|
1326
|
+
* @example 'https://my-personal-server.example.com'
|
|
1327
|
+
*/
|
|
1328
|
+
defaultPersonalServerUrl?: string;
|
|
1315
1329
|
}
|
|
1316
1330
|
/**
|
|
1317
1331
|
* Configuration with wallet client
|
|
@@ -30408,6 +30422,8 @@ interface ControllerContext$1 {
|
|
|
30408
30422
|
hasStorage?: () => boolean;
|
|
30409
30423
|
/** Default IPFS gateways to use for fetching files. */
|
|
30410
30424
|
ipfsGateways?: string[];
|
|
30425
|
+
/** Default personal server base URL for server operations. */
|
|
30426
|
+
defaultPersonalServerUrl?: string;
|
|
30411
30427
|
}
|
|
30412
30428
|
/**
|
|
30413
30429
|
* Manages gasless data access permissions and trusted server registry operations.
|
|
@@ -30705,10 +30721,19 @@ declare class PermissionsController {
|
|
|
30705
30721
|
/**
|
|
30706
30722
|
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
30707
30723
|
*
|
|
30708
|
-
*
|
|
30724
|
+
* The nonce is used to prevent replay attacks in signed transactions and must
|
|
30725
|
+
* be incremented with each transaction to maintain security.
|
|
30726
|
+
*
|
|
30727
|
+
* @returns Promise resolving to the user's current nonce value as a bigint
|
|
30709
30728
|
* @throws {Error} When wallet account is not available
|
|
30710
30729
|
* @throws {Error} When chain ID is not available
|
|
30711
30730
|
* @throws {NonceError} When reading nonce from contract fails
|
|
30731
|
+
* @private
|
|
30732
|
+
* @example
|
|
30733
|
+
* ```typescript
|
|
30734
|
+
* const nonce = await this.getUserNonce();
|
|
30735
|
+
* console.log(`Current nonce: ${nonce}`);
|
|
30736
|
+
* ```
|
|
30712
30737
|
*/
|
|
30713
30738
|
private getUserNonce;
|
|
30714
30739
|
/**
|
|
@@ -30820,23 +30845,37 @@ declare class PermissionsController {
|
|
|
30820
30845
|
*/
|
|
30821
30846
|
private normalizeGrantId;
|
|
30822
30847
|
/**
|
|
30823
|
-
*
|
|
30848
|
+
* Registers a new server and immediately trusts it in the DataPortabilityServers contract.
|
|
30849
|
+
*
|
|
30850
|
+
* This is a combined operation that both registers a new data portability server
|
|
30851
|
+
* and adds it to the user's trusted servers list in a single transaction.
|
|
30852
|
+
* Trusted servers can handle data export and portability requests from the user.
|
|
30824
30853
|
*
|
|
30825
30854
|
* @param params - Parameters for adding and trusting the server
|
|
30855
|
+
* @param params.owner - Ethereum address that will own this server registration
|
|
30856
|
+
* @param params.serverAddress - Ethereum address of the server
|
|
30857
|
+
* @param params.serverUrl - HTTPS URL where the server can be reached
|
|
30858
|
+
* @param params.publicKey - Server's public key for encryption (hex string)
|
|
30826
30859
|
* @returns Promise resolving to transaction hash
|
|
30827
30860
|
* @throws {UserRejectedRequestError} When user rejects the transaction
|
|
30828
30861
|
* @throws {BlockchainError} When chain ID is unavailable or transaction fails
|
|
30862
|
+
* @throws {ServerAlreadyRegisteredError} When server address is already registered
|
|
30829
30863
|
* @throws {Error} When wallet account is not available
|
|
30864
|
+
*
|
|
30830
30865
|
* @example
|
|
30831
30866
|
* ```typescript
|
|
30832
30867
|
* // Add and trust a server by providing all required details
|
|
30833
30868
|
* const txHash = await vana.permissions.addAndTrustServer({
|
|
30834
|
-
* owner: '
|
|
30869
|
+
* owner: '0x1234567890abcdef1234567890abcdef12345678',
|
|
30835
30870
|
* serverAddress: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
|
|
30836
30871
|
* serverUrl: 'https://myserver.example.com',
|
|
30837
|
-
* publicKey: '
|
|
30872
|
+
* publicKey: '0x456789abcdef456789abcdef456789abcdef456789abcdef'
|
|
30838
30873
|
* });
|
|
30839
30874
|
* console.log('Server added and trusted in transaction:', txHash);
|
|
30875
|
+
*
|
|
30876
|
+
* // Verify the server is now trusted
|
|
30877
|
+
* const trustedServers = await vana.permissions.getTrustedServers();
|
|
30878
|
+
* console.log('Now trusting servers:', trustedServers);
|
|
30840
30879
|
* ```
|
|
30841
30880
|
*/
|
|
30842
30881
|
addAndTrustServer(params: AddAndTrustServerParams): Promise<Hash>;
|
|
@@ -30877,15 +30916,32 @@ declare class PermissionsController {
|
|
|
30877
30916
|
*/
|
|
30878
30917
|
private submitDirectUntrustTransaction;
|
|
30879
30918
|
/**
|
|
30880
|
-
*
|
|
30919
|
+
* Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
|
|
30920
|
+
*
|
|
30921
|
+
* This revokes the server's authorization to handle data portability requests for the user.
|
|
30922
|
+
* The server remains registered in the system but will no longer be trusted by this user.
|
|
30881
30923
|
*
|
|
30882
30924
|
* @param params - Parameters for untrusting the server
|
|
30883
|
-
* @param params.serverId - The
|
|
30925
|
+
* @param params.serverId - The numeric ID of the server to untrust
|
|
30884
30926
|
* @returns Promise resolving to transaction hash
|
|
30885
30927
|
* @throws {Error} When wallet account is not available
|
|
30886
30928
|
* @throws {NonceError} When retrieving user nonce fails
|
|
30887
30929
|
* @throws {UserRejectedRequestError} When user rejects the transaction
|
|
30930
|
+
* @throws {ServerNotTrustedError} When the server is not currently trusted
|
|
30888
30931
|
* @throws {BlockchainError} When untrust transaction fails
|
|
30932
|
+
*
|
|
30933
|
+
* @example
|
|
30934
|
+
* ```typescript
|
|
30935
|
+
* // Untrust a specific server
|
|
30936
|
+
* const txHash = await vana.permissions.untrustServer({
|
|
30937
|
+
* serverId: 1
|
|
30938
|
+
* });
|
|
30939
|
+
* console.log('Server untrusted in transaction:', txHash);
|
|
30940
|
+
*
|
|
30941
|
+
* // Verify the server is no longer trusted
|
|
30942
|
+
* const trustedServers = await vana.permissions.getTrustedServers();
|
|
30943
|
+
* console.log('Still trusting servers:', trustedServers);
|
|
30944
|
+
* ```
|
|
30889
30945
|
*/
|
|
30890
30946
|
untrustServer(params: UntrustServerParams): Promise<Hash>;
|
|
30891
30947
|
/**
|
|
@@ -30902,26 +30958,73 @@ declare class PermissionsController {
|
|
|
30902
30958
|
*/
|
|
30903
30959
|
untrustServerWithSignature(params: UntrustServerParams): Promise<Hash>;
|
|
30904
30960
|
/**
|
|
30905
|
-
*
|
|
30961
|
+
* Retrieves all servers trusted by a user from the DataPortabilityServers contract.
|
|
30906
30962
|
*
|
|
30907
|
-
*
|
|
30963
|
+
* Returns an array of server IDs that the specified user has explicitly trusted.
|
|
30964
|
+
* Trusted servers are those that users have authorized to handle their data portability requests.
|
|
30965
|
+
*
|
|
30966
|
+
* @param userAddress - Optional user address to query (defaults to current wallet user)
|
|
30908
30967
|
* @returns Promise resolving to array of trusted server IDs (numeric)
|
|
30909
30968
|
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
30969
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
30970
|
+
*
|
|
30971
|
+
* @example
|
|
30972
|
+
* ```typescript
|
|
30973
|
+
* // Get trusted servers for current user
|
|
30974
|
+
* const myServers = await vana.permissions.getTrustedServers();
|
|
30975
|
+
* console.log(`I trust ${myServers.length} servers: ${myServers.join(', ')}`);
|
|
30976
|
+
*
|
|
30977
|
+
* // Get trusted servers for another user
|
|
30978
|
+
* const userServers = await vana.permissions.getTrustedServers("0x1234...");
|
|
30979
|
+
* console.log(`User trusts servers: ${userServers.join(', ')}`);
|
|
30980
|
+
* ```
|
|
30910
30981
|
*/
|
|
30911
30982
|
getTrustedServers(userAddress?: Address): Promise<number[]>;
|
|
30912
30983
|
/**
|
|
30913
|
-
*
|
|
30984
|
+
* Retrieves detailed information about a specific server from the DataPortabilityServers contract.
|
|
30914
30985
|
*
|
|
30915
|
-
*
|
|
30916
|
-
*
|
|
30986
|
+
* Returns complete server information including owner, address, public key, and URL.
|
|
30987
|
+
* This information is used to establish secure connections and verify server identity.
|
|
30988
|
+
*
|
|
30989
|
+
* @param serverId - The unique numeric ID of the server to query
|
|
30990
|
+
* @returns Promise resolving to complete server information
|
|
30917
30991
|
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
30992
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
30993
|
+
* @throws {ServerNotFoundError} When the server ID does not exist
|
|
30994
|
+
*
|
|
30995
|
+
* @example
|
|
30996
|
+
* ```typescript
|
|
30997
|
+
* const server = await vana.permissions.getServerInfo(1);
|
|
30998
|
+
*
|
|
30999
|
+
* console.log(`Server ${server.id}:`);
|
|
31000
|
+
* console.log(` Owner: ${server.owner}`);
|
|
31001
|
+
* console.log(` Address: ${server.serverAddress}`);
|
|
31002
|
+
* console.log(` URL: ${server.url}`);
|
|
31003
|
+
* console.log(` Public Key: ${server.publicKey}`);
|
|
31004
|
+
* ```
|
|
30918
31005
|
*/
|
|
30919
31006
|
getServerInfo(serverId: number): Promise<Server>;
|
|
30920
31007
|
/**
|
|
30921
|
-
* Checks if a server is active.
|
|
31008
|
+
* Checks if a specific server is active in the DataPortabilityServers contract.
|
|
30922
31009
|
*
|
|
30923
|
-
*
|
|
30924
|
-
*
|
|
31010
|
+
* An active server is one that is properly registered and operational, meaning
|
|
31011
|
+
* it can receive and process data portability requests from users.
|
|
31012
|
+
*
|
|
31013
|
+
* @param serverId - The unique numeric ID of the server to check
|
|
31014
|
+
* @returns Promise resolving to true if server is active, false otherwise
|
|
31015
|
+
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
31016
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
31017
|
+
*
|
|
31018
|
+
* @example
|
|
31019
|
+
* ```typescript
|
|
31020
|
+
* const isActive = await vana.permissions.isActiveServer(1);
|
|
31021
|
+
*
|
|
31022
|
+
* if (isActive) {
|
|
31023
|
+
* console.log('Server 1 is active and ready to process requests');
|
|
31024
|
+
* } else {
|
|
31025
|
+
* console.log('Server 1 is inactive or not found');
|
|
31026
|
+
* }
|
|
31027
|
+
* ```
|
|
30925
31028
|
*/
|
|
30926
31029
|
isActiveServer(serverId: number): Promise<boolean>;
|
|
30927
31030
|
/**
|
|
@@ -31032,10 +31135,19 @@ declare class PermissionsController {
|
|
|
31032
31135
|
*/
|
|
31033
31136
|
private submitSignedUntrustTransaction;
|
|
31034
31137
|
/**
|
|
31035
|
-
* Registers a new grantee
|
|
31138
|
+
* Registers a new grantee in the DataPortabilityGrantees contract.
|
|
31139
|
+
*
|
|
31140
|
+
* A grantee is an entity (like an application) that can receive data permissions
|
|
31141
|
+
* from users. Once registered, users can grant the grantee access to their data.
|
|
31036
31142
|
*
|
|
31037
31143
|
* @param params - Parameters for registering the grantee
|
|
31144
|
+
* @param params.owner - The Ethereum address that will own this grantee registration
|
|
31145
|
+
* @param params.granteeAddress - The Ethereum address of the grantee (application)
|
|
31146
|
+
* @param params.publicKey - The public key used for data encryption/decryption (hex string)
|
|
31038
31147
|
* @returns Promise resolving to the transaction hash
|
|
31148
|
+
* @throws {BlockchainError} When the grantee registration transaction fails
|
|
31149
|
+
* @throws {UserRejectedRequestError} When user rejects the transaction
|
|
31150
|
+
* @throws {ContractError} When grantee is already registered
|
|
31039
31151
|
*
|
|
31040
31152
|
* @example
|
|
31041
31153
|
* ```typescript
|
|
@@ -31044,6 +31156,7 @@ declare class PermissionsController {
|
|
|
31044
31156
|
* granteeAddress: "0xApp1234567890123456789012345678901234567890",
|
|
31045
31157
|
* publicKey: "0x1234567890abcdef..."
|
|
31046
31158
|
* });
|
|
31159
|
+
* console.log(`Grantee registered in transaction: ${txHash}`);
|
|
31047
31160
|
* ```
|
|
31048
31161
|
*/
|
|
31049
31162
|
registerGrantee(params: RegisterGranteeParams): Promise<Hash>;
|
|
@@ -31077,41 +31190,88 @@ declare class PermissionsController {
|
|
|
31077
31190
|
*/
|
|
31078
31191
|
submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<Hash>;
|
|
31079
31192
|
/**
|
|
31080
|
-
*
|
|
31193
|
+
* Retrieves all registered grantees from the DataPortabilityGrantees contract.
|
|
31081
31194
|
*
|
|
31082
|
-
*
|
|
31083
|
-
*
|
|
31195
|
+
* Returns a paginated list of all grantees (applications) that have been registered
|
|
31196
|
+
* in the system and can receive data permissions from users.
|
|
31197
|
+
*
|
|
31198
|
+
* @param options - Query options for pagination and filtering
|
|
31199
|
+
* @param options.limit - Maximum number of grantees to return (default: 50)
|
|
31200
|
+
* @param options.offset - Number of grantees to skip for pagination (default: 0)
|
|
31201
|
+
* @returns Promise resolving to paginated grantees with metadata
|
|
31202
|
+
* @throws {BlockchainError} When contract read operation fails
|
|
31203
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
31084
31204
|
*
|
|
31085
31205
|
* @example
|
|
31086
31206
|
* ```typescript
|
|
31207
|
+
* // Get first 10 grantees
|
|
31087
31208
|
* const result = await vana.permissions.getGrantees({
|
|
31088
31209
|
* limit: 10,
|
|
31089
31210
|
* offset: 0
|
|
31090
31211
|
* });
|
|
31212
|
+
*
|
|
31213
|
+
* console.log(`Found ${result.total} total grantees`);
|
|
31214
|
+
* result.grantees.forEach(grantee => {
|
|
31215
|
+
* console.log(`Grantee ${grantee.id}: ${grantee.granteeAddress}`);
|
|
31216
|
+
* });
|
|
31217
|
+
*
|
|
31218
|
+
* // Check if there are more results
|
|
31219
|
+
* if (result.hasMore) {
|
|
31220
|
+
* console.log('More grantees available');
|
|
31221
|
+
* }
|
|
31091
31222
|
* ```
|
|
31092
31223
|
*/
|
|
31093
31224
|
getGrantees(options?: GranteeQueryOptions): Promise<PaginatedGrantees>;
|
|
31094
31225
|
/**
|
|
31095
|
-
*
|
|
31226
|
+
* Retrieves a specific grantee by their Ethereum address from the DataPortabilityGrantees contract.
|
|
31096
31227
|
*
|
|
31097
|
-
*
|
|
31098
|
-
*
|
|
31228
|
+
* Looks up a registered grantee (application) using their Ethereum address
|
|
31229
|
+
* and returns their complete registration information including permissions.
|
|
31230
|
+
*
|
|
31231
|
+
* @param granteeAddress - The Ethereum address of the grantee to look up
|
|
31232
|
+
* @returns Promise resolving to the grantee information, or null if not found
|
|
31233
|
+
* @throws {BlockchainError} When contract read operation fails
|
|
31234
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
31099
31235
|
*
|
|
31100
31236
|
* @example
|
|
31101
31237
|
* ```typescript
|
|
31102
|
-
* const
|
|
31238
|
+
* const granteeAddress = "0xApp1234567890123456789012345678901234567890";
|
|
31239
|
+
* const grantee = await vana.permissions.getGranteeByAddress(granteeAddress);
|
|
31240
|
+
*
|
|
31241
|
+
* if (grantee) {
|
|
31242
|
+
* console.log(`Found grantee ${grantee.id}`);
|
|
31243
|
+
* console.log(`Owner: ${grantee.owner}`);
|
|
31244
|
+
* console.log(`Public Key: ${grantee.publicKey}`);
|
|
31245
|
+
* console.log(`Permissions: ${grantee.permissionIds.join(', ')}`);
|
|
31246
|
+
* } else {
|
|
31247
|
+
* console.log('Grantee not found');
|
|
31248
|
+
* }
|
|
31103
31249
|
* ```
|
|
31104
31250
|
*/
|
|
31105
31251
|
getGranteeByAddress(granteeAddress: Address): Promise<Grantee | null>;
|
|
31106
31252
|
/**
|
|
31107
|
-
*
|
|
31253
|
+
* Retrieves a specific grantee by their unique ID from the DataPortabilityGrantees contract.
|
|
31254
|
+
*
|
|
31255
|
+
* Looks up a registered grantee (application) using their numeric ID assigned during
|
|
31256
|
+
* registration and returns their complete information including permissions.
|
|
31108
31257
|
*
|
|
31109
|
-
* @param granteeId - The grantee
|
|
31110
|
-
* @returns Promise resolving to the grantee
|
|
31258
|
+
* @param granteeId - The unique numeric ID of the grantee (1-indexed)
|
|
31259
|
+
* @returns Promise resolving to the grantee information, or null if not found
|
|
31260
|
+
* @throws {BlockchainError} When contract read operation fails
|
|
31261
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
31111
31262
|
*
|
|
31112
31263
|
* @example
|
|
31113
31264
|
* ```typescript
|
|
31114
31265
|
* const grantee = await vana.permissions.getGranteeById(1);
|
|
31266
|
+
*
|
|
31267
|
+
* if (grantee) {
|
|
31268
|
+
* console.log(`Grantee ID: ${grantee.id}`);
|
|
31269
|
+
* console.log(`Address: ${grantee.granteeAddress}`);
|
|
31270
|
+
* console.log(`Owner: ${grantee.owner}`);
|
|
31271
|
+
* console.log(`Total permissions: ${grantee.permissionIds.length}`);
|
|
31272
|
+
* } else {
|
|
31273
|
+
* console.log('Grantee with ID 1 not found');
|
|
31274
|
+
* }
|
|
31115
31275
|
* ```
|
|
31116
31276
|
*/
|
|
31117
31277
|
getGranteeById(granteeId: number): Promise<Grantee | null>;
|
|
@@ -34592,8 +34752,8 @@ declare class DataController {
|
|
|
34592
34752
|
*/
|
|
34593
34753
|
declare class ServerController {
|
|
34594
34754
|
private readonly context;
|
|
34595
|
-
readonly PERSONAL_SERVER_BASE_URL: string | undefined;
|
|
34596
34755
|
constructor(context: ControllerContext$1);
|
|
34756
|
+
private get personalServerBaseUrl();
|
|
34597
34757
|
/**
|
|
34598
34758
|
* Retrieves the cryptographic identity of a personal server.
|
|
34599
34759
|
*
|
|
@@ -35064,6 +35224,7 @@ declare class VanaCore {
|
|
|
35064
35224
|
private readonly storageManager?;
|
|
35065
35225
|
private readonly hasRequiredStorage;
|
|
35066
35226
|
private readonly ipfsGateways?;
|
|
35227
|
+
private readonly defaultPersonalServerUrl?;
|
|
35067
35228
|
/**
|
|
35068
35229
|
* Initializes a new VanaCore client instance with the provided configuration.
|
|
35069
35230
|
*
|