@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.js
CHANGED
|
@@ -36817,10 +36817,19 @@ var PermissionsController = class {
|
|
|
36817
36817
|
/**
|
|
36818
36818
|
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
36819
36819
|
*
|
|
36820
|
-
*
|
|
36820
|
+
* The nonce is used to prevent replay attacks in signed transactions and must
|
|
36821
|
+
* be incremented with each transaction to maintain security.
|
|
36822
|
+
*
|
|
36823
|
+
* @returns Promise resolving to the user's current nonce value as a bigint
|
|
36821
36824
|
* @throws {Error} When wallet account is not available
|
|
36822
36825
|
* @throws {Error} When chain ID is not available
|
|
36823
36826
|
* @throws {NonceError} When reading nonce from contract fails
|
|
36827
|
+
* @private
|
|
36828
|
+
* @example
|
|
36829
|
+
* ```typescript
|
|
36830
|
+
* const nonce = await this.getUserNonce();
|
|
36831
|
+
* console.log(`Current nonce: ${nonce}`);
|
|
36832
|
+
* ```
|
|
36824
36833
|
*/
|
|
36825
36834
|
async getUserNonce() {
|
|
36826
36835
|
try {
|
|
@@ -37015,9 +37024,15 @@ var PermissionsController = class {
|
|
|
37015
37024
|
grant
|
|
37016
37025
|
nonce
|
|
37017
37026
|
signature
|
|
37027
|
+
startBlock
|
|
37028
|
+
endBlock
|
|
37018
37029
|
addedAtBlock
|
|
37019
37030
|
addedAtTimestamp
|
|
37020
37031
|
transactionHash
|
|
37032
|
+
grantee {
|
|
37033
|
+
id
|
|
37034
|
+
address
|
|
37035
|
+
}
|
|
37021
37036
|
}
|
|
37022
37037
|
}
|
|
37023
37038
|
}
|
|
@@ -37052,15 +37067,16 @@ var PermissionsController = class {
|
|
|
37052
37067
|
const onChainGrants = userData.permissions.slice(0, limit).map((permission) => ({
|
|
37053
37068
|
id: BigInt(permission.id),
|
|
37054
37069
|
grantUrl: permission.grant,
|
|
37055
|
-
grantSignature: permission.
|
|
37056
|
-
grantHash:
|
|
37070
|
+
grantSignature: permission.signature,
|
|
37071
|
+
grantHash: "",
|
|
37072
|
+
// Not available in new schema, compute if needed
|
|
37057
37073
|
nonce: BigInt(permission.nonce),
|
|
37058
37074
|
addedAtBlock: BigInt(permission.addedAtBlock),
|
|
37059
37075
|
addedAtTimestamp: BigInt(permission.addedAtTimestamp || "0"),
|
|
37060
37076
|
transactionHash: permission.transactionHash || "",
|
|
37061
37077
|
grantor: userAddress,
|
|
37062
|
-
active:
|
|
37063
|
-
//
|
|
37078
|
+
active: !permission.endBlock || BigInt(permission.endBlock) === 0n
|
|
37079
|
+
// Active if no end block or end block is 0
|
|
37064
37080
|
}));
|
|
37065
37081
|
return onChainGrants.sort((a, b) => {
|
|
37066
37082
|
if (a.id < b.id) return 1;
|
|
@@ -37213,23 +37229,37 @@ var PermissionsController = class {
|
|
|
37213
37229
|
}
|
|
37214
37230
|
}
|
|
37215
37231
|
/**
|
|
37216
|
-
*
|
|
37232
|
+
* Registers a new server and immediately trusts it in the DataPortabilityServers contract.
|
|
37233
|
+
*
|
|
37234
|
+
* This is a combined operation that both registers a new data portability server
|
|
37235
|
+
* and adds it to the user's trusted servers list in a single transaction.
|
|
37236
|
+
* Trusted servers can handle data export and portability requests from the user.
|
|
37217
37237
|
*
|
|
37218
37238
|
* @param params - Parameters for adding and trusting the server
|
|
37239
|
+
* @param params.owner - Ethereum address that will own this server registration
|
|
37240
|
+
* @param params.serverAddress - Ethereum address of the server
|
|
37241
|
+
* @param params.serverUrl - HTTPS URL where the server can be reached
|
|
37242
|
+
* @param params.publicKey - Server's public key for encryption (hex string)
|
|
37219
37243
|
* @returns Promise resolving to transaction hash
|
|
37220
37244
|
* @throws {UserRejectedRequestError} When user rejects the transaction
|
|
37221
37245
|
* @throws {BlockchainError} When chain ID is unavailable or transaction fails
|
|
37246
|
+
* @throws {ServerAlreadyRegisteredError} When server address is already registered
|
|
37222
37247
|
* @throws {Error} When wallet account is not available
|
|
37248
|
+
*
|
|
37223
37249
|
* @example
|
|
37224
37250
|
* ```typescript
|
|
37225
37251
|
* // Add and trust a server by providing all required details
|
|
37226
37252
|
* const txHash = await vana.permissions.addAndTrustServer({
|
|
37227
|
-
* owner: '
|
|
37253
|
+
* owner: '0x1234567890abcdef1234567890abcdef12345678',
|
|
37228
37254
|
* serverAddress: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
|
|
37229
37255
|
* serverUrl: 'https://myserver.example.com',
|
|
37230
|
-
* publicKey: '
|
|
37256
|
+
* publicKey: '0x456789abcdef456789abcdef456789abcdef456789abcdef'
|
|
37231
37257
|
* });
|
|
37232
37258
|
* console.log('Server added and trusted in transaction:', txHash);
|
|
37259
|
+
*
|
|
37260
|
+
* // Verify the server is now trusted
|
|
37261
|
+
* const trustedServers = await vana.permissions.getTrustedServers();
|
|
37262
|
+
* console.log('Now trusting servers:', trustedServers);
|
|
37233
37263
|
* ```
|
|
37234
37264
|
*/
|
|
37235
37265
|
async addAndTrustServer(params) {
|
|
@@ -37423,15 +37453,32 @@ var PermissionsController = class {
|
|
|
37423
37453
|
}
|
|
37424
37454
|
}
|
|
37425
37455
|
/**
|
|
37426
|
-
*
|
|
37456
|
+
* Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
|
|
37457
|
+
*
|
|
37458
|
+
* This revokes the server's authorization to handle data portability requests for the user.
|
|
37459
|
+
* The server remains registered in the system but will no longer be trusted by this user.
|
|
37427
37460
|
*
|
|
37428
37461
|
* @param params - Parameters for untrusting the server
|
|
37429
|
-
* @param params.serverId - The
|
|
37462
|
+
* @param params.serverId - The numeric ID of the server to untrust
|
|
37430
37463
|
* @returns Promise resolving to transaction hash
|
|
37431
37464
|
* @throws {Error} When wallet account is not available
|
|
37432
37465
|
* @throws {NonceError} When retrieving user nonce fails
|
|
37433
37466
|
* @throws {UserRejectedRequestError} When user rejects the transaction
|
|
37467
|
+
* @throws {ServerNotTrustedError} When the server is not currently trusted
|
|
37434
37468
|
* @throws {BlockchainError} When untrust transaction fails
|
|
37469
|
+
*
|
|
37470
|
+
* @example
|
|
37471
|
+
* ```typescript
|
|
37472
|
+
* // Untrust a specific server
|
|
37473
|
+
* const txHash = await vana.permissions.untrustServer({
|
|
37474
|
+
* serverId: 1
|
|
37475
|
+
* });
|
|
37476
|
+
* console.log('Server untrusted in transaction:', txHash);
|
|
37477
|
+
*
|
|
37478
|
+
* // Verify the server is no longer trusted
|
|
37479
|
+
* const trustedServers = await vana.permissions.getTrustedServers();
|
|
37480
|
+
* console.log('Still trusting servers:', trustedServers);
|
|
37481
|
+
* ```
|
|
37435
37482
|
*/
|
|
37436
37483
|
async untrustServer(params) {
|
|
37437
37484
|
const nonce = await this.getUserNonce();
|
|
@@ -37489,11 +37536,26 @@ var PermissionsController = class {
|
|
|
37489
37536
|
}
|
|
37490
37537
|
}
|
|
37491
37538
|
/**
|
|
37492
|
-
*
|
|
37539
|
+
* Retrieves all servers trusted by a user from the DataPortabilityServers contract.
|
|
37493
37540
|
*
|
|
37494
|
-
*
|
|
37541
|
+
* Returns an array of server IDs that the specified user has explicitly trusted.
|
|
37542
|
+
* Trusted servers are those that users have authorized to handle their data portability requests.
|
|
37543
|
+
*
|
|
37544
|
+
* @param userAddress - Optional user address to query (defaults to current wallet user)
|
|
37495
37545
|
* @returns Promise resolving to array of trusted server IDs (numeric)
|
|
37496
37546
|
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
37547
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
37548
|
+
*
|
|
37549
|
+
* @example
|
|
37550
|
+
* ```typescript
|
|
37551
|
+
* // Get trusted servers for current user
|
|
37552
|
+
* const myServers = await vana.permissions.getTrustedServers();
|
|
37553
|
+
* console.log(`I trust ${myServers.length} servers: ${myServers.join(', ')}`);
|
|
37554
|
+
*
|
|
37555
|
+
* // Get trusted servers for another user
|
|
37556
|
+
* const userServers = await vana.permissions.getTrustedServers("0x1234...");
|
|
37557
|
+
* console.log(`User trusts servers: ${userServers.join(', ')}`);
|
|
37558
|
+
* ```
|
|
37497
37559
|
*/
|
|
37498
37560
|
async getTrustedServers(userAddress) {
|
|
37499
37561
|
try {
|
|
@@ -37519,11 +37581,27 @@ var PermissionsController = class {
|
|
|
37519
37581
|
}
|
|
37520
37582
|
}
|
|
37521
37583
|
/**
|
|
37522
|
-
*
|
|
37584
|
+
* Retrieves detailed information about a specific server from the DataPortabilityServers contract.
|
|
37523
37585
|
*
|
|
37524
|
-
*
|
|
37525
|
-
*
|
|
37586
|
+
* Returns complete server information including owner, address, public key, and URL.
|
|
37587
|
+
* This information is used to establish secure connections and verify server identity.
|
|
37588
|
+
*
|
|
37589
|
+
* @param serverId - The unique numeric ID of the server to query
|
|
37590
|
+
* @returns Promise resolving to complete server information
|
|
37526
37591
|
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
37592
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
37593
|
+
* @throws {ServerNotFoundError} When the server ID does not exist
|
|
37594
|
+
*
|
|
37595
|
+
* @example
|
|
37596
|
+
* ```typescript
|
|
37597
|
+
* const server = await vana.permissions.getServerInfo(1);
|
|
37598
|
+
*
|
|
37599
|
+
* console.log(`Server ${server.id}:`);
|
|
37600
|
+
* console.log(` Owner: ${server.owner}`);
|
|
37601
|
+
* console.log(` Address: ${server.serverAddress}`);
|
|
37602
|
+
* console.log(` URL: ${server.url}`);
|
|
37603
|
+
* console.log(` Public Key: ${server.publicKey}`);
|
|
37604
|
+
* ```
|
|
37527
37605
|
*/
|
|
37528
37606
|
async getServerInfo(serverId) {
|
|
37529
37607
|
try {
|
|
@@ -37554,10 +37632,26 @@ var PermissionsController = class {
|
|
|
37554
37632
|
}
|
|
37555
37633
|
}
|
|
37556
37634
|
/**
|
|
37557
|
-
* Checks if a server is active.
|
|
37635
|
+
* Checks if a specific server is active in the DataPortabilityServers contract.
|
|
37558
37636
|
*
|
|
37559
|
-
*
|
|
37560
|
-
*
|
|
37637
|
+
* An active server is one that is properly registered and operational, meaning
|
|
37638
|
+
* it can receive and process data portability requests from users.
|
|
37639
|
+
*
|
|
37640
|
+
* @param serverId - The unique numeric ID of the server to check
|
|
37641
|
+
* @returns Promise resolving to true if server is active, false otherwise
|
|
37642
|
+
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
37643
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
37644
|
+
*
|
|
37645
|
+
* @example
|
|
37646
|
+
* ```typescript
|
|
37647
|
+
* const isActive = await vana.permissions.isActiveServer(1);
|
|
37648
|
+
*
|
|
37649
|
+
* if (isActive) {
|
|
37650
|
+
* console.log('Server 1 is active and ready to process requests');
|
|
37651
|
+
* } else {
|
|
37652
|
+
* console.log('Server 1 is inactive or not found');
|
|
37653
|
+
* }
|
|
37654
|
+
* ```
|
|
37561
37655
|
*/
|
|
37562
37656
|
async isActiveServer(serverId) {
|
|
37563
37657
|
try {
|
|
@@ -38029,10 +38123,19 @@ var PermissionsController = class {
|
|
|
38029
38123
|
// GRANTEE METHODS
|
|
38030
38124
|
// ===========================
|
|
38031
38125
|
/**
|
|
38032
|
-
* Registers a new grantee
|
|
38126
|
+
* Registers a new grantee in the DataPortabilityGrantees contract.
|
|
38127
|
+
*
|
|
38128
|
+
* A grantee is an entity (like an application) that can receive data permissions
|
|
38129
|
+
* from users. Once registered, users can grant the grantee access to their data.
|
|
38033
38130
|
*
|
|
38034
38131
|
* @param params - Parameters for registering the grantee
|
|
38132
|
+
* @param params.owner - The Ethereum address that will own this grantee registration
|
|
38133
|
+
* @param params.granteeAddress - The Ethereum address of the grantee (application)
|
|
38134
|
+
* @param params.publicKey - The public key used for data encryption/decryption (hex string)
|
|
38035
38135
|
* @returns Promise resolving to the transaction hash
|
|
38136
|
+
* @throws {BlockchainError} When the grantee registration transaction fails
|
|
38137
|
+
* @throws {UserRejectedRequestError} When user rejects the transaction
|
|
38138
|
+
* @throws {ContractError} When grantee is already registered
|
|
38036
38139
|
*
|
|
38037
38140
|
* @example
|
|
38038
38141
|
* ```typescript
|
|
@@ -38041,6 +38144,7 @@ var PermissionsController = class {
|
|
|
38041
38144
|
* granteeAddress: "0xApp1234567890123456789012345678901234567890",
|
|
38042
38145
|
* publicKey: "0x1234567890abcdef..."
|
|
38043
38146
|
* });
|
|
38147
|
+
* console.log(`Grantee registered in transaction: ${txHash}`);
|
|
38044
38148
|
* ```
|
|
38045
38149
|
*/
|
|
38046
38150
|
async registerGrantee(params) {
|
|
@@ -38103,17 +38207,35 @@ var PermissionsController = class {
|
|
|
38103
38207
|
return this.submitSignedRegisterGranteeTransaction(typedData, signature);
|
|
38104
38208
|
}
|
|
38105
38209
|
/**
|
|
38106
|
-
*
|
|
38210
|
+
* Retrieves all registered grantees from the DataPortabilityGrantees contract.
|
|
38107
38211
|
*
|
|
38108
|
-
*
|
|
38109
|
-
*
|
|
38212
|
+
* Returns a paginated list of all grantees (applications) that have been registered
|
|
38213
|
+
* in the system and can receive data permissions from users.
|
|
38214
|
+
*
|
|
38215
|
+
* @param options - Query options for pagination and filtering
|
|
38216
|
+
* @param options.limit - Maximum number of grantees to return (default: 50)
|
|
38217
|
+
* @param options.offset - Number of grantees to skip for pagination (default: 0)
|
|
38218
|
+
* @returns Promise resolving to paginated grantees with metadata
|
|
38219
|
+
* @throws {BlockchainError} When contract read operation fails
|
|
38220
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
38110
38221
|
*
|
|
38111
38222
|
* @example
|
|
38112
38223
|
* ```typescript
|
|
38224
|
+
* // Get first 10 grantees
|
|
38113
38225
|
* const result = await vana.permissions.getGrantees({
|
|
38114
38226
|
* limit: 10,
|
|
38115
38227
|
* offset: 0
|
|
38116
38228
|
* });
|
|
38229
|
+
*
|
|
38230
|
+
* console.log(`Found ${result.total} total grantees`);
|
|
38231
|
+
* result.grantees.forEach(grantee => {
|
|
38232
|
+
* console.log(`Grantee ${grantee.id}: ${grantee.granteeAddress}`);
|
|
38233
|
+
* });
|
|
38234
|
+
*
|
|
38235
|
+
* // Check if there are more results
|
|
38236
|
+
* if (result.hasMore) {
|
|
38237
|
+
* console.log('More grantees available');
|
|
38238
|
+
* }
|
|
38117
38239
|
* ```
|
|
38118
38240
|
*/
|
|
38119
38241
|
async getGrantees(options = {}) {
|
|
@@ -38162,14 +38284,29 @@ var PermissionsController = class {
|
|
|
38162
38284
|
};
|
|
38163
38285
|
}
|
|
38164
38286
|
/**
|
|
38165
|
-
*
|
|
38287
|
+
* Retrieves a specific grantee by their Ethereum address from the DataPortabilityGrantees contract.
|
|
38288
|
+
*
|
|
38289
|
+
* Looks up a registered grantee (application) using their Ethereum address
|
|
38290
|
+
* and returns their complete registration information including permissions.
|
|
38166
38291
|
*
|
|
38167
|
-
* @param granteeAddress - The grantee
|
|
38168
|
-
* @returns Promise resolving to the grantee
|
|
38292
|
+
* @param granteeAddress - The Ethereum address of the grantee to look up
|
|
38293
|
+
* @returns Promise resolving to the grantee information, or null if not found
|
|
38294
|
+
* @throws {BlockchainError} When contract read operation fails
|
|
38295
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
38169
38296
|
*
|
|
38170
38297
|
* @example
|
|
38171
38298
|
* ```typescript
|
|
38172
|
-
* const
|
|
38299
|
+
* const granteeAddress = "0xApp1234567890123456789012345678901234567890";
|
|
38300
|
+
* const grantee = await vana.permissions.getGranteeByAddress(granteeAddress);
|
|
38301
|
+
*
|
|
38302
|
+
* if (grantee) {
|
|
38303
|
+
* console.log(`Found grantee ${grantee.id}`);
|
|
38304
|
+
* console.log(`Owner: ${grantee.owner}`);
|
|
38305
|
+
* console.log(`Public Key: ${grantee.publicKey}`);
|
|
38306
|
+
* console.log(`Permissions: ${grantee.permissionIds.join(', ')}`);
|
|
38307
|
+
* } else {
|
|
38308
|
+
* console.log('Grantee not found');
|
|
38309
|
+
* }
|
|
38173
38310
|
* ```
|
|
38174
38311
|
*/
|
|
38175
38312
|
async getGranteeByAddress(granteeAddress) {
|
|
@@ -38205,14 +38342,28 @@ var PermissionsController = class {
|
|
|
38205
38342
|
}
|
|
38206
38343
|
}
|
|
38207
38344
|
/**
|
|
38208
|
-
*
|
|
38345
|
+
* Retrieves a specific grantee by their unique ID from the DataPortabilityGrantees contract.
|
|
38346
|
+
*
|
|
38347
|
+
* Looks up a registered grantee (application) using their numeric ID assigned during
|
|
38348
|
+
* registration and returns their complete information including permissions.
|
|
38209
38349
|
*
|
|
38210
|
-
* @param granteeId - The grantee
|
|
38211
|
-
* @returns Promise resolving to the grantee
|
|
38350
|
+
* @param granteeId - The unique numeric ID of the grantee (1-indexed)
|
|
38351
|
+
* @returns Promise resolving to the grantee information, or null if not found
|
|
38352
|
+
* @throws {BlockchainError} When contract read operation fails
|
|
38353
|
+
* @throws {NetworkError} When unable to connect to the blockchain network
|
|
38212
38354
|
*
|
|
38213
38355
|
* @example
|
|
38214
38356
|
* ```typescript
|
|
38215
38357
|
* const grantee = await vana.permissions.getGranteeById(1);
|
|
38358
|
+
*
|
|
38359
|
+
* if (grantee) {
|
|
38360
|
+
* console.log(`Grantee ID: ${grantee.id}`);
|
|
38361
|
+
* console.log(`Address: ${grantee.granteeAddress}`);
|
|
38362
|
+
* console.log(`Owner: ${grantee.owner}`);
|
|
38363
|
+
* console.log(`Total permissions: ${grantee.permissionIds.length}`);
|
|
38364
|
+
* } else {
|
|
38365
|
+
* console.log('Grantee with ID 1 not found');
|
|
38366
|
+
* }
|
|
38216
38367
|
* ```
|
|
38217
38368
|
*/
|
|
38218
38369
|
async getGranteeById(granteeId) {
|
|
@@ -39067,11 +39218,18 @@ var DataController = class {
|
|
|
39067
39218
|
query GetUserTrustedServers($userId: ID!) {
|
|
39068
39219
|
user(id: $userId) {
|
|
39069
39220
|
id
|
|
39070
|
-
|
|
39221
|
+
serverTrusts {
|
|
39071
39222
|
id
|
|
39072
|
-
|
|
39073
|
-
|
|
39223
|
+
server {
|
|
39224
|
+
id
|
|
39225
|
+
serverAddress
|
|
39226
|
+
url
|
|
39227
|
+
publicKey
|
|
39228
|
+
}
|
|
39074
39229
|
trustedAt
|
|
39230
|
+
trustedAtBlock
|
|
39231
|
+
untrustedAtBlock
|
|
39232
|
+
transactionHash
|
|
39075
39233
|
}
|
|
39076
39234
|
}
|
|
39077
39235
|
}
|
|
@@ -39103,12 +39261,14 @@ var DataController = class {
|
|
|
39103
39261
|
if (!result.data?.user) {
|
|
39104
39262
|
return [];
|
|
39105
39263
|
}
|
|
39106
|
-
return (result.data.user.
|
|
39107
|
-
id: server.id,
|
|
39108
|
-
serverAddress: server.serverAddress,
|
|
39109
|
-
serverUrl: server.
|
|
39110
|
-
trustedAt: BigInt(
|
|
39111
|
-
user
|
|
39264
|
+
return (result.data.user.serverTrusts || []).filter((trust) => !trust.untrustedAtBlock).map((trust) => ({
|
|
39265
|
+
id: trust.server.id,
|
|
39266
|
+
serverAddress: trust.server.serverAddress,
|
|
39267
|
+
serverUrl: trust.server.url,
|
|
39268
|
+
trustedAt: BigInt(trust.trustedAt),
|
|
39269
|
+
user,
|
|
39270
|
+
name: ""
|
|
39271
|
+
// Not available in new schema, will be empty
|
|
39112
39272
|
}));
|
|
39113
39273
|
} catch (error) {
|
|
39114
39274
|
console.error("Failed to query trusted servers from subgraph:", error);
|
|
@@ -40935,7 +41095,14 @@ var ServerController = class {
|
|
|
40935
41095
|
constructor(context) {
|
|
40936
41096
|
this.context = context;
|
|
40937
41097
|
}
|
|
40938
|
-
|
|
41098
|
+
get personalServerBaseUrl() {
|
|
41099
|
+
if (!this.context.defaultPersonalServerUrl) {
|
|
41100
|
+
throw new PersonalServerError(
|
|
41101
|
+
"Personal server URL is required for server operations. Please configure defaultPersonalServerUrl in your VanaConfig."
|
|
41102
|
+
);
|
|
41103
|
+
}
|
|
41104
|
+
return this.context.defaultPersonalServerUrl;
|
|
41105
|
+
}
|
|
40939
41106
|
/**
|
|
40940
41107
|
* Retrieves the cryptographic identity of a personal server.
|
|
40941
41108
|
*
|
|
@@ -40972,7 +41139,7 @@ var ServerController = class {
|
|
|
40972
41139
|
async getIdentity(request) {
|
|
40973
41140
|
try {
|
|
40974
41141
|
const response = await fetch(
|
|
40975
|
-
`${this.
|
|
41142
|
+
`${this.personalServerBaseUrl}/identity?address=${request.userAddress}`,
|
|
40976
41143
|
{
|
|
40977
41144
|
method: "GET",
|
|
40978
41145
|
headers: {
|
|
@@ -40992,7 +41159,7 @@ var ServerController = class {
|
|
|
40992
41159
|
kind: serverResponse.personal_server.kind,
|
|
40993
41160
|
address: serverResponse.personal_server.address,
|
|
40994
41161
|
public_key: serverResponse.personal_server.public_key,
|
|
40995
|
-
base_url: this.
|
|
41162
|
+
base_url: this.personalServerBaseUrl,
|
|
40996
41163
|
name: "Hosted Vana Server"
|
|
40997
41164
|
};
|
|
40998
41165
|
} catch (error) {
|
|
@@ -41088,7 +41255,7 @@ var ServerController = class {
|
|
|
41088
41255
|
try {
|
|
41089
41256
|
console.debug("Polling Operation Status:", operationId);
|
|
41090
41257
|
const response = await fetch(
|
|
41091
|
-
`${this.
|
|
41258
|
+
`${this.personalServerBaseUrl}/operations/${operationId}`,
|
|
41092
41259
|
{
|
|
41093
41260
|
method: "GET",
|
|
41094
41261
|
headers: {
|
|
@@ -41166,7 +41333,7 @@ var ServerController = class {
|
|
|
41166
41333
|
async cancelOperation(operationId) {
|
|
41167
41334
|
try {
|
|
41168
41335
|
const response = await fetch(
|
|
41169
|
-
`${this.
|
|
41336
|
+
`${this.personalServerBaseUrl}/operations/${operationId}/cancel`,
|
|
41170
41337
|
{
|
|
41171
41338
|
method: "POST"
|
|
41172
41339
|
}
|
|
@@ -41195,23 +41362,20 @@ var ServerController = class {
|
|
|
41195
41362
|
async makeRequest(requestBody) {
|
|
41196
41363
|
try {
|
|
41197
41364
|
console.debug("Personal Server Request:", {
|
|
41198
|
-
url: `${this.
|
|
41365
|
+
url: `${this.personalServerBaseUrl}/operations`,
|
|
41199
41366
|
method: "POST",
|
|
41200
41367
|
headers: {
|
|
41201
41368
|
"Content-Type": "application/json"
|
|
41202
41369
|
},
|
|
41203
41370
|
body: requestBody
|
|
41204
41371
|
});
|
|
41205
|
-
const response = await fetch(
|
|
41206
|
-
|
|
41207
|
-
{
|
|
41208
|
-
|
|
41209
|
-
|
|
41210
|
-
|
|
41211
|
-
|
|
41212
|
-
body: JSON.stringify(requestBody)
|
|
41213
|
-
}
|
|
41214
|
-
);
|
|
41372
|
+
const response = await fetch(`${this.personalServerBaseUrl}/operations`, {
|
|
41373
|
+
method: "POST",
|
|
41374
|
+
headers: {
|
|
41375
|
+
"Content-Type": "application/json"
|
|
41376
|
+
},
|
|
41377
|
+
body: JSON.stringify(requestBody)
|
|
41378
|
+
});
|
|
41215
41379
|
if (!response.ok) {
|
|
41216
41380
|
const errorText = await response.text();
|
|
41217
41381
|
console.debug("Personal Server Error Response:", {
|
|
@@ -42991,7 +43155,7 @@ var vanaMainnet2 = {
|
|
|
42991
43155
|
url: "https://vanascan.io"
|
|
42992
43156
|
}
|
|
42993
43157
|
},
|
|
42994
|
-
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/vana/7.0.
|
|
43158
|
+
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/vana/7.0.6/gn"
|
|
42995
43159
|
};
|
|
42996
43160
|
var moksha = {
|
|
42997
43161
|
id: 14800,
|
|
@@ -43012,7 +43176,7 @@ var moksha = {
|
|
|
43012
43176
|
url: "https://moksha.vanascan.io"
|
|
43013
43177
|
}
|
|
43014
43178
|
},
|
|
43015
|
-
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/moksha/7.0.
|
|
43179
|
+
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/moksha/7.0.6/gn"
|
|
43016
43180
|
};
|
|
43017
43181
|
function getChainConfig(chainId) {
|
|
43018
43182
|
switch (chainId) {
|
|
@@ -43088,6 +43252,7 @@ var VanaCore = class {
|
|
|
43088
43252
|
storageManager;
|
|
43089
43253
|
hasRequiredStorage;
|
|
43090
43254
|
ipfsGateways;
|
|
43255
|
+
defaultPersonalServerUrl;
|
|
43091
43256
|
/**
|
|
43092
43257
|
* Initializes a new VanaCore client instance with the provided configuration.
|
|
43093
43258
|
*
|
|
@@ -43114,6 +43279,7 @@ var VanaCore = class {
|
|
|
43114
43279
|
this.validateConfig(config);
|
|
43115
43280
|
this.relayerCallbacks = config.relayerCallbacks;
|
|
43116
43281
|
this.ipfsGateways = config.ipfsGateways;
|
|
43282
|
+
this.defaultPersonalServerUrl = config.defaultPersonalServerUrl;
|
|
43117
43283
|
this.hasRequiredStorage = hasStorageConfig(config);
|
|
43118
43284
|
if (config.storage?.providers) {
|
|
43119
43285
|
this.storageManager = new StorageManager();
|
|
@@ -43173,7 +43339,8 @@ var VanaCore = class {
|
|
|
43173
43339
|
// Pass the platform adapter to controllers
|
|
43174
43340
|
validateStorageRequired: this.validateStorageRequired.bind(this),
|
|
43175
43341
|
hasStorage: this.hasStorage.bind(this),
|
|
43176
|
-
ipfsGateways: this.ipfsGateways
|
|
43342
|
+
ipfsGateways: this.ipfsGateways,
|
|
43343
|
+
defaultPersonalServerUrl: this.defaultPersonalServerUrl
|
|
43177
43344
|
};
|
|
43178
43345
|
this.permissions = new PermissionsController(sharedContext);
|
|
43179
43346
|
this.data = new DataController(sharedContext);
|