@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.browser.js
CHANGED
|
@@ -36557,10 +36557,19 @@ var PermissionsController = class {
|
|
|
36557
36557
|
/**
|
|
36558
36558
|
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
36559
36559
|
*
|
|
36560
|
-
*
|
|
36560
|
+
* The nonce is used to prevent replay attacks in signed transactions and must
|
|
36561
|
+
* be incremented with each transaction to maintain security.
|
|
36562
|
+
*
|
|
36563
|
+
* @returns Promise resolving to the user's current nonce value as a bigint
|
|
36561
36564
|
* @throws {Error} When wallet account is not available
|
|
36562
36565
|
* @throws {Error} When chain ID is not available
|
|
36563
36566
|
* @throws {NonceError} When reading nonce from contract fails
|
|
36567
|
+
* @private
|
|
36568
|
+
* @example
|
|
36569
|
+
* ```typescript
|
|
36570
|
+
* const nonce = await this.getUserNonce();
|
|
36571
|
+
* console.log(`Current nonce: ${nonce}`);
|
|
36572
|
+
* ```
|
|
36564
36573
|
*/
|
|
36565
36574
|
async getUserNonce() {
|
|
36566
36575
|
try {
|
|
@@ -36755,9 +36764,15 @@ var PermissionsController = class {
|
|
|
36755
36764
|
grant
|
|
36756
36765
|
nonce
|
|
36757
36766
|
signature
|
|
36767
|
+
startBlock
|
|
36768
|
+
endBlock
|
|
36758
36769
|
addedAtBlock
|
|
36759
36770
|
addedAtTimestamp
|
|
36760
36771
|
transactionHash
|
|
36772
|
+
grantee {
|
|
36773
|
+
id
|
|
36774
|
+
address
|
|
36775
|
+
}
|
|
36761
36776
|
}
|
|
36762
36777
|
}
|
|
36763
36778
|
}
|
|
@@ -36792,15 +36807,16 @@ var PermissionsController = class {
|
|
|
36792
36807
|
const onChainGrants = userData.permissions.slice(0, limit).map((permission) => ({
|
|
36793
36808
|
id: BigInt(permission.id),
|
|
36794
36809
|
grantUrl: permission.grant,
|
|
36795
|
-
grantSignature: permission.
|
|
36796
|
-
grantHash:
|
|
36810
|
+
grantSignature: permission.signature,
|
|
36811
|
+
grantHash: "",
|
|
36812
|
+
// Not available in new schema, compute if needed
|
|
36797
36813
|
nonce: BigInt(permission.nonce),
|
|
36798
36814
|
addedAtBlock: BigInt(permission.addedAtBlock),
|
|
36799
36815
|
addedAtTimestamp: BigInt(permission.addedAtTimestamp || "0"),
|
|
36800
36816
|
transactionHash: permission.transactionHash || "",
|
|
36801
36817
|
grantor: userAddress,
|
|
36802
|
-
active:
|
|
36803
|
-
//
|
|
36818
|
+
active: !permission.endBlock || BigInt(permission.endBlock) === 0n
|
|
36819
|
+
// Active if no end block or end block is 0
|
|
36804
36820
|
}));
|
|
36805
36821
|
return onChainGrants.sort((a, b) => {
|
|
36806
36822
|
if (a.id < b.id) return 1;
|
|
@@ -36953,23 +36969,37 @@ var PermissionsController = class {
|
|
|
36953
36969
|
}
|
|
36954
36970
|
}
|
|
36955
36971
|
/**
|
|
36956
|
-
*
|
|
36972
|
+
* Registers a new server and immediately trusts it in the DataPortabilityServers contract.
|
|
36973
|
+
*
|
|
36974
|
+
* This is a combined operation that both registers a new data portability server
|
|
36975
|
+
* and adds it to the user's trusted servers list in a single transaction.
|
|
36976
|
+
* Trusted servers can handle data export and portability requests from the user.
|
|
36957
36977
|
*
|
|
36958
36978
|
* @param params - Parameters for adding and trusting the server
|
|
36979
|
+
* @param params.owner - Ethereum address that will own this server registration
|
|
36980
|
+
* @param params.serverAddress - Ethereum address of the server
|
|
36981
|
+
* @param params.serverUrl - HTTPS URL where the server can be reached
|
|
36982
|
+
* @param params.publicKey - Server's public key for encryption (hex string)
|
|
36959
36983
|
* @returns Promise resolving to transaction hash
|
|
36960
36984
|
* @throws {UserRejectedRequestError} When user rejects the transaction
|
|
36961
36985
|
* @throws {BlockchainError} When chain ID is unavailable or transaction fails
|
|
36986
|
+
* @throws {ServerAlreadyRegisteredError} When server address is already registered
|
|
36962
36987
|
* @throws {Error} When wallet account is not available
|
|
36988
|
+
*
|
|
36963
36989
|
* @example
|
|
36964
36990
|
* ```typescript
|
|
36965
36991
|
* // Add and trust a server by providing all required details
|
|
36966
36992
|
* const txHash = await vana.permissions.addAndTrustServer({
|
|
36967
|
-
* owner: '
|
|
36993
|
+
* owner: '0x1234567890abcdef1234567890abcdef12345678',
|
|
36968
36994
|
* serverAddress: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
|
|
36969
36995
|
* serverUrl: 'https://myserver.example.com',
|
|
36970
|
-
* publicKey: '
|
|
36996
|
+
* publicKey: '0x456789abcdef456789abcdef456789abcdef456789abcdef'
|
|
36971
36997
|
* });
|
|
36972
36998
|
* console.log('Server added and trusted in transaction:', txHash);
|
|
36999
|
+
*
|
|
37000
|
+
* // Verify the server is now trusted
|
|
37001
|
+
* const trustedServers = await vana.permissions.getTrustedServers();
|
|
37002
|
+
* console.log('Now trusting servers:', trustedServers);
|
|
36973
37003
|
* ```
|
|
36974
37004
|
*/
|
|
36975
37005
|
async addAndTrustServer(params) {
|
|
@@ -37163,15 +37193,32 @@ var PermissionsController = class {
|
|
|
37163
37193
|
}
|
|
37164
37194
|
}
|
|
37165
37195
|
/**
|
|
37166
|
-
*
|
|
37196
|
+
* Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
|
|
37197
|
+
*
|
|
37198
|
+
* This revokes the server's authorization to handle data portability requests for the user.
|
|
37199
|
+
* The server remains registered in the system but will no longer be trusted by this user.
|
|
37167
37200
|
*
|
|
37168
37201
|
* @param params - Parameters for untrusting the server
|
|
37169
|
-
* @param params.serverId - The
|
|
37202
|
+
* @param params.serverId - The numeric ID of the server to untrust
|
|
37170
37203
|
* @returns Promise resolving to transaction hash
|
|
37171
37204
|
* @throws {Error} When wallet account is not available
|
|
37172
37205
|
* @throws {NonceError} When retrieving user nonce fails
|
|
37173
37206
|
* @throws {UserRejectedRequestError} When user rejects the transaction
|
|
37207
|
+
* @throws {ServerNotTrustedError} When the server is not currently trusted
|
|
37174
37208
|
* @throws {BlockchainError} When untrust transaction fails
|
|
37209
|
+
*
|
|
37210
|
+
* @example
|
|
37211
|
+
* ```typescript
|
|
37212
|
+
* // Untrust a specific server
|
|
37213
|
+
* const txHash = await vana.permissions.untrustServer({
|
|
37214
|
+
* serverId: 1
|
|
37215
|
+
* });
|
|
37216
|
+
* console.log('Server untrusted in transaction:', txHash);
|
|
37217
|
+
*
|
|
37218
|
+
* // Verify the server is no longer trusted
|
|
37219
|
+
* const trustedServers = await vana.permissions.getTrustedServers();
|
|
37220
|
+
* console.log('Still trusting servers:', trustedServers);
|
|
37221
|
+
* ```
|
|
37175
37222
|
*/
|
|
37176
37223
|
async untrustServer(params) {
|
|
37177
37224
|
const nonce = await this.getUserNonce();
|
|
@@ -37229,11 +37276,26 @@ var PermissionsController = class {
|
|
|
37229
37276
|
}
|
|
37230
37277
|
}
|
|
37231
37278
|
/**
|
|
37232
|
-
*
|
|
37279
|
+
* Retrieves all servers trusted by a user from the DataPortabilityServers contract.
|
|
37233
37280
|
*
|
|
37234
|
-
*
|
|
37281
|
+
* Returns an array of server IDs that the specified user has explicitly trusted.
|
|
37282
|
+
* Trusted servers are those that users have authorized to handle their data portability requests.
|
|
37283
|
+
*
|
|
37284
|
+
* @param userAddress - Optional user address to query (defaults to current wallet user)
|
|
37235
37285
|
* @returns Promise resolving to array of trusted server IDs (numeric)
|
|
37236
37286
|
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
37287
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
37288
|
+
*
|
|
37289
|
+
* @example
|
|
37290
|
+
* ```typescript
|
|
37291
|
+
* // Get trusted servers for current user
|
|
37292
|
+
* const myServers = await vana.permissions.getTrustedServers();
|
|
37293
|
+
* console.log(`I trust ${myServers.length} servers: ${myServers.join(', ')}`);
|
|
37294
|
+
*
|
|
37295
|
+
* // Get trusted servers for another user
|
|
37296
|
+
* const userServers = await vana.permissions.getTrustedServers("0x1234...");
|
|
37297
|
+
* console.log(`User trusts servers: ${userServers.join(', ')}`);
|
|
37298
|
+
* ```
|
|
37237
37299
|
*/
|
|
37238
37300
|
async getTrustedServers(userAddress) {
|
|
37239
37301
|
try {
|
|
@@ -37259,11 +37321,27 @@ var PermissionsController = class {
|
|
|
37259
37321
|
}
|
|
37260
37322
|
}
|
|
37261
37323
|
/**
|
|
37262
|
-
*
|
|
37324
|
+
* Retrieves detailed information about a specific server from the DataPortabilityServers contract.
|
|
37263
37325
|
*
|
|
37264
|
-
*
|
|
37265
|
-
*
|
|
37326
|
+
* Returns complete server information including owner, address, public key, and URL.
|
|
37327
|
+
* This information is used to establish secure connections and verify server identity.
|
|
37328
|
+
*
|
|
37329
|
+
* @param serverId - The unique numeric ID of the server to query
|
|
37330
|
+
* @returns Promise resolving to complete server information
|
|
37266
37331
|
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
37332
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
37333
|
+
* @throws {ServerNotFoundError} When the server ID does not exist
|
|
37334
|
+
*
|
|
37335
|
+
* @example
|
|
37336
|
+
* ```typescript
|
|
37337
|
+
* const server = await vana.permissions.getServerInfo(1);
|
|
37338
|
+
*
|
|
37339
|
+
* console.log(`Server ${server.id}:`);
|
|
37340
|
+
* console.log(` Owner: ${server.owner}`);
|
|
37341
|
+
* console.log(` Address: ${server.serverAddress}`);
|
|
37342
|
+
* console.log(` URL: ${server.url}`);
|
|
37343
|
+
* console.log(` Public Key: ${server.publicKey}`);
|
|
37344
|
+
* ```
|
|
37267
37345
|
*/
|
|
37268
37346
|
async getServerInfo(serverId) {
|
|
37269
37347
|
try {
|
|
@@ -37294,10 +37372,26 @@ var PermissionsController = class {
|
|
|
37294
37372
|
}
|
|
37295
37373
|
}
|
|
37296
37374
|
/**
|
|
37297
|
-
* Checks if a server is active.
|
|
37375
|
+
* Checks if a specific server is active in the DataPortabilityServers contract.
|
|
37298
37376
|
*
|
|
37299
|
-
*
|
|
37300
|
-
*
|
|
37377
|
+
* An active server is one that is properly registered and operational, meaning
|
|
37378
|
+
* it can receive and process data portability requests from users.
|
|
37379
|
+
*
|
|
37380
|
+
* @param serverId - The unique numeric ID of the server to check
|
|
37381
|
+
* @returns Promise resolving to true if server is active, false otherwise
|
|
37382
|
+
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
37383
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
37384
|
+
*
|
|
37385
|
+
* @example
|
|
37386
|
+
* ```typescript
|
|
37387
|
+
* const isActive = await vana.permissions.isActiveServer(1);
|
|
37388
|
+
*
|
|
37389
|
+
* if (isActive) {
|
|
37390
|
+
* console.log('Server 1 is active and ready to process requests');
|
|
37391
|
+
* } else {
|
|
37392
|
+
* console.log('Server 1 is inactive or not found');
|
|
37393
|
+
* }
|
|
37394
|
+
* ```
|
|
37301
37395
|
*/
|
|
37302
37396
|
async isActiveServer(serverId) {
|
|
37303
37397
|
try {
|
|
@@ -37769,10 +37863,19 @@ var PermissionsController = class {
|
|
|
37769
37863
|
// GRANTEE METHODS
|
|
37770
37864
|
// ===========================
|
|
37771
37865
|
/**
|
|
37772
|
-
* Registers a new grantee
|
|
37866
|
+
* Registers a new grantee in the DataPortabilityGrantees contract.
|
|
37867
|
+
*
|
|
37868
|
+
* A grantee is an entity (like an application) that can receive data permissions
|
|
37869
|
+
* from users. Once registered, users can grant the grantee access to their data.
|
|
37773
37870
|
*
|
|
37774
37871
|
* @param params - Parameters for registering the grantee
|
|
37872
|
+
* @param params.owner - The Ethereum address that will own this grantee registration
|
|
37873
|
+
* @param params.granteeAddress - The Ethereum address of the grantee (application)
|
|
37874
|
+
* @param params.publicKey - The public key used for data encryption/decryption (hex string)
|
|
37775
37875
|
* @returns Promise resolving to the transaction hash
|
|
37876
|
+
* @throws {BlockchainError} When the grantee registration transaction fails
|
|
37877
|
+
* @throws {UserRejectedRequestError} When user rejects the transaction
|
|
37878
|
+
* @throws {ContractError} When grantee is already registered
|
|
37776
37879
|
*
|
|
37777
37880
|
* @example
|
|
37778
37881
|
* ```typescript
|
|
@@ -37781,6 +37884,7 @@ var PermissionsController = class {
|
|
|
37781
37884
|
* granteeAddress: "0xApp1234567890123456789012345678901234567890",
|
|
37782
37885
|
* publicKey: "0x1234567890abcdef..."
|
|
37783
37886
|
* });
|
|
37887
|
+
* console.log(`Grantee registered in transaction: ${txHash}`);
|
|
37784
37888
|
* ```
|
|
37785
37889
|
*/
|
|
37786
37890
|
async registerGrantee(params) {
|
|
@@ -37843,17 +37947,35 @@ var PermissionsController = class {
|
|
|
37843
37947
|
return this.submitSignedRegisterGranteeTransaction(typedData, signature);
|
|
37844
37948
|
}
|
|
37845
37949
|
/**
|
|
37846
|
-
*
|
|
37950
|
+
* Retrieves all registered grantees from the DataPortabilityGrantees contract.
|
|
37847
37951
|
*
|
|
37848
|
-
*
|
|
37849
|
-
*
|
|
37952
|
+
* Returns a paginated list of all grantees (applications) that have been registered
|
|
37953
|
+
* in the system and can receive data permissions from users.
|
|
37954
|
+
*
|
|
37955
|
+
* @param options - Query options for pagination and filtering
|
|
37956
|
+
* @param options.limit - Maximum number of grantees to return (default: 50)
|
|
37957
|
+
* @param options.offset - Number of grantees to skip for pagination (default: 0)
|
|
37958
|
+
* @returns Promise resolving to paginated grantees with metadata
|
|
37959
|
+
* @throws {BlockchainError} When contract read operation fails
|
|
37960
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
37850
37961
|
*
|
|
37851
37962
|
* @example
|
|
37852
37963
|
* ```typescript
|
|
37964
|
+
* // Get first 10 grantees
|
|
37853
37965
|
* const result = await vana.permissions.getGrantees({
|
|
37854
37966
|
* limit: 10,
|
|
37855
37967
|
* offset: 0
|
|
37856
37968
|
* });
|
|
37969
|
+
*
|
|
37970
|
+
* console.log(`Found ${result.total} total grantees`);
|
|
37971
|
+
* result.grantees.forEach(grantee => {
|
|
37972
|
+
* console.log(`Grantee ${grantee.id}: ${grantee.granteeAddress}`);
|
|
37973
|
+
* });
|
|
37974
|
+
*
|
|
37975
|
+
* // Check if there are more results
|
|
37976
|
+
* if (result.hasMore) {
|
|
37977
|
+
* console.log('More grantees available');
|
|
37978
|
+
* }
|
|
37857
37979
|
* ```
|
|
37858
37980
|
*/
|
|
37859
37981
|
async getGrantees(options = {}) {
|
|
@@ -37902,14 +38024,29 @@ var PermissionsController = class {
|
|
|
37902
38024
|
};
|
|
37903
38025
|
}
|
|
37904
38026
|
/**
|
|
37905
|
-
*
|
|
38027
|
+
* Retrieves a specific grantee by their Ethereum address from the DataPortabilityGrantees contract.
|
|
38028
|
+
*
|
|
38029
|
+
* Looks up a registered grantee (application) using their Ethereum address
|
|
38030
|
+
* and returns their complete registration information including permissions.
|
|
37906
38031
|
*
|
|
37907
|
-
* @param granteeAddress - The grantee
|
|
37908
|
-
* @returns Promise resolving to the grantee
|
|
38032
|
+
* @param granteeAddress - The Ethereum address of the grantee to look up
|
|
38033
|
+
* @returns Promise resolving to the grantee information, or null if not found
|
|
38034
|
+
* @throws {BlockchainError} When contract read operation fails
|
|
38035
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
37909
38036
|
*
|
|
37910
38037
|
* @example
|
|
37911
38038
|
* ```typescript
|
|
37912
|
-
* const
|
|
38039
|
+
* const granteeAddress = "0xApp1234567890123456789012345678901234567890";
|
|
38040
|
+
* const grantee = await vana.permissions.getGranteeByAddress(granteeAddress);
|
|
38041
|
+
*
|
|
38042
|
+
* if (grantee) {
|
|
38043
|
+
* console.log(`Found grantee ${grantee.id}`);
|
|
38044
|
+
* console.log(`Owner: ${grantee.owner}`);
|
|
38045
|
+
* console.log(`Public Key: ${grantee.publicKey}`);
|
|
38046
|
+
* console.log(`Permissions: ${grantee.permissionIds.join(', ')}`);
|
|
38047
|
+
* } else {
|
|
38048
|
+
* console.log('Grantee not found');
|
|
38049
|
+
* }
|
|
37913
38050
|
* ```
|
|
37914
38051
|
*/
|
|
37915
38052
|
async getGranteeByAddress(granteeAddress) {
|
|
@@ -37945,14 +38082,28 @@ var PermissionsController = class {
|
|
|
37945
38082
|
}
|
|
37946
38083
|
}
|
|
37947
38084
|
/**
|
|
37948
|
-
*
|
|
38085
|
+
* Retrieves a specific grantee by their unique ID from the DataPortabilityGrantees contract.
|
|
38086
|
+
*
|
|
38087
|
+
* Looks up a registered grantee (application) using their numeric ID assigned during
|
|
38088
|
+
* registration and returns their complete information including permissions.
|
|
37949
38089
|
*
|
|
37950
|
-
* @param granteeId - The grantee
|
|
37951
|
-
* @returns Promise resolving to the grantee
|
|
38090
|
+
* @param granteeId - The unique numeric ID of the grantee (1-indexed)
|
|
38091
|
+
* @returns Promise resolving to the grantee information, or null if not found
|
|
38092
|
+
* @throws {BlockchainError} When contract read operation fails
|
|
38093
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
37952
38094
|
*
|
|
37953
38095
|
* @example
|
|
37954
38096
|
* ```typescript
|
|
37955
38097
|
* const grantee = await vana.permissions.getGranteeById(1);
|
|
38098
|
+
*
|
|
38099
|
+
* if (grantee) {
|
|
38100
|
+
* console.log(`Grantee ID: ${grantee.id}`);
|
|
38101
|
+
* console.log(`Address: ${grantee.granteeAddress}`);
|
|
38102
|
+
* console.log(`Owner: ${grantee.owner}`);
|
|
38103
|
+
* console.log(`Total permissions: ${grantee.permissionIds.length}`);
|
|
38104
|
+
* } else {
|
|
38105
|
+
* console.log('Grantee with ID 1 not found');
|
|
38106
|
+
* }
|
|
37956
38107
|
* ```
|
|
37957
38108
|
*/
|
|
37958
38109
|
async getGranteeById(granteeId) {
|
|
@@ -38807,11 +38958,18 @@ var DataController = class {
|
|
|
38807
38958
|
query GetUserTrustedServers($userId: ID!) {
|
|
38808
38959
|
user(id: $userId) {
|
|
38809
38960
|
id
|
|
38810
|
-
|
|
38961
|
+
serverTrusts {
|
|
38811
38962
|
id
|
|
38812
|
-
|
|
38813
|
-
|
|
38963
|
+
server {
|
|
38964
|
+
id
|
|
38965
|
+
serverAddress
|
|
38966
|
+
url
|
|
38967
|
+
publicKey
|
|
38968
|
+
}
|
|
38814
38969
|
trustedAt
|
|
38970
|
+
trustedAtBlock
|
|
38971
|
+
untrustedAtBlock
|
|
38972
|
+
transactionHash
|
|
38815
38973
|
}
|
|
38816
38974
|
}
|
|
38817
38975
|
}
|
|
@@ -38843,12 +39001,14 @@ var DataController = class {
|
|
|
38843
39001
|
if (!result.data?.user) {
|
|
38844
39002
|
return [];
|
|
38845
39003
|
}
|
|
38846
|
-
return (result.data.user.
|
|
38847
|
-
id: server.id,
|
|
38848
|
-
serverAddress: server.serverAddress,
|
|
38849
|
-
serverUrl: server.
|
|
38850
|
-
trustedAt: BigInt(
|
|
38851
|
-
user
|
|
39004
|
+
return (result.data.user.serverTrusts || []).filter((trust) => !trust.untrustedAtBlock).map((trust) => ({
|
|
39005
|
+
id: trust.server.id,
|
|
39006
|
+
serverAddress: trust.server.serverAddress,
|
|
39007
|
+
serverUrl: trust.server.url,
|
|
39008
|
+
trustedAt: BigInt(trust.trustedAt),
|
|
39009
|
+
user,
|
|
39010
|
+
name: ""
|
|
39011
|
+
// Not available in new schema, will be empty
|
|
38852
39012
|
}));
|
|
38853
39013
|
} catch (error) {
|
|
38854
39014
|
console.error("Failed to query trusted servers from subgraph:", error);
|
|
@@ -40674,7 +40834,14 @@ var SchemaController = class {
|
|
|
40674
40834
|
var ServerController = class {
|
|
40675
40835
|
constructor(context) {
|
|
40676
40836
|
this.context = context;
|
|
40677
|
-
|
|
40837
|
+
}
|
|
40838
|
+
get personalServerBaseUrl() {
|
|
40839
|
+
if (!this.context.defaultPersonalServerUrl) {
|
|
40840
|
+
throw new PersonalServerError(
|
|
40841
|
+
"Personal server URL is required for server operations. Please configure defaultPersonalServerUrl in your VanaConfig."
|
|
40842
|
+
);
|
|
40843
|
+
}
|
|
40844
|
+
return this.context.defaultPersonalServerUrl;
|
|
40678
40845
|
}
|
|
40679
40846
|
/**
|
|
40680
40847
|
* Retrieves the cryptographic identity of a personal server.
|
|
@@ -40712,7 +40879,7 @@ var ServerController = class {
|
|
|
40712
40879
|
async getIdentity(request) {
|
|
40713
40880
|
try {
|
|
40714
40881
|
const response = await fetch(
|
|
40715
|
-
`${this.
|
|
40882
|
+
`${this.personalServerBaseUrl}/identity?address=${request.userAddress}`,
|
|
40716
40883
|
{
|
|
40717
40884
|
method: "GET",
|
|
40718
40885
|
headers: {
|
|
@@ -40732,7 +40899,7 @@ var ServerController = class {
|
|
|
40732
40899
|
kind: serverResponse.personal_server.kind,
|
|
40733
40900
|
address: serverResponse.personal_server.address,
|
|
40734
40901
|
public_key: serverResponse.personal_server.public_key,
|
|
40735
|
-
base_url: this.
|
|
40902
|
+
base_url: this.personalServerBaseUrl,
|
|
40736
40903
|
name: "Hosted Vana Server"
|
|
40737
40904
|
};
|
|
40738
40905
|
} catch (error) {
|
|
@@ -40828,7 +40995,7 @@ var ServerController = class {
|
|
|
40828
40995
|
try {
|
|
40829
40996
|
console.debug("Polling Operation Status:", operationId);
|
|
40830
40997
|
const response = await fetch(
|
|
40831
|
-
`${this.
|
|
40998
|
+
`${this.personalServerBaseUrl}/operations/${operationId}`,
|
|
40832
40999
|
{
|
|
40833
41000
|
method: "GET",
|
|
40834
41001
|
headers: {
|
|
@@ -40906,7 +41073,7 @@ var ServerController = class {
|
|
|
40906
41073
|
async cancelOperation(operationId) {
|
|
40907
41074
|
try {
|
|
40908
41075
|
const response = await fetch(
|
|
40909
|
-
`${this.
|
|
41076
|
+
`${this.personalServerBaseUrl}/operations/${operationId}/cancel`,
|
|
40910
41077
|
{
|
|
40911
41078
|
method: "POST"
|
|
40912
41079
|
}
|
|
@@ -40935,23 +41102,20 @@ var ServerController = class {
|
|
|
40935
41102
|
async makeRequest(requestBody) {
|
|
40936
41103
|
try {
|
|
40937
41104
|
console.debug("Personal Server Request:", {
|
|
40938
|
-
url: `${this.
|
|
41105
|
+
url: `${this.personalServerBaseUrl}/operations`,
|
|
40939
41106
|
method: "POST",
|
|
40940
41107
|
headers: {
|
|
40941
41108
|
"Content-Type": "application/json"
|
|
40942
41109
|
},
|
|
40943
41110
|
body: requestBody
|
|
40944
41111
|
});
|
|
40945
|
-
const response = await fetch(
|
|
40946
|
-
|
|
40947
|
-
{
|
|
40948
|
-
|
|
40949
|
-
|
|
40950
|
-
|
|
40951
|
-
|
|
40952
|
-
body: JSON.stringify(requestBody)
|
|
40953
|
-
}
|
|
40954
|
-
);
|
|
41112
|
+
const response = await fetch(`${this.personalServerBaseUrl}/operations`, {
|
|
41113
|
+
method: "POST",
|
|
41114
|
+
headers: {
|
|
41115
|
+
"Content-Type": "application/json"
|
|
41116
|
+
},
|
|
41117
|
+
body: JSON.stringify(requestBody)
|
|
41118
|
+
});
|
|
40955
41119
|
if (!response.ok) {
|
|
40956
41120
|
const errorText = await response.text();
|
|
40957
41121
|
console.debug("Personal Server Error Response:", {
|
|
@@ -42733,7 +42897,7 @@ var vanaMainnet2 = {
|
|
|
42733
42897
|
url: "https://vanascan.io"
|
|
42734
42898
|
}
|
|
42735
42899
|
},
|
|
42736
|
-
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/vana/7.0.
|
|
42900
|
+
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/vana/7.0.6/gn"
|
|
42737
42901
|
};
|
|
42738
42902
|
var moksha = {
|
|
42739
42903
|
id: 14800,
|
|
@@ -42754,7 +42918,7 @@ var moksha = {
|
|
|
42754
42918
|
url: "https://moksha.vanascan.io"
|
|
42755
42919
|
}
|
|
42756
42920
|
},
|
|
42757
|
-
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/moksha/7.0.
|
|
42921
|
+
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/moksha/7.0.6/gn"
|
|
42758
42922
|
};
|
|
42759
42923
|
function getChainConfig(chainId) {
|
|
42760
42924
|
switch (chainId) {
|
|
@@ -42852,10 +43016,12 @@ var VanaCore = class {
|
|
|
42852
43016
|
__publicField(this, "storageManager");
|
|
42853
43017
|
__publicField(this, "hasRequiredStorage");
|
|
42854
43018
|
__publicField(this, "ipfsGateways");
|
|
43019
|
+
__publicField(this, "defaultPersonalServerUrl");
|
|
42855
43020
|
this.platform = platform;
|
|
42856
43021
|
this.validateConfig(config);
|
|
42857
43022
|
this.relayerCallbacks = config.relayerCallbacks;
|
|
42858
43023
|
this.ipfsGateways = config.ipfsGateways;
|
|
43024
|
+
this.defaultPersonalServerUrl = config.defaultPersonalServerUrl;
|
|
42859
43025
|
this.hasRequiredStorage = hasStorageConfig(config);
|
|
42860
43026
|
if (config.storage?.providers) {
|
|
42861
43027
|
this.storageManager = new StorageManager();
|
|
@@ -42915,7 +43081,8 @@ var VanaCore = class {
|
|
|
42915
43081
|
// Pass the platform adapter to controllers
|
|
42916
43082
|
validateStorageRequired: this.validateStorageRequired.bind(this),
|
|
42917
43083
|
hasStorage: this.hasStorage.bind(this),
|
|
42918
|
-
ipfsGateways: this.ipfsGateways
|
|
43084
|
+
ipfsGateways: this.ipfsGateways,
|
|
43085
|
+
defaultPersonalServerUrl: this.defaultPersonalServerUrl
|
|
42919
43086
|
};
|
|
42920
43087
|
this.permissions = new PermissionsController(sharedContext);
|
|
42921
43088
|
this.data = new DataController(sharedContext);
|