@opendatalabs/vana-sdk 0.1.0-alpha.3d5028d → 0.1.0-alpha.470c7fa
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/README.md +42 -0
- package/dist/{browser-cRpdLQ3-.d.ts → browser-DY8XDblx.d.ts} +4 -0
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +24 -9
- package/dist/browser.js.map +1 -1
- 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 +1374 -420
- package/dist/index.browser.js +35246 -33340
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +35600 -33702
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.cts +1407 -427
- package/dist/index.node.d.ts +1407 -427
- package/dist/index.node.js +35459 -33564
- package/dist/index.node.js.map +1 -1
- package/dist/{node-CkdgwBiv.d.cts → node-D9-F9uEP.d.cts} +3 -2
- package/dist/{node-CkdgwBiv.d.ts → node-D9-F9uEP.d.ts} +3 -2
- package/dist/node.cjs +31 -33
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +31 -33
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.d.ts +2 -2
- package/dist/platform.browser.js +31 -8
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.cjs +72 -62
- package/dist/platform.cjs.map +1 -1
- package/dist/platform.d.cts +1 -1
- package/dist/platform.d.ts +1 -1
- package/dist/platform.js +72 -62
- package/dist/platform.js.map +1 -1
- package/dist/platform.node.cjs +72 -62
- package/dist/platform.node.cjs.map +1 -1
- package/dist/platform.node.d.cts +6 -2
- package/dist/platform.node.d.ts +6 -2
- package/dist/platform.node.js +72 -62
- package/dist/platform.node.js.map +1 -1
- package/package.json +16 -11
package/dist/index.browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Chain, Address, Hash, WalletClient, Account, Abi, GetContractReturnType, PublicClient } from 'viem';
|
|
1
|
+
import { Chain, Address, Hash, WalletClient, Account, Abi, GetContractReturnType, TransactionReceipt as TransactionReceipt$1, PublicClient } from 'viem';
|
|
2
2
|
export { Abi, Account, Address, Chain, GetContractReturnType, Hash, PublicClient, WalletClient } from 'viem';
|
|
3
3
|
import { Abi as Abi$1 } from 'abitype';
|
|
4
4
|
|
|
@@ -157,6 +157,14 @@ declare class StorageError extends Error {
|
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Base interface for types that need to be compatible with Record<string, unknown>
|
|
162
|
+
*
|
|
163
|
+
* @category Permissions
|
|
164
|
+
*/
|
|
165
|
+
interface RecordCompatible {
|
|
166
|
+
[key: string]: unknown;
|
|
167
|
+
}
|
|
160
168
|
/**
|
|
161
169
|
* Represents on-chain permission grant data without expensive off-chain resolution.
|
|
162
170
|
*
|
|
@@ -183,10 +191,10 @@ interface OnChainPermissionGrant {
|
|
|
183
191
|
grantUrl: string;
|
|
184
192
|
/** Cryptographic signature that authorized this permission */
|
|
185
193
|
grantSignature: string;
|
|
186
|
-
/** Hash of the grant file content for integrity verification */
|
|
187
|
-
grantHash: string;
|
|
188
194
|
/** Nonce used when granting the permission */
|
|
189
195
|
nonce: bigint;
|
|
196
|
+
/** Block number when permission started */
|
|
197
|
+
startBlock: bigint;
|
|
190
198
|
/** Block number when permission was granted */
|
|
191
199
|
addedAtBlock: bigint;
|
|
192
200
|
/** Timestamp when permission was added */
|
|
@@ -195,6 +203,13 @@ interface OnChainPermissionGrant {
|
|
|
195
203
|
transactionHash: string;
|
|
196
204
|
/** Address that granted the permission */
|
|
197
205
|
grantor: Address;
|
|
206
|
+
/** Grantee information */
|
|
207
|
+
grantee: {
|
|
208
|
+
/** Grantee ID */
|
|
209
|
+
id: string;
|
|
210
|
+
/** Grantee address */
|
|
211
|
+
address: string;
|
|
212
|
+
};
|
|
198
213
|
/** Whether the permission is still active (not revoked) */
|
|
199
214
|
active: boolean;
|
|
200
215
|
}
|
|
@@ -355,7 +370,7 @@ interface PermissionGrantMessage {
|
|
|
355
370
|
*
|
|
356
371
|
* @category Permissions
|
|
357
372
|
*/
|
|
358
|
-
interface PermissionInputMessage {
|
|
373
|
+
interface PermissionInputMessage extends RecordCompatible {
|
|
359
374
|
/** Nonce */
|
|
360
375
|
nonce: bigint;
|
|
361
376
|
/** Grantee ID */
|
|
@@ -370,7 +385,7 @@ interface PermissionInputMessage {
|
|
|
370
385
|
*
|
|
371
386
|
* @category Permissions
|
|
372
387
|
*/
|
|
373
|
-
interface RevokePermissionInput {
|
|
388
|
+
interface RevokePermissionInput extends RecordCompatible {
|
|
374
389
|
/** Nonce */
|
|
375
390
|
nonce: bigint;
|
|
376
391
|
/** Permission ID to revoke */
|
|
@@ -451,9 +466,7 @@ interface GrantFile {
|
|
|
451
466
|
*
|
|
452
467
|
* @category Permissions
|
|
453
468
|
*/
|
|
454
|
-
interface PermissionGrantTypedData {
|
|
455
|
-
/** EIP-712 domain */
|
|
456
|
-
domain: PermissionGrantDomain;
|
|
469
|
+
interface PermissionGrantTypedData extends GenericTypedData {
|
|
457
470
|
/** EIP-712 types */
|
|
458
471
|
types: {
|
|
459
472
|
Permission: Array<{
|
|
@@ -471,7 +484,7 @@ interface PermissionGrantTypedData {
|
|
|
471
484
|
*
|
|
472
485
|
* @category Permissions
|
|
473
486
|
*/
|
|
474
|
-
interface GenericTypedData {
|
|
487
|
+
interface GenericTypedData extends RecordCompatible {
|
|
475
488
|
/** EIP-712 domain */
|
|
476
489
|
domain: PermissionGrantDomain;
|
|
477
490
|
/** EIP-712 types */
|
|
@@ -665,7 +678,7 @@ interface UntrustServerParams {
|
|
|
665
678
|
*
|
|
666
679
|
* @category Permissions
|
|
667
680
|
*/
|
|
668
|
-
interface AddAndTrustServerInput {
|
|
681
|
+
interface AddAndTrustServerInput extends RecordCompatible {
|
|
669
682
|
/** User nonce */
|
|
670
683
|
nonce: bigint;
|
|
671
684
|
/** Server address */
|
|
@@ -681,7 +694,7 @@ interface AddAndTrustServerInput {
|
|
|
681
694
|
* @category Permissions
|
|
682
695
|
* @deprecated Use AddAndTrustServerInput instead
|
|
683
696
|
*/
|
|
684
|
-
interface TrustServerInput {
|
|
697
|
+
interface TrustServerInput extends RecordCompatible {
|
|
685
698
|
/** User nonce */
|
|
686
699
|
nonce: bigint;
|
|
687
700
|
/** Server ID (numeric) */
|
|
@@ -692,7 +705,7 @@ interface TrustServerInput {
|
|
|
692
705
|
*
|
|
693
706
|
* @category Permissions
|
|
694
707
|
*/
|
|
695
|
-
interface UntrustServerInput {
|
|
708
|
+
interface UntrustServerInput extends RecordCompatible {
|
|
696
709
|
/** User nonce */
|
|
697
710
|
nonce: bigint;
|
|
698
711
|
/** Server ID (numeric) */
|
|
@@ -703,9 +716,7 @@ interface UntrustServerInput {
|
|
|
703
716
|
*
|
|
704
717
|
* @category Permissions
|
|
705
718
|
*/
|
|
706
|
-
interface AddAndTrustServerTypedData {
|
|
707
|
-
/** EIP-712 domain */
|
|
708
|
-
domain: PermissionGrantDomain;
|
|
719
|
+
interface AddAndTrustServerTypedData extends GenericTypedData {
|
|
709
720
|
/** EIP-712 types */
|
|
710
721
|
types: {
|
|
711
722
|
AddServer: Array<{
|
|
@@ -724,9 +735,7 @@ interface AddAndTrustServerTypedData {
|
|
|
724
735
|
* @category Permissions
|
|
725
736
|
* @deprecated Use AddAndTrustServerTypedData instead
|
|
726
737
|
*/
|
|
727
|
-
interface TrustServerTypedData {
|
|
728
|
-
/** EIP-712 domain */
|
|
729
|
-
domain: PermissionGrantDomain;
|
|
738
|
+
interface TrustServerTypedData extends GenericTypedData {
|
|
730
739
|
/** EIP-712 types */
|
|
731
740
|
types: {
|
|
732
741
|
TrustServer: Array<{
|
|
@@ -744,9 +753,7 @@ interface TrustServerTypedData {
|
|
|
744
753
|
*
|
|
745
754
|
* @category Permissions
|
|
746
755
|
*/
|
|
747
|
-
interface UntrustServerTypedData {
|
|
748
|
-
/** EIP-712 domain */
|
|
749
|
-
domain: PermissionGrantDomain;
|
|
756
|
+
interface UntrustServerTypedData extends GenericTypedData {
|
|
750
757
|
/** EIP-712 types */
|
|
751
758
|
types: {
|
|
752
759
|
UntrustServer: Array<{
|
|
@@ -903,7 +910,7 @@ interface RegisterGranteeParams {
|
|
|
903
910
|
*
|
|
904
911
|
* @category Permissions
|
|
905
912
|
*/
|
|
906
|
-
interface RegisterGranteeInput extends
|
|
913
|
+
interface RegisterGranteeInput extends RecordCompatible {
|
|
907
914
|
/** User nonce */
|
|
908
915
|
nonce: bigint;
|
|
909
916
|
/** Grantee owner address */
|
|
@@ -918,9 +925,7 @@ interface RegisterGranteeInput extends Record<string, unknown> {
|
|
|
918
925
|
*
|
|
919
926
|
* @category Permissions
|
|
920
927
|
*/
|
|
921
|
-
interface RegisterGranteeTypedData {
|
|
922
|
-
/** EIP-712 domain */
|
|
923
|
-
domain: PermissionGrantDomain;
|
|
928
|
+
interface RegisterGranteeTypedData extends GenericTypedData {
|
|
924
929
|
/** EIP-712 types */
|
|
925
930
|
types: {
|
|
926
931
|
RegisterGrantee: Array<{
|
|
@@ -986,6 +991,8 @@ interface ServerFilesAndPermissionParams {
|
|
|
986
991
|
grant: string;
|
|
987
992
|
/** File URLs */
|
|
988
993
|
fileUrls: string[];
|
|
994
|
+
/** Schema IDs for each file - use 0 for files without schema validation */
|
|
995
|
+
schemaIds: number[];
|
|
989
996
|
/** Server address */
|
|
990
997
|
serverAddress: Address;
|
|
991
998
|
/** Server URL */
|
|
@@ -1011,6 +1018,8 @@ interface ServerFilesAndPermissionTypedData extends GenericTypedData {
|
|
|
1011
1018
|
grant: string;
|
|
1012
1019
|
/** File URLs */
|
|
1013
1020
|
fileUrls: string[];
|
|
1021
|
+
/** Schema IDs for each file - use 0 for files without schema validation */
|
|
1022
|
+
schemaIds: bigint[];
|
|
1014
1023
|
/** Server address */
|
|
1015
1024
|
serverAddress: Address;
|
|
1016
1025
|
/** Server URL */
|
|
@@ -1750,6 +1759,12 @@ interface UserFile$1 {
|
|
|
1750
1759
|
transactionHash?: Address;
|
|
1751
1760
|
/** Additional file properties and custom application data. */
|
|
1752
1761
|
metadata?: FileMetadata;
|
|
1762
|
+
/**
|
|
1763
|
+
* Array of DLP IDs that have submitted proofs for this file.
|
|
1764
|
+
* Each proof represents verification or processing by a Data Liquidity Pool.
|
|
1765
|
+
* Obtain DLP details via `vana.data.getDLP(dlpId)`.
|
|
1766
|
+
*/
|
|
1767
|
+
dlpIds?: number[];
|
|
1753
1768
|
}
|
|
1754
1769
|
/**
|
|
1755
1770
|
* Provides optional metadata for uploaded files and content description.
|
|
@@ -2161,33 +2176,84 @@ interface BatchUploadResult {
|
|
|
2161
2176
|
errors?: string[];
|
|
2162
2177
|
}
|
|
2163
2178
|
/**
|
|
2164
|
-
*
|
|
2179
|
+
* Schema metadata from the blockchain (without fetched definition).
|
|
2180
|
+
*
|
|
2181
|
+
* This represents the on-chain schema registration data before the
|
|
2182
|
+
* definition has been fetched from the storage URL.
|
|
2183
|
+
*
|
|
2184
|
+
* @category Data Management
|
|
2185
|
+
*/
|
|
2186
|
+
interface SchemaMetadata {
|
|
2187
|
+
/** Schema ID */
|
|
2188
|
+
id: number;
|
|
2189
|
+
/** Schema name */
|
|
2190
|
+
name: string;
|
|
2191
|
+
/** Schema dialect ('json' or 'sqlite') */
|
|
2192
|
+
dialect: "json" | "sqlite";
|
|
2193
|
+
/** URL containing the schema definition */
|
|
2194
|
+
definitionUrl: string;
|
|
2195
|
+
}
|
|
2196
|
+
/**
|
|
2197
|
+
* Complete schema with all definition fields populated.
|
|
2198
|
+
* This is what schemas.get() returns - a schema with the definition fetched.
|
|
2199
|
+
*/
|
|
2200
|
+
interface CompleteSchema extends SchemaMetadata {
|
|
2201
|
+
/** Version of the schema */
|
|
2202
|
+
version: string;
|
|
2203
|
+
/** Optional description of the schema */
|
|
2204
|
+
description?: string;
|
|
2205
|
+
/** Optional version of the dialect */
|
|
2206
|
+
dialectVersion?: string;
|
|
2207
|
+
/** The actual schema - JSON Schema object for 'json' dialect, DDL string for 'sqlite' */
|
|
2208
|
+
schema: object | string;
|
|
2209
|
+
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Schema with optional definition fields.
|
|
2165
2212
|
*
|
|
2166
2213
|
* Schemas define the structure and validation rules for user data processed by refiners.
|
|
2167
2214
|
* They ensure data quality and consistency across the Vana network by specifying how
|
|
2168
2215
|
* raw user data should be formatted, validated, and processed.
|
|
2169
2216
|
*
|
|
2217
|
+
* When the definition has been fetched (via schemas.get() or schemas.list() with includeDefinitions),
|
|
2218
|
+
* the version and schema fields will be populated. Otherwise, only the metadata fields are present.
|
|
2219
|
+
*
|
|
2170
2220
|
* @category Data Management
|
|
2171
2221
|
* @example
|
|
2172
2222
|
* ```typescript
|
|
2173
|
-
*
|
|
2223
|
+
* // Complete schema from schemas.get()
|
|
2224
|
+
* const completeSchema: Schema = {
|
|
2174
2225
|
* id: 5,
|
|
2175
2226
|
* name: 'Social Media Profile',
|
|
2176
|
-
*
|
|
2177
|
-
*
|
|
2178
|
-
*
|
|
2227
|
+
* dialect: 'json',
|
|
2228
|
+
* definitionUrl: 'ipfs://QmSchema...',
|
|
2229
|
+
* version: '1.0.0',
|
|
2230
|
+
* description: 'Schema for validating social media profile data',
|
|
2231
|
+
* schema: { // JSON Schema object
|
|
2232
|
+
* type: 'object',
|
|
2233
|
+
* properties: {
|
|
2234
|
+
* username: { type: 'string' }
|
|
2235
|
+
* }
|
|
2236
|
+
* }
|
|
2237
|
+
* };
|
|
2238
|
+
*
|
|
2239
|
+
* // Metadata-only schema from schemas.list() without includeDefinitions
|
|
2240
|
+
* const metadataSchema: Schema = {
|
|
2241
|
+
* id: 5,
|
|
2242
|
+
* name: 'Social Media Profile',
|
|
2243
|
+
* dialect: 'json',
|
|
2244
|
+
* definitionUrl: 'ipfs://QmSchema...'
|
|
2179
2245
|
* };
|
|
2180
2246
|
* ```
|
|
2181
2247
|
*/
|
|
2182
|
-
interface Schema {
|
|
2183
|
-
/**
|
|
2184
|
-
|
|
2185
|
-
/**
|
|
2186
|
-
|
|
2187
|
-
/**
|
|
2188
|
-
|
|
2189
|
-
/**
|
|
2190
|
-
|
|
2248
|
+
interface Schema extends SchemaMetadata {
|
|
2249
|
+
/** Version of the schema (present when definition is fetched) */
|
|
2250
|
+
version?: string;
|
|
2251
|
+
/** Optional description of the schema */
|
|
2252
|
+
description?: string;
|
|
2253
|
+
/** Optional version of the dialect */
|
|
2254
|
+
dialectVersion?: string;
|
|
2255
|
+
/** The actual schema - JSON Schema object for 'json' dialect, DDL string for 'sqlite' (present when definition is fetched) */
|
|
2256
|
+
schema?: object | string;
|
|
2191
2257
|
}
|
|
2192
2258
|
/**
|
|
2193
2259
|
* Represents a refiner with schema information
|
|
@@ -2216,8 +2282,8 @@ interface Refiner {
|
|
|
2216
2282
|
interface AddSchemaParams {
|
|
2217
2283
|
/** Schema name */
|
|
2218
2284
|
name: string;
|
|
2219
|
-
/** Schema
|
|
2220
|
-
|
|
2285
|
+
/** Schema dialect */
|
|
2286
|
+
dialect: string;
|
|
2221
2287
|
/** URL containing the schema definition */
|
|
2222
2288
|
definitionUrl: string;
|
|
2223
2289
|
}
|
|
@@ -2292,13 +2358,7 @@ interface UpdateSchemaIdResult {
|
|
|
2292
2358
|
transactionHash: Hash;
|
|
2293
2359
|
}
|
|
2294
2360
|
/**
|
|
2295
|
-
*
|
|
2296
|
-
*
|
|
2297
|
-
* @category Data Management
|
|
2298
|
-
*/
|
|
2299
|
-
type TrustedServerQueryMode = "subgraph" | "rpc" | "auto";
|
|
2300
|
-
/**
|
|
2301
|
-
* Trusted server data structure (unified format for both subgraph and RPC modes)
|
|
2361
|
+
* Trusted server data structure
|
|
2302
2362
|
*
|
|
2303
2363
|
* @category Data Management
|
|
2304
2364
|
*/
|
|
@@ -2317,39 +2377,20 @@ interface TrustedServer {
|
|
|
2317
2377
|
trustIndex?: number;
|
|
2318
2378
|
}
|
|
2319
2379
|
/**
|
|
2320
|
-
* Parameters for getUserTrustedServers
|
|
2380
|
+
* Parameters for getUserTrustedServers method
|
|
2321
2381
|
*
|
|
2322
2382
|
* @category Data Management
|
|
2323
2383
|
*/
|
|
2324
2384
|
interface GetUserTrustedServersParams {
|
|
2325
|
-
/** User address to query */
|
|
2385
|
+
/** User address to query trusted servers for */
|
|
2326
2386
|
user: Address;
|
|
2327
|
-
/**
|
|
2328
|
-
mode?: TrustedServerQueryMode;
|
|
2329
|
-
/** Subgraph URL (required for subgraph mode) */
|
|
2387
|
+
/** Optional subgraph URL to override default */
|
|
2330
2388
|
subgraphUrl?: string;
|
|
2331
|
-
/**
|
|
2389
|
+
/** Maximum number of results */
|
|
2332
2390
|
limit?: number;
|
|
2333
|
-
/**
|
|
2391
|
+
/** Number of results to skip */
|
|
2334
2392
|
offset?: number;
|
|
2335
2393
|
}
|
|
2336
|
-
/**
|
|
2337
|
-
* Result of getUserTrustedServers query
|
|
2338
|
-
*
|
|
2339
|
-
* @category Data Management
|
|
2340
|
-
*/
|
|
2341
|
-
interface GetUserTrustedServersResult {
|
|
2342
|
-
/** Array of trusted servers */
|
|
2343
|
-
servers: TrustedServer[];
|
|
2344
|
-
/** Query mode that was actually used */
|
|
2345
|
-
usedMode: TrustedServerQueryMode;
|
|
2346
|
-
/** Total count (only available in RPC mode) */
|
|
2347
|
-
total?: number;
|
|
2348
|
-
/** Whether there are more servers (pagination info for RPC mode) */
|
|
2349
|
-
hasMore?: boolean;
|
|
2350
|
-
/** Any warnings or fallback information */
|
|
2351
|
-
warnings?: string[];
|
|
2352
|
-
}
|
|
2353
2394
|
|
|
2354
2395
|
declare const contractAbis: {
|
|
2355
2396
|
readonly DataPortabilityPermissions: readonly [{
|
|
@@ -2468,6 +2509,18 @@ declare const contractAbis: {
|
|
|
2468
2509
|
}];
|
|
2469
2510
|
readonly name: "InvalidPermissionsLength";
|
|
2470
2511
|
readonly type: "error";
|
|
2512
|
+
}, {
|
|
2513
|
+
readonly inputs: readonly [{
|
|
2514
|
+
readonly internalType: "uint256";
|
|
2515
|
+
readonly name: "filesLength";
|
|
2516
|
+
readonly type: "uint256";
|
|
2517
|
+
}, {
|
|
2518
|
+
readonly internalType: "uint256";
|
|
2519
|
+
readonly name: "schemaIdsLength";
|
|
2520
|
+
readonly type: "uint256";
|
|
2521
|
+
}];
|
|
2522
|
+
readonly name: "InvalidSchemaIdsLength";
|
|
2523
|
+
readonly type: "error";
|
|
2471
2524
|
}, {
|
|
2472
2525
|
readonly inputs: readonly [];
|
|
2473
2526
|
readonly name: "InvalidSignature";
|
|
@@ -2744,6 +2797,10 @@ declare const contractAbis: {
|
|
|
2744
2797
|
readonly internalType: "string[]";
|
|
2745
2798
|
readonly name: "fileUrls";
|
|
2746
2799
|
readonly type: "string[]";
|
|
2800
|
+
}, {
|
|
2801
|
+
readonly internalType: "uint256[]";
|
|
2802
|
+
readonly name: "schemaIds";
|
|
2803
|
+
readonly type: "uint256[]";
|
|
2747
2804
|
}, {
|
|
2748
2805
|
readonly internalType: "address";
|
|
2749
2806
|
readonly name: "serverAddress";
|
|
@@ -3726,7 +3783,7 @@ declare const contractAbis: {
|
|
|
3726
3783
|
readonly name: "addServerInput";
|
|
3727
3784
|
readonly type: "tuple";
|
|
3728
3785
|
}];
|
|
3729
|
-
readonly name: "
|
|
3786
|
+
readonly name: "addAndTrustServerByManager";
|
|
3730
3787
|
readonly outputs: readonly [];
|
|
3731
3788
|
readonly stateMutability: "nonpayable";
|
|
3732
3789
|
readonly type: "function";
|
|
@@ -4114,6 +4171,20 @@ declare const contractAbis: {
|
|
|
4114
4171
|
readonly outputs: readonly [];
|
|
4115
4172
|
readonly stateMutability: "nonpayable";
|
|
4116
4173
|
readonly type: "function";
|
|
4174
|
+
}, {
|
|
4175
|
+
readonly inputs: readonly [{
|
|
4176
|
+
readonly internalType: "address";
|
|
4177
|
+
readonly name: "userAddress";
|
|
4178
|
+
readonly type: "address";
|
|
4179
|
+
}, {
|
|
4180
|
+
readonly internalType: "uint256";
|
|
4181
|
+
readonly name: "serverId";
|
|
4182
|
+
readonly type: "uint256";
|
|
4183
|
+
}];
|
|
4184
|
+
readonly name: "trustServerByManager";
|
|
4185
|
+
readonly outputs: readonly [];
|
|
4186
|
+
readonly stateMutability: "nonpayable";
|
|
4187
|
+
readonly type: "function";
|
|
4117
4188
|
}, {
|
|
4118
4189
|
readonly inputs: readonly [{
|
|
4119
4190
|
readonly components: readonly [{
|
|
@@ -5172,6 +5243,31 @@ declare const contractAbis: {
|
|
|
5172
5243
|
}];
|
|
5173
5244
|
readonly name: "FileAdded";
|
|
5174
5245
|
readonly type: "event";
|
|
5246
|
+
}, {
|
|
5247
|
+
readonly anonymous: false;
|
|
5248
|
+
readonly inputs: readonly [{
|
|
5249
|
+
readonly indexed: true;
|
|
5250
|
+
readonly internalType: "uint256";
|
|
5251
|
+
readonly name: "fileId";
|
|
5252
|
+
readonly type: "uint256";
|
|
5253
|
+
}, {
|
|
5254
|
+
readonly indexed: true;
|
|
5255
|
+
readonly internalType: "address";
|
|
5256
|
+
readonly name: "ownerAddress";
|
|
5257
|
+
readonly type: "address";
|
|
5258
|
+
}, {
|
|
5259
|
+
readonly indexed: false;
|
|
5260
|
+
readonly internalType: "string";
|
|
5261
|
+
readonly name: "url";
|
|
5262
|
+
readonly type: "string";
|
|
5263
|
+
}, {
|
|
5264
|
+
readonly indexed: false;
|
|
5265
|
+
readonly internalType: "uint256";
|
|
5266
|
+
readonly name: "schemaId";
|
|
5267
|
+
readonly type: "uint256";
|
|
5268
|
+
}];
|
|
5269
|
+
readonly name: "FileAddedV2";
|
|
5270
|
+
readonly type: "event";
|
|
5175
5271
|
}, {
|
|
5176
5272
|
readonly anonymous: false;
|
|
5177
5273
|
readonly inputs: readonly [{
|
|
@@ -5362,6 +5458,16 @@ declare const contractAbis: {
|
|
|
5362
5458
|
}];
|
|
5363
5459
|
readonly name: "Upgraded";
|
|
5364
5460
|
readonly type: "event";
|
|
5461
|
+
}, {
|
|
5462
|
+
readonly inputs: readonly [];
|
|
5463
|
+
readonly name: "DATA_PORTABILITY_ROLE";
|
|
5464
|
+
readonly outputs: readonly [{
|
|
5465
|
+
readonly internalType: "bytes32";
|
|
5466
|
+
readonly name: "";
|
|
5467
|
+
readonly type: "bytes32";
|
|
5468
|
+
}];
|
|
5469
|
+
readonly stateMutability: "view";
|
|
5470
|
+
readonly type: "function";
|
|
5365
5471
|
}, {
|
|
5366
5472
|
readonly inputs: readonly [];
|
|
5367
5473
|
readonly name: "DEFAULT_ADMIN_ROLE";
|
|
@@ -5434,6 +5540,33 @@ declare const contractAbis: {
|
|
|
5434
5540
|
readonly outputs: readonly [];
|
|
5435
5541
|
readonly stateMutability: "nonpayable";
|
|
5436
5542
|
readonly type: "function";
|
|
5543
|
+
}, {
|
|
5544
|
+
readonly inputs: readonly [{
|
|
5545
|
+
readonly internalType: "uint256";
|
|
5546
|
+
readonly name: "fileId";
|
|
5547
|
+
readonly type: "uint256";
|
|
5548
|
+
}, {
|
|
5549
|
+
readonly components: readonly [{
|
|
5550
|
+
readonly internalType: "address";
|
|
5551
|
+
readonly name: "account";
|
|
5552
|
+
readonly type: "address";
|
|
5553
|
+
}, {
|
|
5554
|
+
readonly internalType: "string";
|
|
5555
|
+
readonly name: "key";
|
|
5556
|
+
readonly type: "string";
|
|
5557
|
+
}];
|
|
5558
|
+
readonly internalType: "struct IDataRegistry.Permission[]";
|
|
5559
|
+
readonly name: "permissions";
|
|
5560
|
+
readonly type: "tuple[]";
|
|
5561
|
+
}, {
|
|
5562
|
+
readonly internalType: "uint256";
|
|
5563
|
+
readonly name: "schemaId";
|
|
5564
|
+
readonly type: "uint256";
|
|
5565
|
+
}];
|
|
5566
|
+
readonly name: "addFilePermissionsAndSchema";
|
|
5567
|
+
readonly outputs: readonly [];
|
|
5568
|
+
readonly stateMutability: "nonpayable";
|
|
5569
|
+
readonly type: "function";
|
|
5437
5570
|
}, {
|
|
5438
5571
|
readonly inputs: readonly [{
|
|
5439
5572
|
readonly internalType: "string";
|
|
@@ -5598,6 +5731,16 @@ declare const contractAbis: {
|
|
|
5598
5731
|
}];
|
|
5599
5732
|
readonly stateMutability: "view";
|
|
5600
5733
|
readonly type: "function";
|
|
5734
|
+
}, {
|
|
5735
|
+
readonly inputs: readonly [];
|
|
5736
|
+
readonly name: "emitLegacyEvents";
|
|
5737
|
+
readonly outputs: readonly [{
|
|
5738
|
+
readonly internalType: "bool";
|
|
5739
|
+
readonly name: "";
|
|
5740
|
+
readonly type: "bool";
|
|
5741
|
+
}];
|
|
5742
|
+
readonly stateMutability: "view";
|
|
5743
|
+
readonly type: "function";
|
|
5601
5744
|
}, {
|
|
5602
5745
|
readonly inputs: readonly [{
|
|
5603
5746
|
readonly internalType: "string";
|
|
@@ -5716,6 +5859,10 @@ declare const contractAbis: {
|
|
|
5716
5859
|
readonly internalType: "string";
|
|
5717
5860
|
readonly name: "url";
|
|
5718
5861
|
readonly type: "string";
|
|
5862
|
+
}, {
|
|
5863
|
+
readonly internalType: "uint256";
|
|
5864
|
+
readonly name: "schemaId";
|
|
5865
|
+
readonly type: "uint256";
|
|
5719
5866
|
}, {
|
|
5720
5867
|
readonly internalType: "uint256";
|
|
5721
5868
|
readonly name: "addedAtBlock";
|
|
@@ -5933,6 +6080,16 @@ declare const contractAbis: {
|
|
|
5933
6080
|
readonly outputs: readonly [];
|
|
5934
6081
|
readonly stateMutability: "nonpayable";
|
|
5935
6082
|
readonly type: "function";
|
|
6083
|
+
}, {
|
|
6084
|
+
readonly inputs: readonly [{
|
|
6085
|
+
readonly internalType: "bool";
|
|
6086
|
+
readonly name: "newEmitLegacyEvents";
|
|
6087
|
+
readonly type: "bool";
|
|
6088
|
+
}];
|
|
6089
|
+
readonly name: "updateEmitLegacyEvents";
|
|
6090
|
+
readonly outputs: readonly [];
|
|
6091
|
+
readonly stateMutability: "nonpayable";
|
|
6092
|
+
readonly type: "function";
|
|
5936
6093
|
}, {
|
|
5937
6094
|
readonly inputs: readonly [{
|
|
5938
6095
|
readonly internalType: "address";
|
|
@@ -28737,6 +28894,95 @@ type VanaContract = keyof ContractAbis;
|
|
|
28737
28894
|
*/
|
|
28738
28895
|
declare function getAbi<T extends VanaContract>(contract: T): ContractAbis[T];
|
|
28739
28896
|
|
|
28897
|
+
/**
|
|
28898
|
+
* Comprehensive mapping of SDK transaction operations to blockchain events.
|
|
28899
|
+
* Used by the generic transaction parser to know which contract and event
|
|
28900
|
+
* to look for when parsing transaction results.
|
|
28901
|
+
*/
|
|
28902
|
+
declare const EVENT_MAPPINGS: {
|
|
28903
|
+
readonly grant: {
|
|
28904
|
+
readonly contract: "DataPortabilityPermissions";
|
|
28905
|
+
readonly event: "PermissionAdded";
|
|
28906
|
+
};
|
|
28907
|
+
readonly revoke: {
|
|
28908
|
+
readonly contract: "DataPortabilityPermissions";
|
|
28909
|
+
readonly event: "PermissionRevoked";
|
|
28910
|
+
};
|
|
28911
|
+
readonly revokePermission: {
|
|
28912
|
+
readonly contract: "DataPortabilityPermissions";
|
|
28913
|
+
readonly event: "PermissionRevoked";
|
|
28914
|
+
};
|
|
28915
|
+
readonly addServerFilesAndPermissions: {
|
|
28916
|
+
readonly contract: "DataPortabilityPermissions";
|
|
28917
|
+
readonly event: "PermissionAdded";
|
|
28918
|
+
};
|
|
28919
|
+
readonly trustServer: {
|
|
28920
|
+
readonly contract: "DataPortabilityServers";
|
|
28921
|
+
readonly event: "ServerTrusted";
|
|
28922
|
+
};
|
|
28923
|
+
readonly untrustServer: {
|
|
28924
|
+
readonly contract: "DataPortabilityServers";
|
|
28925
|
+
readonly event: "ServerUntrusted";
|
|
28926
|
+
};
|
|
28927
|
+
readonly registerServer: {
|
|
28928
|
+
readonly contract: "DataPortabilityServers";
|
|
28929
|
+
readonly event: "ServerRegistered";
|
|
28930
|
+
};
|
|
28931
|
+
readonly updateServer: {
|
|
28932
|
+
readonly contract: "DataPortabilityServers";
|
|
28933
|
+
readonly event: "ServerUpdated";
|
|
28934
|
+
};
|
|
28935
|
+
readonly addAndTrustServer: {
|
|
28936
|
+
readonly contract: "DataPortabilityServers";
|
|
28937
|
+
readonly event: "ServerTrusted";
|
|
28938
|
+
};
|
|
28939
|
+
readonly addFile: {
|
|
28940
|
+
readonly contract: "DataRegistry";
|
|
28941
|
+
readonly event: "FileAddedV2";
|
|
28942
|
+
};
|
|
28943
|
+
readonly addFileWithPermissionsAndSchema: {
|
|
28944
|
+
readonly contract: "DataRegistry";
|
|
28945
|
+
readonly event: "FileAddedV2";
|
|
28946
|
+
};
|
|
28947
|
+
readonly addFileWithSchema: {
|
|
28948
|
+
readonly contract: "DataRegistry";
|
|
28949
|
+
readonly event: "FileAddedV2";
|
|
28950
|
+
};
|
|
28951
|
+
readonly addFileWithPermissions: {
|
|
28952
|
+
readonly contract: "DataRegistry";
|
|
28953
|
+
readonly event: "FileAddedV2";
|
|
28954
|
+
};
|
|
28955
|
+
readonly addRefinement: {
|
|
28956
|
+
readonly contract: "DataRegistry";
|
|
28957
|
+
readonly event: "RefinementAdded";
|
|
28958
|
+
};
|
|
28959
|
+
readonly addRefiner: {
|
|
28960
|
+
readonly contract: "DataRefinerRegistry";
|
|
28961
|
+
readonly event: "RefinerAdded";
|
|
28962
|
+
};
|
|
28963
|
+
readonly updateSchemaId: {
|
|
28964
|
+
readonly contract: "DataRefinerRegistry";
|
|
28965
|
+
readonly event: "SchemaAdded";
|
|
28966
|
+
};
|
|
28967
|
+
readonly addSchema: {
|
|
28968
|
+
readonly contract: "DataRefinerRegistry";
|
|
28969
|
+
readonly event: "SchemaAdded";
|
|
28970
|
+
};
|
|
28971
|
+
readonly updateRefinement: {
|
|
28972
|
+
readonly contract: "DataRegistry";
|
|
28973
|
+
readonly event: "RefinementUpdated";
|
|
28974
|
+
};
|
|
28975
|
+
readonly addFilePermission: {
|
|
28976
|
+
readonly contract: "DataRegistry";
|
|
28977
|
+
readonly event: "PermissionGranted";
|
|
28978
|
+
};
|
|
28979
|
+
readonly registerGrantee: {
|
|
28980
|
+
readonly contract: "DataPortabilityGrantees";
|
|
28981
|
+
readonly event: "GranteeRegistered";
|
|
28982
|
+
};
|
|
28983
|
+
};
|
|
28984
|
+
type TransactionOperation = keyof typeof EVENT_MAPPINGS;
|
|
28985
|
+
|
|
28740
28986
|
/**
|
|
28741
28987
|
* Base interface for all transaction results.
|
|
28742
28988
|
* Contains the event data plus transaction metadata.
|
|
@@ -28774,6 +29020,50 @@ interface PermissionRevokeResult extends BaseTransactionResult {
|
|
|
28774
29020
|
/** ID of the permission that was revoked */
|
|
28775
29021
|
permissionId: bigint;
|
|
28776
29022
|
}
|
|
29023
|
+
/**
|
|
29024
|
+
* Result of a successful server trust operation.
|
|
29025
|
+
* Contains data from the ServerTrusted blockchain event.
|
|
29026
|
+
*/
|
|
29027
|
+
interface ServerTrustResult extends BaseTransactionResult {
|
|
29028
|
+
/** Address of the user who trusted the server */
|
|
29029
|
+
user: Address;
|
|
29030
|
+
/** Address/ID of the trusted server */
|
|
29031
|
+
serverId: Address;
|
|
29032
|
+
/** URL of the trusted server */
|
|
29033
|
+
serverUrl: string;
|
|
29034
|
+
}
|
|
29035
|
+
/**
|
|
29036
|
+
* Result of a successful server untrust operation.
|
|
29037
|
+
* Contains data from the ServerUntrusted blockchain event.
|
|
29038
|
+
*/
|
|
29039
|
+
interface ServerUntrustResult extends BaseTransactionResult {
|
|
29040
|
+
/** Address of the user who untrusted the server */
|
|
29041
|
+
user: Address;
|
|
29042
|
+
/** Address/ID of the untrusted server */
|
|
29043
|
+
serverId: Address;
|
|
29044
|
+
}
|
|
29045
|
+
/**
|
|
29046
|
+
* Result of a successful server update operation.
|
|
29047
|
+
* Contains data from the ServerUpdated blockchain event.
|
|
29048
|
+
*/
|
|
29049
|
+
interface ServerUpdateResult extends BaseTransactionResult {
|
|
29050
|
+
/** ID of the server that was updated */
|
|
29051
|
+
serverId: bigint;
|
|
29052
|
+
/** New URL of the server */
|
|
29053
|
+
url: string;
|
|
29054
|
+
}
|
|
29055
|
+
/**
|
|
29056
|
+
* Result of a successful grantee registration operation.
|
|
29057
|
+
* Contains data from the GranteeRegistered blockchain event.
|
|
29058
|
+
*/
|
|
29059
|
+
interface GranteeRegisterResult extends BaseTransactionResult {
|
|
29060
|
+
/** Unique grantee ID assigned by the registry */
|
|
29061
|
+
granteeId: bigint;
|
|
29062
|
+
/** Address of the registered grantee */
|
|
29063
|
+
granteeAddress: Address;
|
|
29064
|
+
/** Display name of the grantee */
|
|
29065
|
+
name: string;
|
|
29066
|
+
}
|
|
28777
29067
|
/**
|
|
28778
29068
|
* Result of a successful file permission addition operation.
|
|
28779
29069
|
* Contains data from the FilePermissionAdded blockchain event.
|
|
@@ -28787,6 +29077,80 @@ interface FilePermissionResult extends BaseTransactionResult {
|
|
|
28787
29077
|
encryptedKey: string;
|
|
28788
29078
|
}
|
|
28789
29079
|
|
|
29080
|
+
/**
|
|
29081
|
+
* Provides a unified interface for blockchain transaction results with lazy-loaded event parsing.
|
|
29082
|
+
*
|
|
29083
|
+
* @remarks
|
|
29084
|
+
* TransactionHandle enables immediate access to transaction hashes while providing optional
|
|
29085
|
+
* lazy-loaded access to receipts and parsed event data. All transaction-submitting methods
|
|
29086
|
+
* in the SDK return this handle, allowing developers to choose between immediate hash access
|
|
29087
|
+
* or waiting for event data. Results are memoized to prevent redundant network calls.
|
|
29088
|
+
*
|
|
29089
|
+
* @category Transactions
|
|
29090
|
+
* @example
|
|
29091
|
+
* ```typescript
|
|
29092
|
+
* // Immediate hash access
|
|
29093
|
+
* const tx = await sdk.permissions.submitSignedGrant(typedData, signature);
|
|
29094
|
+
* console.log(`Transaction submitted: ${tx.hash}`);
|
|
29095
|
+
*
|
|
29096
|
+
* // Wait for and parse events
|
|
29097
|
+
* const eventData = await tx.waitForEvents();
|
|
29098
|
+
* console.log(`Permission ID: ${eventData.permissionId}`);
|
|
29099
|
+
*
|
|
29100
|
+
* // Check receipt for gas usage
|
|
29101
|
+
* const receipt = await tx.waitForReceipt();
|
|
29102
|
+
* console.log(`Gas used: ${receipt.gasUsed}`);
|
|
29103
|
+
* ```
|
|
29104
|
+
*/
|
|
29105
|
+
declare class TransactionHandle<TEventData = unknown> {
|
|
29106
|
+
private readonly context;
|
|
29107
|
+
readonly hash: Hash;
|
|
29108
|
+
private readonly operation?;
|
|
29109
|
+
private _receipt?;
|
|
29110
|
+
private _eventData?;
|
|
29111
|
+
private _receiptPromise?;
|
|
29112
|
+
private _eventPromise?;
|
|
29113
|
+
constructor(context: ControllerContext$1, hash: Hash, operation?: TransactionOperation | undefined);
|
|
29114
|
+
/**
|
|
29115
|
+
* Waits for transaction confirmation and returns the receipt.
|
|
29116
|
+
* Results are memoized - multiple calls return the same promise.
|
|
29117
|
+
*
|
|
29118
|
+
* @param options Optional timeout configuration
|
|
29119
|
+
* @param options.timeout Timeout in milliseconds (default: 30000)
|
|
29120
|
+
* @returns Transaction receipt with gas usage, logs, and status
|
|
29121
|
+
*/
|
|
29122
|
+
waitForReceipt(options?: {
|
|
29123
|
+
timeout?: number;
|
|
29124
|
+
}): Promise<TransactionReceipt$1>;
|
|
29125
|
+
/**
|
|
29126
|
+
* Waits for transaction confirmation and parses emitted events.
|
|
29127
|
+
* Results are memoized - multiple calls return the same promise.
|
|
29128
|
+
*
|
|
29129
|
+
* @returns Parsed event data with transaction metadata
|
|
29130
|
+
* @throws {Error} If no operation was specified for event parsing
|
|
29131
|
+
*/
|
|
29132
|
+
waitForEvents(): Promise<TEventData>;
|
|
29133
|
+
/**
|
|
29134
|
+
* Enables string coercion for backwards compatibility.
|
|
29135
|
+
* Allows TransactionHandle to be used anywhere a Hash is expected.
|
|
29136
|
+
*
|
|
29137
|
+
* @example
|
|
29138
|
+
* ```typescript
|
|
29139
|
+
* const hash: Hash = tx; // Works via toString()
|
|
29140
|
+
* console.log(`Transaction: ${tx}`); // Prints hash
|
|
29141
|
+
* ```
|
|
29142
|
+
* @returns The transaction hash as a string
|
|
29143
|
+
*/
|
|
29144
|
+
toString(): string;
|
|
29145
|
+
/**
|
|
29146
|
+
* JSON serialization support.
|
|
29147
|
+
* Returns the hash when serialized to JSON.
|
|
29148
|
+
*
|
|
29149
|
+
* @returns The transaction hash for JSON serialization
|
|
29150
|
+
*/
|
|
29151
|
+
toJSON(): string;
|
|
29152
|
+
}
|
|
29153
|
+
|
|
28790
29154
|
/**
|
|
28791
29155
|
* Google Drive Storage Provider for Vana SDK
|
|
28792
29156
|
*
|
|
@@ -29825,30 +30189,31 @@ declare class PermissionsController {
|
|
|
29825
30189
|
*/
|
|
29826
30190
|
grant(params: GrantPermissionParams$1): Promise<PermissionGrantResult>;
|
|
29827
30191
|
/**
|
|
29828
|
-
* Submits a permission grant transaction and returns
|
|
30192
|
+
* Submits a permission grant transaction and returns a handle for flexible result access.
|
|
29829
30193
|
*
|
|
29830
|
-
*
|
|
29831
|
-
*
|
|
29832
|
-
*
|
|
30194
|
+
* @remarks
|
|
30195
|
+
* This lower-level method provides maximum control over transaction timing.
|
|
30196
|
+
* Returns a TransactionHandle that allows immediate hash access or optional event parsing.
|
|
30197
|
+
* Use this when handling multiple transactions or when you need granular control.
|
|
29833
30198
|
*
|
|
29834
30199
|
* @param params - The permission grant configuration object
|
|
29835
|
-
* @returns Promise
|
|
30200
|
+
* @returns Promise resolving to TransactionHandle with hash and event parsing capabilities
|
|
29836
30201
|
* @throws {RelayerError} When gasless transaction submission fails
|
|
29837
30202
|
* @throws {SignatureError} When user rejects the signature request
|
|
29838
30203
|
* @throws {SerializationError} When grant data cannot be serialized
|
|
29839
30204
|
* @throws {BlockchainError} When permission grant preparation fails
|
|
29840
30205
|
* @example
|
|
29841
30206
|
* ```typescript
|
|
29842
|
-
* // Submit transaction and
|
|
29843
|
-
* const
|
|
29844
|
-
* console.log(`Transaction submitted: ${
|
|
30207
|
+
* // Submit transaction and get immediate hash access
|
|
30208
|
+
* const tx = await vana.permissions.submitPermissionGrant(params);
|
|
30209
|
+
* console.log(`Transaction submitted: ${tx.hash}`);
|
|
29845
30210
|
*
|
|
29846
|
-
* //
|
|
29847
|
-
* const
|
|
29848
|
-
* console.log(`Permission ID: ${
|
|
30211
|
+
* // Optionally wait for and parse events
|
|
30212
|
+
* const eventData = await tx.waitForEvents();
|
|
30213
|
+
* console.log(`Permission ID: ${eventData.permissionId}`);
|
|
29849
30214
|
* ```
|
|
29850
30215
|
*/
|
|
29851
|
-
submitPermissionGrant(params: GrantPermissionParams$1): Promise<
|
|
30216
|
+
submitPermissionGrant(params: GrantPermissionParams$1): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
29852
30217
|
/**
|
|
29853
30218
|
* Prepares a permission grant with preview before signing.
|
|
29854
30219
|
*
|
|
@@ -29876,15 +30241,21 @@ declare class PermissionsController {
|
|
|
29876
30241
|
*/
|
|
29877
30242
|
prepareGrant(params: GrantPermissionParams$1): Promise<{
|
|
29878
30243
|
preview: GrantFile;
|
|
29879
|
-
confirm: () => Promise<
|
|
30244
|
+
confirm: () => Promise<TransactionHandle<PermissionGrantResult>>;
|
|
29880
30245
|
}>;
|
|
29881
30246
|
/**
|
|
29882
|
-
*
|
|
29883
|
-
*
|
|
30247
|
+
* Completes the grant process after user confirmation.
|
|
30248
|
+
*
|
|
30249
|
+
* @remarks
|
|
30250
|
+
* This internal method is called by the confirm() function returned from prepareGrant().
|
|
30251
|
+
* It handles IPFS upload, signature creation, and transaction submission.
|
|
29884
30252
|
*
|
|
29885
30253
|
* @param params - The permission grant parameters containing user and operation details
|
|
29886
30254
|
* @param grantFile - The prepared grant file with permissions and metadata
|
|
29887
|
-
* @returns Promise resolving to
|
|
30255
|
+
* @returns Promise resolving to TransactionHandle for flexible result access
|
|
30256
|
+
* @throws {BlockchainError} When permission grant confirmation fails
|
|
30257
|
+
* @throws {NetworkError} When IPFS upload fails
|
|
30258
|
+
* @throws {SignatureError} When user rejects the signature
|
|
29888
30259
|
*/
|
|
29889
30260
|
private confirmGrantInternal;
|
|
29890
30261
|
/**
|
|
@@ -29940,49 +30311,106 @@ declare class PermissionsController {
|
|
|
29940
30311
|
* );
|
|
29941
30312
|
* ```
|
|
29942
30313
|
*/
|
|
29943
|
-
submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<
|
|
30314
|
+
submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
29944
30315
|
/**
|
|
29945
30316
|
* Submits an already-signed trust server transaction to the blockchain.
|
|
30317
|
+
*
|
|
30318
|
+
* @remarks
|
|
29946
30319
|
* This method extracts the trust server input from typed data and submits it directly.
|
|
30320
|
+
* Used internally by trust server methods after signature collection.
|
|
29947
30321
|
*
|
|
29948
30322
|
* @param typedData - The EIP-712 typed data for TrustServer
|
|
29949
|
-
* @param signature - The user's signature
|
|
29950
|
-
* @returns Promise resolving to
|
|
30323
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
30324
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30325
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30326
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
30327
|
+
* @example
|
|
30328
|
+
* ```typescript
|
|
30329
|
+
* const txHandle = await vana.permissions.submitSignedTrustServer(
|
|
30330
|
+
* typedData,
|
|
30331
|
+
* "0x1234..."
|
|
30332
|
+
* );
|
|
30333
|
+
* const result = await txHandle.waitForEvents();
|
|
30334
|
+
* ```
|
|
29951
30335
|
*/
|
|
29952
|
-
submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<
|
|
30336
|
+
submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
|
|
29953
30337
|
/**
|
|
29954
30338
|
* Submits an already-signed add and trust server transaction to the blockchain.
|
|
30339
|
+
*
|
|
30340
|
+
* @remarks
|
|
29955
30341
|
* This method extracts the add and trust server input from typed data and submits it directly.
|
|
30342
|
+
* Combines server registration and trust operations in a single transaction.
|
|
29956
30343
|
*
|
|
29957
30344
|
* @param typedData - The EIP-712 typed data for AddAndTrustServer
|
|
29958
|
-
* @param signature - The user's signature
|
|
29959
|
-
* @returns Promise resolving to
|
|
30345
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
30346
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30347
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30348
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
30349
|
+
* @example
|
|
30350
|
+
* ```typescript
|
|
30351
|
+
* const txHandle = await vana.permissions.submitSignedAddAndTrustServer(
|
|
30352
|
+
* typedData,
|
|
30353
|
+
* "0x1234..."
|
|
30354
|
+
* );
|
|
30355
|
+
* const result = await txHandle.waitForEvents();
|
|
30356
|
+
* ```
|
|
29960
30357
|
*/
|
|
29961
|
-
submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<
|
|
30358
|
+
submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
|
|
29962
30359
|
/**
|
|
29963
30360
|
* Submits an already-signed permission revoke transaction to the blockchain.
|
|
30361
|
+
*
|
|
30362
|
+
* @remarks
|
|
29964
30363
|
* This method handles the revocation of previously granted permissions.
|
|
30364
|
+
* Used internally by revocation methods after signature collection.
|
|
29965
30365
|
*
|
|
29966
30366
|
* @param typedData - The EIP-712 typed data for PermissionRevoke
|
|
29967
|
-
* @param signature - The user's signature
|
|
29968
|
-
* @returns Promise resolving to
|
|
30367
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
30368
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30369
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30370
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
30371
|
+
* @example
|
|
30372
|
+
* ```typescript
|
|
30373
|
+
* const txHandle = await vana.permissions.submitSignedRevoke(
|
|
30374
|
+
* typedData,
|
|
30375
|
+
* "0x1234..."
|
|
30376
|
+
* );
|
|
30377
|
+
* const result = await txHandle.waitForEvents();
|
|
30378
|
+
* ```
|
|
29969
30379
|
*/
|
|
29970
|
-
submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<
|
|
30380
|
+
submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionRevokeResult>>;
|
|
29971
30381
|
/**
|
|
29972
30382
|
* Submits an already-signed untrust server transaction to the blockchain.
|
|
30383
|
+
*
|
|
30384
|
+
* @remarks
|
|
29973
30385
|
* This method handles the removal of trusted servers.
|
|
30386
|
+
* Used internally by untrust server methods after signature collection.
|
|
29974
30387
|
*
|
|
29975
30388
|
* @param typedData - The EIP-712 typed data for UntrustServer
|
|
29976
|
-
* @param signature - The user's signature
|
|
29977
|
-
* @returns Promise resolving to
|
|
30389
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
30390
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30391
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30392
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
30393
|
+
* @example
|
|
30394
|
+
* ```typescript
|
|
30395
|
+
* const txHandle = await vana.permissions.submitSignedUntrustServer(
|
|
30396
|
+
* typedData,
|
|
30397
|
+
* "0x1234..."
|
|
30398
|
+
* );
|
|
30399
|
+
* const result = await txHandle.waitForEvents();
|
|
30400
|
+
* ```
|
|
29978
30401
|
*/
|
|
29979
|
-
submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<
|
|
30402
|
+
submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<ServerUntrustResult>>;
|
|
29980
30403
|
/**
|
|
29981
30404
|
* Submits a signed transaction directly to the blockchain.
|
|
29982
30405
|
*
|
|
30406
|
+
* @remarks
|
|
30407
|
+
* Internal method used when relayer callbacks are not available. Formats the signature
|
|
30408
|
+
* and submits the permission grant directly to the smart contract.
|
|
30409
|
+
*
|
|
29983
30410
|
* @param typedData - The typed data structure for the permission grant
|
|
29984
30411
|
* @param signature - The cryptographic signature authorizing the transaction
|
|
29985
30412
|
* @returns Promise resolving to the transaction hash
|
|
30413
|
+
* @throws {BlockchainError} When contract submission fails
|
|
29986
30414
|
*/
|
|
29987
30415
|
private submitDirectTransaction;
|
|
29988
30416
|
/**
|
|
@@ -30029,19 +30457,33 @@ declare class PermissionsController {
|
|
|
30029
30457
|
* console.log(`Revocation submitted: ${txHash}`);
|
|
30030
30458
|
* ```
|
|
30031
30459
|
*/
|
|
30032
|
-
submitPermissionRevoke(params: RevokePermissionParams): Promise<
|
|
30460
|
+
submitPermissionRevoke(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
|
|
30033
30461
|
/**
|
|
30034
|
-
* Revokes a permission with a signature
|
|
30462
|
+
* Revokes a permission with a signature for gasless transactions.
|
|
30463
|
+
*
|
|
30464
|
+
* @remarks
|
|
30465
|
+
* This method creates an EIP-712 signature for permission revocation and submits
|
|
30466
|
+
* it either through relayer callbacks or directly to the blockchain. Provides
|
|
30467
|
+
* gasless revocation when relayer is configured.
|
|
30035
30468
|
*
|
|
30036
30469
|
* @param params - Parameters for revoking the permission
|
|
30037
|
-
* @
|
|
30470
|
+
* @param params.permissionId - Permission identifier to revoke (accepts bigint, number, or string)
|
|
30471
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30038
30472
|
* @throws {BlockchainError} When chain ID is not available
|
|
30039
30473
|
* @throws {NonceError} When retrieving user nonce fails
|
|
30040
30474
|
* @throws {SignatureError} When user rejects the signature request
|
|
30041
30475
|
* @throws {RelayerError} When gasless submission fails
|
|
30042
30476
|
* @throws {PermissionError} When revocation fails for any other reason
|
|
30477
|
+
* @example
|
|
30478
|
+
* ```typescript
|
|
30479
|
+
* const txHandle = await vana.permissions.submitRevokeWithSignature({
|
|
30480
|
+
* permissionId: 123n
|
|
30481
|
+
* });
|
|
30482
|
+
* const result = await txHandle.waitForEvents();
|
|
30483
|
+
* console.log(`Permission ${result.permissionId} revoked`);
|
|
30484
|
+
* ```
|
|
30043
30485
|
*/
|
|
30044
|
-
submitRevokeWithSignature(params: RevokePermissionParams): Promise<
|
|
30486
|
+
submitRevokeWithSignature(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
|
|
30045
30487
|
/**
|
|
30046
30488
|
* @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
|
|
30047
30489
|
*
|
|
@@ -30066,6 +30508,18 @@ declare class PermissionsController {
|
|
|
30066
30508
|
* const serversNonce = await this.getServersUserNonce();
|
|
30067
30509
|
* ```
|
|
30068
30510
|
*/
|
|
30511
|
+
/**
|
|
30512
|
+
* @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
|
|
30513
|
+
*
|
|
30514
|
+
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
30515
|
+
*
|
|
30516
|
+
* @remarks
|
|
30517
|
+
* This method is deprecated in favor of more specific nonce methods that target
|
|
30518
|
+
* the appropriate contract for the operation being performed.
|
|
30519
|
+
*
|
|
30520
|
+
* @returns Promise resolving to the user's current nonce as a bigint
|
|
30521
|
+
* @throws {NonceError} When retrieving the nonce fails
|
|
30522
|
+
*/
|
|
30069
30523
|
private getUserNonce;
|
|
30070
30524
|
/**
|
|
30071
30525
|
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
@@ -30081,6 +30535,16 @@ declare class PermissionsController {
|
|
|
30081
30535
|
* console.log(`Current servers nonce: ${nonce}`);
|
|
30082
30536
|
* ```
|
|
30083
30537
|
*/
|
|
30538
|
+
/**
|
|
30539
|
+
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
30540
|
+
*
|
|
30541
|
+
* @remarks
|
|
30542
|
+
* Used for server-related operations (trust/untrust) to prevent replay attacks.
|
|
30543
|
+
* The nonce must be incremented with each server operation.
|
|
30544
|
+
*
|
|
30545
|
+
* @returns Promise resolving to the user's current nonce as a bigint
|
|
30546
|
+
* @throws {NonceError} When retrieving the nonce fails
|
|
30547
|
+
*/
|
|
30084
30548
|
private getServersUserNonce;
|
|
30085
30549
|
/**
|
|
30086
30550
|
* Retrieves the user's current nonce from the DataPortabilityPermissions contract.
|
|
@@ -30096,6 +30560,16 @@ declare class PermissionsController {
|
|
|
30096
30560
|
* console.log(`Current permissions nonce: ${nonce}`);
|
|
30097
30561
|
* ```
|
|
30098
30562
|
*/
|
|
30563
|
+
/**
|
|
30564
|
+
* Retrieves the user's current nonce from the DataPortabilityPermissions contract.
|
|
30565
|
+
*
|
|
30566
|
+
* @remarks
|
|
30567
|
+
* Used for permission-related operations (grant/revoke) to prevent replay attacks.
|
|
30568
|
+
* The nonce must be incremented with each permission operation.
|
|
30569
|
+
*
|
|
30570
|
+
* @returns Promise resolving to the user's current nonce as a bigint
|
|
30571
|
+
* @throws {NonceError} When retrieving the nonce fails
|
|
30572
|
+
*/
|
|
30099
30573
|
private getPermissionsUserNonce;
|
|
30100
30574
|
/**
|
|
30101
30575
|
* Composes the EIP-712 typed data for PermissionGrant (new simplified format).
|
|
@@ -30117,6 +30591,7 @@ declare class PermissionsController {
|
|
|
30117
30591
|
* @param params.granteeId - Grantee ID
|
|
30118
30592
|
* @param params.grant - Grant URL or grant data
|
|
30119
30593
|
* @param params.fileUrls - Array of file URLs
|
|
30594
|
+
* @param params.schemaIds - Schema IDs for each file
|
|
30120
30595
|
* @param params.serverAddress - Server address
|
|
30121
30596
|
* @param params.serverUrl - Server URL
|
|
30122
30597
|
* @param params.serverPublicKey - Server public key
|
|
@@ -30222,7 +30697,7 @@ declare class PermissionsController {
|
|
|
30222
30697
|
* console.log('Now trusting servers:', trustedServers);
|
|
30223
30698
|
* ```
|
|
30224
30699
|
*/
|
|
30225
|
-
addAndTrustServer(params: AddAndTrustServerParams): Promise<
|
|
30700
|
+
addAndTrustServer(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
|
|
30226
30701
|
/**
|
|
30227
30702
|
* Trusts a server for data processing (legacy method).
|
|
30228
30703
|
*
|
|
@@ -30230,14 +30705,14 @@ declare class PermissionsController {
|
|
|
30230
30705
|
* @returns Promise resolving to transaction hash
|
|
30231
30706
|
* @deprecated Use addAndTrustServer instead
|
|
30232
30707
|
*/
|
|
30233
|
-
submitTrustServer(params: TrustServerParams): Promise<
|
|
30708
|
+
submitTrustServer(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
|
|
30234
30709
|
/**
|
|
30235
30710
|
* Adds and trusts a server using a signature (gasless transaction).
|
|
30236
30711
|
*
|
|
30237
30712
|
* @param params - Parameters for adding and trusting the server
|
|
30238
|
-
* @returns Promise resolving to
|
|
30713
|
+
* @returns Promise resolving to TransactionHandle with ServerTrustResult event data
|
|
30239
30714
|
*/
|
|
30240
|
-
submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<
|
|
30715
|
+
submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
|
|
30241
30716
|
/**
|
|
30242
30717
|
* Trusts a server using a signature (gasless transaction - legacy method).
|
|
30243
30718
|
*
|
|
@@ -30251,13 +30726,24 @@ declare class PermissionsController {
|
|
|
30251
30726
|
* @throws {ServerUrlMismatchError} When server URL doesn't match existing registration
|
|
30252
30727
|
* @throws {BlockchainError} When trust operation fails for any other reason
|
|
30253
30728
|
*/
|
|
30254
|
-
submitTrustServerWithSignature(params: TrustServerParams): Promise<
|
|
30729
|
+
submitTrustServerWithSignature(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
|
|
30255
30730
|
/**
|
|
30256
30731
|
* Submits a direct untrust server transaction (without signature).
|
|
30257
30732
|
*
|
|
30258
30733
|
* @param params - The untrust server parameters containing server details
|
|
30259
30734
|
* @returns Promise resolving to the transaction hash
|
|
30260
30735
|
*/
|
|
30736
|
+
/**
|
|
30737
|
+
* Submits an untrust server transaction directly to the blockchain.
|
|
30738
|
+
*
|
|
30739
|
+
* @remarks
|
|
30740
|
+
* Internal method used for direct blockchain submission of untrust server operations
|
|
30741
|
+
* when relayer callbacks are not available.
|
|
30742
|
+
*
|
|
30743
|
+
* @param params - The untrust server parameters
|
|
30744
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30745
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30746
|
+
*/
|
|
30261
30747
|
private submitDirectUntrustTransaction;
|
|
30262
30748
|
/**
|
|
30263
30749
|
* Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
|
|
@@ -30287,7 +30773,7 @@ declare class PermissionsController {
|
|
|
30287
30773
|
* console.log('Still trusting servers:', trustedServers);
|
|
30288
30774
|
* ```
|
|
30289
30775
|
*/
|
|
30290
|
-
submitUntrustServer(params: UntrustServerParams): Promise<
|
|
30776
|
+
submitUntrustServer(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
|
|
30291
30777
|
/**
|
|
30292
30778
|
* Untrusts a server using a signature (gasless transaction).
|
|
30293
30779
|
*
|
|
@@ -30300,7 +30786,7 @@ declare class PermissionsController {
|
|
|
30300
30786
|
* @throws {RelayerError} When gasless submission fails
|
|
30301
30787
|
* @throws {BlockchainError} When untrust transaction fails
|
|
30302
30788
|
*/
|
|
30303
|
-
submitUntrustServerWithSignature(params: UntrustServerParams): Promise<
|
|
30789
|
+
submitUntrustServerWithSignature(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
|
|
30304
30790
|
/**
|
|
30305
30791
|
* Retrieves all servers trusted by a user from the DataPortabilityServers contract.
|
|
30306
30792
|
*
|
|
@@ -30351,22 +30837,60 @@ declare class PermissionsController {
|
|
|
30351
30837
|
/**
|
|
30352
30838
|
* Gets server information for multiple servers efficiently.
|
|
30353
30839
|
*
|
|
30354
|
-
* @
|
|
30355
|
-
*
|
|
30840
|
+
* @remarks
|
|
30841
|
+
* This method uses multicall to fetch information for multiple servers in a single
|
|
30842
|
+
* blockchain call, improving performance when querying many servers. Failed lookups
|
|
30843
|
+
* are returned separately for error handling.
|
|
30844
|
+
*
|
|
30845
|
+
* @param serverIds - Array of numeric server IDs to query
|
|
30846
|
+
* @returns Promise resolving to batch result containing successful lookups and failed IDs
|
|
30356
30847
|
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
30848
|
+
* @example
|
|
30849
|
+
* ```typescript
|
|
30850
|
+
* const result = await vana.permissions.getServerInfoBatch([1, 2, 3, 999]);
|
|
30851
|
+
*
|
|
30852
|
+
* // Process successful lookups
|
|
30853
|
+
* result.servers.forEach((server, id) => {
|
|
30854
|
+
* console.log(`Server ${id}: ${server.url}`);
|
|
30855
|
+
* });
|
|
30856
|
+
*
|
|
30857
|
+
* // Handle failed lookups
|
|
30858
|
+
* if (result.failed.length > 0) {
|
|
30859
|
+
* console.log(`Failed to fetch: ${result.failed.join(', ')}`);
|
|
30860
|
+
* }
|
|
30861
|
+
* ```
|
|
30357
30862
|
*/
|
|
30358
30863
|
getServerInfoBatch(serverIds: number[]): Promise<BatchServerInfoResult>;
|
|
30359
30864
|
/**
|
|
30360
30865
|
* Checks whether a specific server is trusted by a user.
|
|
30361
30866
|
*
|
|
30362
|
-
* @
|
|
30867
|
+
* @remarks
|
|
30868
|
+
* This method queries the user's trusted server list and checks if the specified
|
|
30869
|
+
* server is present. Returns both the trust status and the index in the trust list
|
|
30870
|
+
* if trusted.
|
|
30871
|
+
*
|
|
30872
|
+
* @param serverId - Numeric server ID to check
|
|
30363
30873
|
* @param userAddress - Optional user address (defaults to current user)
|
|
30364
|
-
* @returns Promise resolving to server trust status
|
|
30874
|
+
* @returns Promise resolving to server trust status with trust index if applicable
|
|
30875
|
+
* @throws {BlockchainError} When reading from contract fails
|
|
30876
|
+
* @example
|
|
30877
|
+
* ```typescript
|
|
30878
|
+
* const status = await vana.permissions.checkServerTrustStatus(1);
|
|
30879
|
+
* if (status.isTrusted) {
|
|
30880
|
+
* console.log(`Server is trusted at index ${status.trustIndex}`);
|
|
30881
|
+
* } else {
|
|
30882
|
+
* console.log('Server is not trusted');
|
|
30883
|
+
* }
|
|
30884
|
+
* ```
|
|
30365
30885
|
*/
|
|
30366
30886
|
checkServerTrustStatus(serverId: number, userAddress?: Address): Promise<ServerTrustStatus>;
|
|
30367
30887
|
/**
|
|
30368
30888
|
* Composes EIP-712 typed data for AddAndTrustServer.
|
|
30369
30889
|
*
|
|
30890
|
+
* @remarks
|
|
30891
|
+
* Creates the complete typed data structure required for EIP-712 signature generation
|
|
30892
|
+
* when adding and trusting a new server in a single transaction.
|
|
30893
|
+
*
|
|
30370
30894
|
* @param input - The add and trust server input data containing server details
|
|
30371
30895
|
* @returns Promise resolving to the typed data structure for server add and trust
|
|
30372
30896
|
*/
|
|
@@ -30448,7 +30972,7 @@ declare class PermissionsController {
|
|
|
30448
30972
|
* console.log(`Grantee registered in transaction: ${txHash}`);
|
|
30449
30973
|
* ```
|
|
30450
30974
|
*/
|
|
30451
|
-
submitRegisterGrantee(params: RegisterGranteeParams): Promise<
|
|
30975
|
+
submitRegisterGrantee(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
|
|
30452
30976
|
/**
|
|
30453
30977
|
* Registers a grantee with a signature (gasless transaction)
|
|
30454
30978
|
*
|
|
@@ -30464,7 +30988,7 @@ declare class PermissionsController {
|
|
|
30464
30988
|
* });
|
|
30465
30989
|
* ```
|
|
30466
30990
|
*/
|
|
30467
|
-
submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<
|
|
30991
|
+
submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
|
|
30468
30992
|
/**
|
|
30469
30993
|
* Submits a signed register grantee transaction via relayer
|
|
30470
30994
|
*
|
|
@@ -30477,7 +31001,7 @@ declare class PermissionsController {
|
|
|
30477
31001
|
* const result = await vana.permissions.submitSignedRegisterGrantee(typedData, signature);
|
|
30478
31002
|
* ```
|
|
30479
31003
|
*/
|
|
30480
|
-
submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<
|
|
31004
|
+
submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<TransactionHandle<GranteeRegisterResult>>;
|
|
30481
31005
|
/**
|
|
30482
31006
|
* Retrieves all registered grantees from the DataPortabilityGrantees contract.
|
|
30483
31007
|
*
|
|
@@ -30764,7 +31288,7 @@ declare class PermissionsController {
|
|
|
30764
31288
|
* @param url - New URL for the server
|
|
30765
31289
|
* @returns Promise resolving to transaction hash
|
|
30766
31290
|
*/
|
|
30767
|
-
submitUpdateServer(serverId: bigint, url: string): Promise<
|
|
31291
|
+
submitUpdateServer(serverId: bigint, url: string): Promise<TransactionHandle<ServerUpdateResult>>;
|
|
30768
31292
|
/**
|
|
30769
31293
|
* Get all permission IDs for a user
|
|
30770
31294
|
*
|
|
@@ -30804,49 +31328,106 @@ declare class PermissionsController {
|
|
|
30804
31328
|
* @throws {BlockchainError} When permission addition fails
|
|
30805
31329
|
* @throws {NetworkError} When network communication fails
|
|
30806
31330
|
*/
|
|
30807
|
-
submitAddPermission(params: ServerFilesAndPermissionParams): Promise<
|
|
31331
|
+
submitAddPermission(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
30808
31332
|
/**
|
|
30809
31333
|
* Submits an already-signed add permission transaction to the blockchain.
|
|
30810
31334
|
* This method supports both relayer-based gasless transactions and direct transactions.
|
|
30811
31335
|
*
|
|
30812
31336
|
* @param typedData - The EIP-712 typed data for AddPermission
|
|
30813
31337
|
* @param signature - The user's signature
|
|
30814
|
-
* @returns Promise resolving to
|
|
31338
|
+
* @returns Promise resolving to TransactionHandle with PermissionGrantResult event data
|
|
30815
31339
|
* @throws {RelayerError} When gasless transaction submission fails
|
|
30816
31340
|
* @throws {BlockchainError} When permission addition fails
|
|
30817
31341
|
* @throws {NetworkError} When network communication fails
|
|
30818
31342
|
*/
|
|
30819
|
-
submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<
|
|
31343
|
+
submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
30820
31344
|
/**
|
|
30821
|
-
*
|
|
31345
|
+
* Submits server files and permissions with signature to the blockchain, supporting schema validation and gasless transactions.
|
|
31346
|
+
*
|
|
31347
|
+
* @remarks
|
|
31348
|
+
* This method validates files against their specified schemas before submission.
|
|
31349
|
+
* Schema validation ensures data conforms to expected formats before on-chain registration.
|
|
31350
|
+
* Files with schemaId = 0 bypass validation. The method supports atomic batch operations
|
|
31351
|
+
* where all files and permissions are registered in a single transaction.
|
|
30822
31352
|
*
|
|
30823
31353
|
* @param params - Parameters for adding server files and permissions
|
|
30824
|
-
* @
|
|
30825
|
-
* @
|
|
31354
|
+
* @param params.granteeId - The ID of the permission grantee
|
|
31355
|
+
* @param params.grant - Grant URL containing permission parameters (typically IPFS)
|
|
31356
|
+
* @param params.fileUrls - Array of file URLs to register
|
|
31357
|
+
* @param params.schemaIds - Schema IDs for each file. Use 0 for files without schema validation.
|
|
31358
|
+
* Array length must match fileUrls length.
|
|
31359
|
+
* @param params.serverAddress - Server wallet address for decryption permissions
|
|
31360
|
+
* @param params.serverUrl - Server endpoint URL
|
|
31361
|
+
* @param params.serverPublicKey - Server's public key for encryption.
|
|
31362
|
+
* Obtain via `vana.server.getIdentity(userAddress).public_key`.
|
|
31363
|
+
* @param params.filePermissions - Nested array of permissions for each file
|
|
31364
|
+
* @returns TransactionHandle with immediate hash access and event parsing capability
|
|
31365
|
+
* @throws {Error} When schemaIds array length doesn't match fileUrls array length
|
|
31366
|
+
* @throws {SchemaValidationError} When file data doesn't match the specified schema.
|
|
31367
|
+
* Verify data structure matches schema definition from `vana.schemas.get(schemaId)`.
|
|
31368
|
+
* @throws {RelayerError} When gasless transaction submission fails.
|
|
31369
|
+
* Retry without relayer configuration to submit direct transaction.
|
|
30826
31370
|
* @throws {SignatureError} When user rejects the signature request
|
|
30827
31371
|
* @throws {BlockchainError} When server files and permissions addition fails
|
|
30828
|
-
* @throws {NetworkError} When network communication fails
|
|
31372
|
+
* @throws {NetworkError} When network communication fails.
|
|
31373
|
+
* Check network connection or configure alternative gateways.
|
|
31374
|
+
*
|
|
31375
|
+
* @example
|
|
31376
|
+
* ```typescript
|
|
31377
|
+
* const result = await vana.permissions.submitAddServerFilesAndPermissions({
|
|
31378
|
+
* granteeId: BigInt(1),
|
|
31379
|
+
* grant: "ipfs://QmXxx...",
|
|
31380
|
+
* fileUrls: ["https://storage.example.com/data.json"],
|
|
31381
|
+
* schemaIds: [123], // LinkedIn profile schema ID
|
|
31382
|
+
* serverAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
|
|
31383
|
+
* serverUrl: "https://server.example.com",
|
|
31384
|
+
* serverPublicKey: serverInfo.public_key,
|
|
31385
|
+
* filePermissions: [[{
|
|
31386
|
+
* account: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
|
|
31387
|
+
* key: encryptedKey
|
|
31388
|
+
* }]]
|
|
31389
|
+
* });
|
|
31390
|
+
* const events = await result.waitForEvents();
|
|
31391
|
+
* console.log(`Permission ID: ${events.permissionId}`);
|
|
31392
|
+
* ```
|
|
30829
31393
|
*/
|
|
30830
|
-
submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<
|
|
31394
|
+
submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
30831
31395
|
/**
|
|
30832
31396
|
* Submits an already-signed add server files and permissions transaction to the blockchain.
|
|
30833
|
-
*
|
|
31397
|
+
*
|
|
31398
|
+
* @remarks
|
|
31399
|
+
* This method returns a TransactionHandle that provides immediate access to the transaction hash
|
|
31400
|
+
* while allowing lazy-loaded access to parsed event data. Use `waitForEvents()` to retrieve
|
|
31401
|
+
* the permission ID and other event details after transaction confirmation.
|
|
30834
31402
|
*
|
|
30835
31403
|
* @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
|
|
30836
31404
|
* @param signature - The user's signature
|
|
30837
|
-
* @returns
|
|
31405
|
+
* @returns TransactionHandle with immediate hash access and optional event parsing
|
|
30838
31406
|
* @throws {RelayerError} When gasless transaction submission fails
|
|
30839
31407
|
* @throws {BlockchainError} When server files and permissions addition fails
|
|
30840
31408
|
* @throws {NetworkError} When network communication fails
|
|
31409
|
+
*
|
|
31410
|
+
* @example
|
|
31411
|
+
* ```typescript
|
|
31412
|
+
* const tx = await vana.permissions.submitSignedAddServerFilesAndPermissions(
|
|
31413
|
+
* typedData,
|
|
31414
|
+
* signature
|
|
31415
|
+
* );
|
|
31416
|
+
* console.log(`Transaction submitted: ${tx.hash}`);
|
|
31417
|
+
*
|
|
31418
|
+
* // Wait for confirmation and get the permission ID
|
|
31419
|
+
* const { permissionId } = await tx.waitForEvents();
|
|
31420
|
+
* console.log(`Permission created with ID: ${permissionId}`);
|
|
31421
|
+
* ```
|
|
30841
31422
|
*/
|
|
30842
|
-
submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<
|
|
31423
|
+
submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
30843
31424
|
/**
|
|
30844
31425
|
* Submit permission revocation with signature to the blockchain
|
|
30845
31426
|
*
|
|
30846
31427
|
* @param permissionId - Permission ID to revoke
|
|
30847
31428
|
* @returns Promise resolving to transaction hash
|
|
30848
31429
|
*/
|
|
30849
|
-
submitRevokePermission(permissionId: bigint): Promise<
|
|
31430
|
+
submitRevokePermission(permissionId: bigint): Promise<TransactionHandle<PermissionRevokeResult>>;
|
|
30850
31431
|
/**
|
|
30851
31432
|
* Submits a signed add permission transaction directly to the blockchain.
|
|
30852
31433
|
*
|
|
@@ -30876,10 +31457,10 @@ declare class PermissionsController {
|
|
|
30876
31457
|
interface CreateSchemaParams {
|
|
30877
31458
|
/** The name of the schema */
|
|
30878
31459
|
name: string;
|
|
30879
|
-
/** The
|
|
30880
|
-
|
|
31460
|
+
/** The dialect of the schema (e.g., 'json' or 'sqlite') */
|
|
31461
|
+
dialect: "json" | "sqlite";
|
|
30881
31462
|
/** The schema definition object or JSON string */
|
|
30882
|
-
|
|
31463
|
+
schema: object | string;
|
|
30883
31464
|
}
|
|
30884
31465
|
/**
|
|
30885
31466
|
* Result of creating a new schema.
|
|
@@ -30924,8 +31505,8 @@ interface CreateSchemaResult {
|
|
|
30924
31505
|
* // Create a new schema with automatic IPFS upload
|
|
30925
31506
|
* const result = await vana.schemas.create({
|
|
30926
31507
|
* name: "User Profile",
|
|
30927
|
-
*
|
|
30928
|
-
*
|
|
31508
|
+
* dialect: "json",
|
|
31509
|
+
* schema: {
|
|
30929
31510
|
* type: "object",
|
|
30930
31511
|
* properties: {
|
|
30931
31512
|
* name: { type: "string" },
|
|
@@ -30960,7 +31541,7 @@ declare class SchemaController {
|
|
|
30960
31541
|
* - Uploads the definition to IPFS to generate a permanent URL
|
|
30961
31542
|
* - Registers the schema on the blockchain with the generated URL
|
|
30962
31543
|
*
|
|
30963
|
-
* @param params - Schema creation parameters including name,
|
|
31544
|
+
* @param params - Schema creation parameters including name, dialect, and definition
|
|
30964
31545
|
* @returns Promise resolving to creation results with schema ID and transaction hash
|
|
30965
31546
|
* @throws {SchemaValidationError} When the schema definition is invalid
|
|
30966
31547
|
* @throws {Error} When IPFS upload or blockchain registration fails
|
|
@@ -30969,8 +31550,8 @@ declare class SchemaController {
|
|
|
30969
31550
|
* // Create a JSON schema for user profiles
|
|
30970
31551
|
* const result = await vana.schemas.create({
|
|
30971
31552
|
* name: "User Profile",
|
|
30972
|
-
*
|
|
30973
|
-
*
|
|
31553
|
+
* dialect: "json",
|
|
31554
|
+
* schema: {
|
|
30974
31555
|
* type: "object",
|
|
30975
31556
|
* properties: {
|
|
30976
31557
|
* name: { type: "string" },
|
|
@@ -30985,42 +31566,66 @@ declare class SchemaController {
|
|
|
30985
31566
|
*/
|
|
30986
31567
|
create(params: CreateSchemaParams): Promise<CreateSchemaResult>;
|
|
30987
31568
|
/**
|
|
30988
|
-
* Retrieves a schema by its ID.
|
|
31569
|
+
* Retrieves a complete schema by its ID with definition fetched and flattened.
|
|
30989
31570
|
*
|
|
30990
31571
|
* @param schemaId - The ID of the schema to retrieve
|
|
30991
|
-
* @
|
|
30992
|
-
* @
|
|
31572
|
+
* @param options - Optional parameters
|
|
31573
|
+
* @param options.subgraphUrl - Custom subgraph URL to use instead of default
|
|
31574
|
+
* @returns Promise resolving to the complete schema object with all fields populated
|
|
31575
|
+
* @throws {Error} When the schema is not found, definition cannot be fetched, or chain is unavailable
|
|
30993
31576
|
* @example
|
|
30994
31577
|
* ```typescript
|
|
30995
31578
|
* const schema = await vana.schemas.get(1);
|
|
30996
|
-
* console.log(`Schema: ${schema.name} (${schema.
|
|
31579
|
+
* console.log(`Schema: ${schema.name} (${schema.dialect})`);
|
|
31580
|
+
* console.log(`Version: ${schema.version}`);
|
|
31581
|
+
* console.log(`Description: ${schema.description}`);
|
|
31582
|
+
* console.log('Schema:', schema.schema);
|
|
31583
|
+
*
|
|
31584
|
+
* // Use directly with validator (schema has all required fields)
|
|
31585
|
+
* validator.validateDataAgainstSchema(data, schema);
|
|
30997
31586
|
* ```
|
|
30998
31587
|
*/
|
|
30999
|
-
get(schemaId: number
|
|
31588
|
+
get(schemaId: number, options?: {
|
|
31589
|
+
subgraphUrl?: string;
|
|
31590
|
+
}): Promise<CompleteSchema>;
|
|
31000
31591
|
/**
|
|
31001
31592
|
* Gets the total number of schemas registered on the network.
|
|
31002
31593
|
*
|
|
31594
|
+
* @param options - Optional parameters
|
|
31595
|
+
* @param options.subgraphUrl - Custom subgraph URL to use instead of default
|
|
31003
31596
|
* @returns Promise resolving to the total schema count
|
|
31004
31597
|
* @throws {Error} When the count cannot be retrieved
|
|
31005
31598
|
* @example
|
|
31006
31599
|
* ```typescript
|
|
31007
31600
|
* const count = await vana.schemas.count();
|
|
31008
31601
|
* console.log(`Total schemas: ${count}`);
|
|
31602
|
+
*
|
|
31603
|
+
* // With custom subgraph
|
|
31604
|
+
* const count = await vana.schemas.count({
|
|
31605
|
+
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
31606
|
+
* });
|
|
31009
31607
|
* ```
|
|
31010
31608
|
*/
|
|
31011
|
-
count(
|
|
31609
|
+
count(options?: {
|
|
31610
|
+
subgraphUrl?: string;
|
|
31611
|
+
}): Promise<number>;
|
|
31012
31612
|
/**
|
|
31013
31613
|
* Lists all schemas with pagination.
|
|
31014
31614
|
*
|
|
31015
31615
|
* @param options - Optional parameters for listing schemas
|
|
31016
31616
|
* @param options.limit - Maximum number of schemas to return
|
|
31017
31617
|
* @param options.offset - Number of schemas to skip
|
|
31618
|
+
* @param options.subgraphUrl - Custom subgraph URL to use instead of default
|
|
31619
|
+
* @param options.includeDefinitions - Whether to fetch and include schema definitions (default: false for performance)
|
|
31018
31620
|
* @returns Promise resolving to an array of schemas
|
|
31019
31621
|
* @example
|
|
31020
31622
|
* ```typescript
|
|
31021
|
-
* // Get all schemas
|
|
31623
|
+
* // Get all schemas (without definitions for performance)
|
|
31022
31624
|
* const schemas = await vana.schemas.list();
|
|
31023
31625
|
*
|
|
31626
|
+
* // Get schemas with definitions
|
|
31627
|
+
* const schemas = await vana.schemas.list({ includeDefinitions: true });
|
|
31628
|
+
*
|
|
31024
31629
|
* // Get schemas with pagination
|
|
31025
31630
|
* const schemas = await vana.schemas.list({ limit: 10, offset: 0 });
|
|
31026
31631
|
* ```
|
|
@@ -31028,6 +31633,8 @@ declare class SchemaController {
|
|
|
31028
31633
|
list(options?: {
|
|
31029
31634
|
limit?: number;
|
|
31030
31635
|
offset?: number;
|
|
31636
|
+
subgraphUrl?: string;
|
|
31637
|
+
includeDefinitions?: boolean;
|
|
31031
31638
|
}): Promise<Schema[]>;
|
|
31032
31639
|
/**
|
|
31033
31640
|
* Adds a schema using the legacy method (low-level API).
|
|
@@ -31037,6 +31644,36 @@ declare class SchemaController {
|
|
|
31037
31644
|
* @returns Promise resolving to the add schema result
|
|
31038
31645
|
*/
|
|
31039
31646
|
addSchema(params: AddSchemaParams): Promise<AddSchemaResult>;
|
|
31647
|
+
/**
|
|
31648
|
+
* Internal method: Query schema via subgraph
|
|
31649
|
+
*
|
|
31650
|
+
* @param params - Query parameters
|
|
31651
|
+
* @param params.schemaId - The ID of the schema to retrieve
|
|
31652
|
+
* @param params.subgraphUrl - The subgraph URL to query
|
|
31653
|
+
* @returns Promise resolving to the schema object
|
|
31654
|
+
* @private
|
|
31655
|
+
*/
|
|
31656
|
+
private _getSchemaViaSubgraph;
|
|
31657
|
+
/**
|
|
31658
|
+
* Internal method: List schemas via subgraph
|
|
31659
|
+
*
|
|
31660
|
+
* @param params - Query parameters
|
|
31661
|
+
* @param params.limit - Maximum number of schemas to return
|
|
31662
|
+
* @param params.offset - Number of schemas to skip
|
|
31663
|
+
* @param params.subgraphUrl - The subgraph URL to query
|
|
31664
|
+
* @returns Promise resolving to an array of schemas
|
|
31665
|
+
* @private
|
|
31666
|
+
*/
|
|
31667
|
+
private _listSchemasViaSubgraph;
|
|
31668
|
+
/**
|
|
31669
|
+
* Internal method: Count schemas via subgraph
|
|
31670
|
+
*
|
|
31671
|
+
* @param params - Query parameters
|
|
31672
|
+
* @param params.subgraphUrl - The subgraph URL to query
|
|
31673
|
+
* @returns Promise resolving to the total schema count
|
|
31674
|
+
* @private
|
|
31675
|
+
*/
|
|
31676
|
+
private _countSchemasViaSubgraph;
|
|
31040
31677
|
/**
|
|
31041
31678
|
* Gets the user's wallet address.
|
|
31042
31679
|
*
|
|
@@ -31044,6 +31681,13 @@ declare class SchemaController {
|
|
|
31044
31681
|
* @returns Promise resolving to the user's address
|
|
31045
31682
|
*/
|
|
31046
31683
|
private getUserAddress;
|
|
31684
|
+
/**
|
|
31685
|
+
* Fetches and attaches definitions to an array of schemas.
|
|
31686
|
+
*
|
|
31687
|
+
* @param schemas - Array of schemas to fetch definitions for
|
|
31688
|
+
* @private
|
|
31689
|
+
*/
|
|
31690
|
+
private _fetchDefinitionsForSchemas;
|
|
31047
31691
|
}
|
|
31048
31692
|
|
|
31049
31693
|
/**
|
|
@@ -31085,16 +31729,16 @@ declare class SchemaValidationError extends Error {
|
|
|
31085
31729
|
}>);
|
|
31086
31730
|
}
|
|
31087
31731
|
/**
|
|
31088
|
-
*
|
|
31732
|
+
* Data schema validation utility class
|
|
31089
31733
|
*/
|
|
31090
31734
|
declare class SchemaValidator {
|
|
31091
31735
|
private ajv;
|
|
31092
31736
|
private dataSchemaValidator;
|
|
31093
31737
|
constructor();
|
|
31094
31738
|
/**
|
|
31095
|
-
* Validates a data schema against the Vana meta-schema
|
|
31739
|
+
* Validates a data schema definition against the Vana meta-schema
|
|
31096
31740
|
*
|
|
31097
|
-
* @param schema - The data schema to validate
|
|
31741
|
+
* @param schema - The data schema definition to validate
|
|
31098
31742
|
* @throws SchemaValidationError if invalid
|
|
31099
31743
|
* @example
|
|
31100
31744
|
* ```typescript
|
|
@@ -31113,39 +31757,35 @@ declare class SchemaValidator {
|
|
|
31113
31757
|
* }
|
|
31114
31758
|
* };
|
|
31115
31759
|
*
|
|
31116
|
-
* validator.
|
|
31760
|
+
* validator.validateDataSchemaAgainstMetaSchema(schema); // throws if invalid
|
|
31117
31761
|
* ```
|
|
31118
31762
|
*/
|
|
31119
|
-
|
|
31763
|
+
validateDataSchemaAgainstMetaSchema(schema: unknown): asserts schema is DataSchema;
|
|
31120
31764
|
/**
|
|
31121
|
-
* Validates data against a JSON Schema
|
|
31765
|
+
* Validates data against a JSON Schema
|
|
31122
31766
|
*
|
|
31123
31767
|
* @param data - The data to validate
|
|
31124
|
-
* @param schema - The
|
|
31768
|
+
* @param schema - The schema containing the validation rules (must have been validated or fetched from chain)
|
|
31125
31769
|
* @throws SchemaValidationError if invalid
|
|
31126
31770
|
* @example
|
|
31127
31771
|
* ```typescript
|
|
31128
31772
|
* const validator = new SchemaValidator();
|
|
31129
31773
|
*
|
|
31130
|
-
*
|
|
31774
|
+
* // Works with Schema from schemas.get()
|
|
31775
|
+
* const schema = await vana.schemas.get(1);
|
|
31776
|
+
* validator.validateDataAgainstSchema(userData, schema);
|
|
31777
|
+
*
|
|
31778
|
+
* // Also works with pre-validated DataSchema object
|
|
31779
|
+
* const dataSchema = validator.validateDataSchemaAgainstMetaSchema({
|
|
31131
31780
|
* name: "User Profile",
|
|
31132
31781
|
* version: "1.0.0",
|
|
31133
31782
|
* dialect: "json",
|
|
31134
|
-
* schema: {
|
|
31135
|
-
*
|
|
31136
|
-
*
|
|
31137
|
-
* name: { type: "string" },
|
|
31138
|
-
* age: { type: "number" }
|
|
31139
|
-
* },
|
|
31140
|
-
* required: ["name"]
|
|
31141
|
-
* }
|
|
31142
|
-
* };
|
|
31143
|
-
*
|
|
31144
|
-
* const userData = { name: "Alice", age: 30 };
|
|
31145
|
-
* validator.validateDataAgainstSchema(userData, schema);
|
|
31783
|
+
* schema: { type: "object", properties: { name: { type: "string" } } }
|
|
31784
|
+
* });
|
|
31785
|
+
* validator.validateDataAgainstSchema(userData, dataSchema);
|
|
31146
31786
|
* ```
|
|
31147
31787
|
*/
|
|
31148
|
-
validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
|
|
31788
|
+
validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
|
|
31149
31789
|
/**
|
|
31150
31790
|
* Validates a SQLite DDL string for basic syntax
|
|
31151
31791
|
* Note: This is a basic validation, full SQL parsing would require a proper SQL parser
|
|
@@ -31156,9 +31796,9 @@ declare class SchemaValidator {
|
|
|
31156
31796
|
*/
|
|
31157
31797
|
validateSQLiteDDL(ddl: string, dialectVersion?: string): void;
|
|
31158
31798
|
/**
|
|
31159
|
-
* Fetches and validates a schema from a URL
|
|
31799
|
+
* Fetches and validates a data schema from a URL
|
|
31160
31800
|
*
|
|
31161
|
-
* @param url - The URL to fetch the schema from
|
|
31801
|
+
* @param url - The URL to fetch the data schema from
|
|
31162
31802
|
* @returns The validated data schema
|
|
31163
31803
|
* @throws SchemaValidationError if invalid or fetch fails
|
|
31164
31804
|
* @example
|
|
@@ -31174,13 +31814,24 @@ declare class SchemaValidator {
|
|
|
31174
31814
|
*/
|
|
31175
31815
|
declare const schemaValidator: SchemaValidator;
|
|
31176
31816
|
/**
|
|
31177
|
-
* Convenience function to validate a data schema
|
|
31817
|
+
* Convenience function to validate a data schema definition against the Vana meta-schema
|
|
31178
31818
|
*
|
|
31179
|
-
* @param schema - The data schema to validate
|
|
31180
|
-
* @returns
|
|
31819
|
+
* @param schema - The data schema definition to validate
|
|
31820
|
+
* @returns The validated DataSchema
|
|
31181
31821
|
* @throws SchemaValidationError if invalid
|
|
31822
|
+
* @example
|
|
31823
|
+
* ```typescript
|
|
31824
|
+
* const schemaDefinition = {
|
|
31825
|
+
* name: "User Profile",
|
|
31826
|
+
* version: "1.0.0",
|
|
31827
|
+
* dialect: "json",
|
|
31828
|
+
* schema: { type: "object", properties: { name: { type: "string" } } }
|
|
31829
|
+
* };
|
|
31830
|
+
*
|
|
31831
|
+
* const validatedSchema = validateDataSchemaAgainstMetaSchema(schemaDefinition);
|
|
31832
|
+
* ```
|
|
31182
31833
|
*/
|
|
31183
|
-
declare function
|
|
31834
|
+
declare function validateDataSchemaAgainstMetaSchema(schema: unknown): DataSchema;
|
|
31184
31835
|
/**
|
|
31185
31836
|
* Convenience function to validate data against a schema
|
|
31186
31837
|
*
|
|
@@ -31189,11 +31840,11 @@ declare function validateDataSchema(schema: unknown): asserts schema is DataSche
|
|
|
31189
31840
|
* @returns void - Function doesn't return a value
|
|
31190
31841
|
* @throws SchemaValidationError if invalid
|
|
31191
31842
|
*/
|
|
31192
|
-
declare function validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
|
|
31843
|
+
declare function validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
|
|
31193
31844
|
/**
|
|
31194
|
-
* Convenience function to fetch and validate a schema from a URL
|
|
31845
|
+
* Convenience function to fetch and validate a data schema from a URL
|
|
31195
31846
|
*
|
|
31196
|
-
* @param url - The URL to fetch the schema from
|
|
31847
|
+
* @param url - The URL to fetch the data schema from
|
|
31197
31848
|
* @returns The validated data schema
|
|
31198
31849
|
* @throws SchemaValidationError if invalid or fetch fails
|
|
31199
31850
|
*/
|
|
@@ -33685,19 +34336,101 @@ declare class DataController {
|
|
|
33685
34336
|
subgraphUrl?: string;
|
|
33686
34337
|
}): Promise<UserFile$1[]>;
|
|
33687
34338
|
/**
|
|
33688
|
-
*
|
|
34339
|
+
* Fetches proof data for multiple files from the subgraph.
|
|
34340
|
+
*
|
|
34341
|
+
* @private
|
|
34342
|
+
* @param fileIds - Array of file IDs to fetch proofs for
|
|
34343
|
+
* @param subgraphUrl - The subgraph endpoint URL
|
|
34344
|
+
* @returns Map of file IDs to their associated DLP IDs
|
|
34345
|
+
*/
|
|
34346
|
+
private _fetchProofsFromSubgraph;
|
|
34347
|
+
/**
|
|
34348
|
+
* Fetches proof data for multiple files from the blockchain.
|
|
34349
|
+
* Falls back to this when subgraph is unavailable.
|
|
34350
|
+
*
|
|
34351
|
+
* @private
|
|
34352
|
+
* @param fileIds - Array of file IDs to fetch proofs for
|
|
34353
|
+
* @returns Map of file IDs to their associated DLP IDs
|
|
34354
|
+
*/
|
|
34355
|
+
private _fetchProofsFromChain;
|
|
34356
|
+
/**
|
|
34357
|
+
* Retrieves information about a specific Data Liquidity Pool (DLP).
|
|
34358
|
+
*
|
|
34359
|
+
* @remarks
|
|
34360
|
+
* DLPs are entities that process and verify data files in the Vana network.
|
|
34361
|
+
* This method fetches DLP metadata including name, status, and performance rating.
|
|
34362
|
+
* Uses subgraph first for efficiency, falls back to chain if unavailable.
|
|
34363
|
+
*
|
|
34364
|
+
* @param dlpId - The unique identifier of the DLP
|
|
34365
|
+
* @param options - Optional parameters
|
|
34366
|
+
* @param options.subgraphUrl - Custom subgraph URL to override default
|
|
34367
|
+
* @returns Promise resolving to DLP information
|
|
34368
|
+
* @throws {Error} When DLP cannot be found - "DLP not found: {dlpId}"
|
|
34369
|
+
* @throws {Error} When query fails - "Failed to fetch DLP: {error}"
|
|
34370
|
+
* @example
|
|
34371
|
+
* ```typescript
|
|
34372
|
+
* const dlp = await vana.data.getDLP(26);
|
|
34373
|
+
* console.log(`DLP ${dlp.name}: ${dlp.status}`);
|
|
34374
|
+
* ```
|
|
34375
|
+
*/
|
|
34376
|
+
getDLP(dlpId: number, options?: {
|
|
34377
|
+
subgraphUrl?: string;
|
|
34378
|
+
}): Promise<{
|
|
34379
|
+
id: number;
|
|
34380
|
+
name: string;
|
|
34381
|
+
metadata?: string;
|
|
34382
|
+
status?: number;
|
|
34383
|
+
address?: Address;
|
|
34384
|
+
owner?: Address;
|
|
34385
|
+
}>;
|
|
34386
|
+
/**
|
|
34387
|
+
* Lists all Data Liquidity Pools (DLPs) with optional pagination.
|
|
34388
|
+
*
|
|
34389
|
+
* @remarks
|
|
34390
|
+
* Fetches a paginated list of all DLPs registered in the network.
|
|
34391
|
+
* Uses subgraph for efficient querying with fallback to chain multicall.
|
|
34392
|
+
*
|
|
34393
|
+
* @param options - Optional parameters for pagination and filtering
|
|
34394
|
+
* @param options.limit - Maximum number of DLPs to return (default: 100)
|
|
34395
|
+
* @param options.offset - Number of DLPs to skip (default: 0)
|
|
34396
|
+
* @param options.subgraphUrl - Custom subgraph URL to override default
|
|
34397
|
+
* @returns Promise resolving to array of DLP information
|
|
34398
|
+
* @throws {Error} When query fails - "Failed to list DLPs: {error}"
|
|
34399
|
+
* @example
|
|
34400
|
+
* ```typescript
|
|
34401
|
+
* // Get first 10 DLPs
|
|
34402
|
+
* const dlps = await vana.data.listDLPs({ limit: 10 });
|
|
34403
|
+
* dlps.forEach(dlp => console.log(`${dlp.id}: ${dlp.name}`));
|
|
34404
|
+
*
|
|
34405
|
+
* // Get next page
|
|
34406
|
+
* const nextPage = await vana.data.listDLPs({ limit: 10, offset: 10 });
|
|
34407
|
+
* ```
|
|
34408
|
+
*/
|
|
34409
|
+
listDLPs(options?: {
|
|
34410
|
+
limit?: number;
|
|
34411
|
+
offset?: number;
|
|
34412
|
+
subgraphUrl?: string;
|
|
34413
|
+
}): Promise<Array<{
|
|
34414
|
+
id: number;
|
|
34415
|
+
name: string;
|
|
34416
|
+
metadata?: string;
|
|
34417
|
+
status?: number;
|
|
34418
|
+
address?: Address;
|
|
34419
|
+
owner?: Address;
|
|
34420
|
+
}>>;
|
|
34421
|
+
/**
|
|
34422
|
+
* Retrieves a list of permissions granted by a user.
|
|
33689
34423
|
*
|
|
33690
|
-
* This method
|
|
33691
|
-
*
|
|
33692
|
-
*
|
|
33693
|
-
*
|
|
33694
|
-
* 3. No need for additional contract calls as all data comes from subgraph
|
|
34424
|
+
* This method supports automatic fallback between subgraph and RPC modes:
|
|
34425
|
+
* - If subgraph URL is available, tries subgraph query first
|
|
34426
|
+
* - Falls back to direct contract queries via RPC if subgraph fails
|
|
34427
|
+
* - RPC mode uses gasAwareMulticall for efficient batch queries
|
|
33695
34428
|
*
|
|
33696
34429
|
* @param params - Object containing the user address and optional subgraph URL
|
|
33697
34430
|
* @param params.user - The wallet address of the user to query permissions for
|
|
33698
34431
|
* @param params.subgraphUrl - Optional subgraph URL to override the default
|
|
33699
34432
|
* @returns Promise resolving to an array of permission objects
|
|
33700
|
-
* @throws Error if subgraph
|
|
34433
|
+
* @throws Error if both subgraph and RPC queries fail
|
|
33701
34434
|
*/
|
|
33702
34435
|
getUserPermissions(params: {
|
|
33703
34436
|
user: Address;
|
|
@@ -33713,43 +34446,59 @@ declare class DataController {
|
|
|
33713
34446
|
user: Address;
|
|
33714
34447
|
}>>;
|
|
33715
34448
|
/**
|
|
33716
|
-
*
|
|
34449
|
+
* Internal method: Query user permissions via subgraph
|
|
33717
34450
|
*
|
|
33718
|
-
*
|
|
33719
|
-
*
|
|
34451
|
+
* @param params - Query parameters object
|
|
34452
|
+
* @param params.user - The user address to query permissions for
|
|
34453
|
+
* @param params.subgraphUrl - The subgraph URL endpoint to query
|
|
34454
|
+
* @returns Promise resolving to an array of permission objects
|
|
34455
|
+
*/
|
|
34456
|
+
private _getUserPermissionsViaSubgraph;
|
|
34457
|
+
/**
|
|
34458
|
+
* Internal method: Query user permissions via direct RPC
|
|
34459
|
+
*
|
|
34460
|
+
* @param params - Query parameters object
|
|
34461
|
+
* @param params.user - The user address to query permissions for
|
|
34462
|
+
* @returns Promise resolving to an array of permission objects
|
|
34463
|
+
*/
|
|
34464
|
+
private _getUserPermissionsViaRpc;
|
|
34465
|
+
/**
|
|
34466
|
+
* Retrieves a list of trusted servers for a user.
|
|
33720
34467
|
*
|
|
33721
|
-
* This method supports
|
|
33722
|
-
* -
|
|
33723
|
-
* -
|
|
33724
|
-
* -
|
|
34468
|
+
* This method supports automatic fallback between subgraph and RPC modes:
|
|
34469
|
+
* - If subgraph URL is available, tries subgraph query first for fast results
|
|
34470
|
+
* - Falls back to direct contract queries via RPC if subgraph fails
|
|
34471
|
+
* - RPC mode uses gasAwareMulticall for efficient batch queries
|
|
33725
34472
|
*
|
|
33726
|
-
* @param params - Query parameters including user address and
|
|
33727
|
-
* @
|
|
33728
|
-
* @
|
|
34473
|
+
* @param params - Query parameters including user address and optional pagination
|
|
34474
|
+
* @param params.user - The wallet address of the user to query trusted servers for
|
|
34475
|
+
* @param params.subgraphUrl - Optional subgraph URL to override the default
|
|
34476
|
+
* @param params.limit - Maximum number of results to return (default: 50)
|
|
34477
|
+
* @param params.offset - Number of results to skip for pagination (default: 0)
|
|
34478
|
+
* @returns Promise resolving to an array of trusted server objects
|
|
34479
|
+
* @throws Error if both subgraph and RPC queries fail
|
|
33729
34480
|
* @example
|
|
33730
34481
|
* ```typescript
|
|
33731
|
-
* //
|
|
33732
|
-
* const
|
|
33733
|
-
* user: '0x...'
|
|
33734
|
-
* mode: 'subgraph',
|
|
33735
|
-
* subgraphUrl: 'https://...'
|
|
34482
|
+
* // Basic usage with automatic fallback
|
|
34483
|
+
* const servers = await vana.data.getUserTrustedServers({
|
|
34484
|
+
* user: '0x...'
|
|
33736
34485
|
* });
|
|
33737
34486
|
*
|
|
33738
|
-
* //
|
|
33739
|
-
* const
|
|
34487
|
+
* // With pagination
|
|
34488
|
+
* const servers = await vana.data.getUserTrustedServers({
|
|
33740
34489
|
* user: '0x...',
|
|
33741
|
-
*
|
|
33742
|
-
*
|
|
34490
|
+
* limit: 10,
|
|
34491
|
+
* offset: 20
|
|
33743
34492
|
* });
|
|
33744
34493
|
*
|
|
33745
|
-
* //
|
|
33746
|
-
* const
|
|
34494
|
+
* // With custom subgraph URL
|
|
34495
|
+
* const servers = await vana.data.getUserTrustedServers({
|
|
33747
34496
|
* user: '0x...',
|
|
33748
|
-
*
|
|
34497
|
+
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
33749
34498
|
* });
|
|
33750
34499
|
* ```
|
|
33751
34500
|
*/
|
|
33752
|
-
getUserTrustedServers(params: GetUserTrustedServersParams): Promise<
|
|
34501
|
+
getUserTrustedServers(params: GetUserTrustedServersParams): Promise<TrustedServer[]>;
|
|
33753
34502
|
/**
|
|
33754
34503
|
* Internal method: Query trusted servers via subgraph
|
|
33755
34504
|
*
|
|
@@ -33814,75 +34563,28 @@ declare class DataController {
|
|
|
33814
34563
|
* for specific files by ID.
|
|
33815
34564
|
*/
|
|
33816
34565
|
getFileById(fileId: number): Promise<UserFile$1>;
|
|
33817
|
-
/**
|
|
33818
|
-
* Uploads an encrypted file to storage and registers it on the blockchain.
|
|
33819
|
-
*
|
|
33820
|
-
* @deprecated Since v2.0.0 - Use vana.data.upload() instead for the high-level API with automatic encryption
|
|
33821
|
-
*
|
|
33822
|
-
* Migration guide:
|
|
33823
|
-
* ```typescript
|
|
33824
|
-
* // Old way (deprecated):
|
|
33825
|
-
* const encrypted = await encryptBlob(data, key);
|
|
33826
|
-
* const result = await vana.data.uploadEncryptedFile(encrypted, filename);
|
|
33827
|
-
*
|
|
33828
|
-
* // New way:
|
|
33829
|
-
* const result = await vana.data.upload({
|
|
33830
|
-
* content: data,
|
|
33831
|
-
* filename: filename,
|
|
33832
|
-
* encrypt: true // Handles encryption automatically
|
|
33833
|
-
* });
|
|
33834
|
-
* ```
|
|
33835
|
-
* @param encryptedFile - The encrypted file blob to upload
|
|
33836
|
-
* @param filename - Optional filename for the upload
|
|
33837
|
-
* @param providerName - Optional storage provider to use
|
|
33838
|
-
* @returns Promise resolving to upload result with file ID and storage URL
|
|
33839
|
-
*
|
|
33840
|
-
* This method handles the complete flow of:
|
|
33841
|
-
* 1. Uploading the encrypted file to the specified storage provider
|
|
33842
|
-
* 2. Registering the file URL on the DataRegistry contract via relayer
|
|
33843
|
-
* 3. Returning the assigned file ID and storage URL
|
|
33844
|
-
*/
|
|
33845
|
-
uploadEncryptedFile(encryptedFile: Blob, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
|
|
33846
|
-
/**
|
|
33847
|
-
* Uploads an encrypted file to storage and registers it on the blockchain with a schema.
|
|
33848
|
-
*
|
|
33849
|
-
* @deprecated Since v2.0.0 - Use vana.data.upload() instead for the high-level API with automatic encryption and schema validation
|
|
33850
|
-
*
|
|
33851
|
-
* Migration guide:
|
|
33852
|
-
* ```typescript
|
|
33853
|
-
* // Old way (deprecated):
|
|
33854
|
-
* const encrypted = await encryptBlob(data, key);
|
|
33855
|
-
* const result = await vana.data.uploadEncryptedFileWithSchema(encrypted, schemaId, filename);
|
|
33856
|
-
*
|
|
33857
|
-
* // New way:
|
|
33858
|
-
* const result = await vana.data.upload({
|
|
33859
|
-
* content: data,
|
|
33860
|
-
* filename: filename,
|
|
33861
|
-
* schemaId: schemaId, // Automatic validation
|
|
33862
|
-
* encrypt: true
|
|
33863
|
-
* });
|
|
33864
|
-
* ```
|
|
33865
|
-
* @param encryptedFile - The encrypted file blob to upload
|
|
33866
|
-
* @param schemaId - The schema ID to associate with the file
|
|
33867
|
-
* @param filename - Optional filename for the upload
|
|
33868
|
-
* @param providerName - Optional storage provider to use
|
|
33869
|
-
* @returns Promise resolving to upload result with file ID and storage URL
|
|
33870
|
-
*
|
|
33871
|
-
* This method handles the complete flow of:
|
|
33872
|
-
* 1. Uploading the encrypted file to the specified storage provider
|
|
33873
|
-
* 2. Registering the file URL on the DataRegistry contract with a schema ID
|
|
33874
|
-
* 3. Returning the assigned file ID and storage URL
|
|
33875
|
-
*/
|
|
33876
|
-
uploadEncryptedFileWithSchema(encryptedFile: Blob, schemaId: number, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
|
|
33877
34566
|
/**
|
|
33878
34567
|
* Registers a file URL directly on the blockchain with a schema ID.
|
|
33879
34568
|
*
|
|
33880
|
-
* @
|
|
34569
|
+
* @remarks
|
|
34570
|
+
* This method registers an existing file URL on the DataRegistry contract
|
|
34571
|
+
* with a schema ID, without uploading any data. Useful when you have already
|
|
34572
|
+
* uploaded content to storage and just need to register it on-chain.
|
|
34573
|
+
*
|
|
34574
|
+
* @param url - The URL of the file to register (IPFS or HTTP/HTTPS)
|
|
33881
34575
|
* @param schemaId - The schema ID to associate with the file
|
|
33882
34576
|
* @returns Promise resolving to the file ID and transaction hash
|
|
33883
|
-
*
|
|
33884
|
-
*
|
|
33885
|
-
*
|
|
34577
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
34578
|
+
* @throws {Error} When wallet address is unavailable - "No addresses available"
|
|
34579
|
+
* @throws {Error} When transaction fails - "Failed to register file with schema"
|
|
34580
|
+
* @example
|
|
34581
|
+
* ```typescript
|
|
34582
|
+
* const { fileId, transactionHash } = await vana.data.registerFileWithSchema(
|
|
34583
|
+
* "ipfs://QmXxx...",
|
|
34584
|
+
* 1
|
|
34585
|
+
* );
|
|
34586
|
+
* console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
|
|
34587
|
+
* ```
|
|
33886
34588
|
*/
|
|
33887
34589
|
registerFileWithSchema(url: string, schemaId: number): Promise<{
|
|
33888
34590
|
fileId: number;
|
|
@@ -33940,95 +34642,114 @@ declare class DataController {
|
|
|
33940
34642
|
transactionHash: string;
|
|
33941
34643
|
}>;
|
|
33942
34644
|
/**
|
|
33943
|
-
* Adds a new
|
|
33944
|
-
*
|
|
33945
|
-
* @deprecated Since v2.0.0 - Use vana.schemas.create() instead for the high-level API with automatic IPFS upload
|
|
34645
|
+
* Adds a new refiner to the DataRefinerRegistry.
|
|
33946
34646
|
*
|
|
33947
|
-
*
|
|
34647
|
+
* @remarks
|
|
34648
|
+
* Refiners are data processing templates that define how raw data should be
|
|
34649
|
+
* transformed into structured formats. Each refiner is associated with a DLP
|
|
34650
|
+
* (Data Liquidity Pool), has a specific schema for output, and includes
|
|
34651
|
+
* instructions for the refinement process.
|
|
34652
|
+
*
|
|
34653
|
+
* @param params - Refiner configuration parameters
|
|
34654
|
+
* @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
|
|
34655
|
+
* @param params.name - Human-readable name for the refiner
|
|
34656
|
+
* @param params.schemaId - Schema ID that defines the output format
|
|
34657
|
+
* @param params.refinementInstructionUrl - URL containing processing instructions
|
|
34658
|
+
* @returns Promise resolving to the new refiner ID and transaction hash
|
|
34659
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
34660
|
+
* @throws {Error} When transaction fails - "Failed to add refiner: {error}"
|
|
34661
|
+
* @example
|
|
33948
34662
|
* ```typescript
|
|
33949
|
-
*
|
|
33950
|
-
*
|
|
33951
|
-
* name: "
|
|
33952
|
-
*
|
|
33953
|
-
*
|
|
33954
|
-
* });
|
|
33955
|
-
*
|
|
33956
|
-
* // New way:
|
|
33957
|
-
* const result = await vana.schemas.create({
|
|
33958
|
-
* name: "UserProfile",
|
|
33959
|
-
* type: "JSON",
|
|
33960
|
-
* definition: schemaObject // Automatically uploads to IPFS
|
|
34663
|
+
* const result = await vana.data.addRefiner({
|
|
34664
|
+
* dlpId: 1,
|
|
34665
|
+
* name: "Social Media Sentiment Analyzer",
|
|
34666
|
+
* schemaId: 42,
|
|
34667
|
+
* refinementInstructionUrl: "ipfs://QmXxx..."
|
|
33961
34668
|
* });
|
|
34669
|
+
* console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
|
|
33962
34670
|
* ```
|
|
33963
|
-
* @param params - Schema parameters including name, type, and definition URL
|
|
33964
|
-
* @returns Promise resolving to the new schema ID and transaction hash
|
|
33965
34671
|
*/
|
|
33966
|
-
|
|
34672
|
+
addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
|
|
33967
34673
|
/**
|
|
33968
|
-
* Retrieves a
|
|
34674
|
+
* Retrieves a refiner by its ID.
|
|
33969
34675
|
*
|
|
33970
|
-
* @
|
|
34676
|
+
* @remarks
|
|
34677
|
+
* Queries the DataRefinerRegistry contract to get complete information about
|
|
34678
|
+
* a specific refiner including its DLP association, schema, and instructions.
|
|
33971
34679
|
*
|
|
33972
|
-
*
|
|
34680
|
+
* @param refinerId - The numeric refiner ID to retrieve
|
|
34681
|
+
* @returns Promise resolving to the refiner information object
|
|
34682
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
34683
|
+
* @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
|
|
34684
|
+
* @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
|
|
34685
|
+
* @example
|
|
33973
34686
|
* ```typescript
|
|
33974
|
-
*
|
|
33975
|
-
*
|
|
33976
|
-
*
|
|
33977
|
-
*
|
|
33978
|
-
*
|
|
34687
|
+
* const refiner = await vana.data.getRefiner(1);
|
|
34688
|
+
* console.log({
|
|
34689
|
+
* name: refiner.name,
|
|
34690
|
+
* dlp: refiner.dlpId,
|
|
34691
|
+
* schema: refiner.schemaId,
|
|
34692
|
+
* instructions: refiner.refinementInstructionUrl
|
|
34693
|
+
* });
|
|
33979
34694
|
* ```
|
|
33980
|
-
* @param schemaId - The schema ID to retrieve
|
|
33981
|
-
* @returns Promise resolving to the schema information
|
|
33982
34695
|
*/
|
|
33983
|
-
|
|
34696
|
+
getRefiner(refinerId: number): Promise<Refiner>;
|
|
33984
34697
|
/**
|
|
33985
|
-
*
|
|
34698
|
+
* Validates if a schema ID exists in the registry.
|
|
33986
34699
|
*
|
|
33987
|
-
* @
|
|
34700
|
+
* @remarks
|
|
34701
|
+
* Checks the DataRefinerRegistry contract to determine if a given schema ID
|
|
34702
|
+
* has been registered and is available for use.
|
|
33988
34703
|
*
|
|
33989
|
-
*
|
|
34704
|
+
* @param schemaId - The numeric schema ID to validate
|
|
34705
|
+
* @returns Promise resolving to true if schema exists, false otherwise
|
|
34706
|
+
* @example
|
|
33990
34707
|
* ```typescript
|
|
33991
|
-
*
|
|
33992
|
-
*
|
|
33993
|
-
*
|
|
33994
|
-
*
|
|
33995
|
-
*
|
|
34708
|
+
* const isValid = await vana.data.isValidSchemaId(42);
|
|
34709
|
+
* if (isValid) {
|
|
34710
|
+
* console.log('Schema 42 is available for use');
|
|
34711
|
+
* } else {
|
|
34712
|
+
* console.log('Schema 42 does not exist');
|
|
34713
|
+
* }
|
|
33996
34714
|
* ```
|
|
33997
|
-
* @returns Promise resolving to the total schema count
|
|
33998
|
-
*/
|
|
33999
|
-
getSchemasCount(): Promise<number>;
|
|
34000
|
-
/**
|
|
34001
|
-
* Adds a new refiner to the DataRefinerRegistry.
|
|
34002
|
-
*
|
|
34003
|
-
* @param params - Refiner parameters including DLP ID, name, schema ID, and instruction URL
|
|
34004
|
-
* @returns Promise resolving to the new refiner ID and transaction hash
|
|
34005
|
-
*/
|
|
34006
|
-
addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
|
|
34007
|
-
/**
|
|
34008
|
-
* Retrieves a refiner by its ID.
|
|
34009
|
-
*
|
|
34010
|
-
* @param refinerId - The refiner ID to retrieve
|
|
34011
|
-
* @returns Promise resolving to the refiner information
|
|
34012
|
-
*/
|
|
34013
|
-
getRefiner(refinerId: number): Promise<Refiner>;
|
|
34014
|
-
/**
|
|
34015
|
-
* Validates if a schema ID exists in the registry.
|
|
34016
|
-
*
|
|
34017
|
-
* @param schemaId - The schema ID to validate
|
|
34018
|
-
* @returns Promise resolving to boolean indicating if the schema ID is valid
|
|
34019
34715
|
*/
|
|
34020
34716
|
isValidSchemaId(schemaId: number): Promise<boolean>;
|
|
34021
34717
|
/**
|
|
34022
34718
|
* Gets the total number of refiners in the registry.
|
|
34023
34719
|
*
|
|
34720
|
+
* @remarks
|
|
34721
|
+
* Queries the DataRefinerRegistry contract to get the total count of all
|
|
34722
|
+
* registered refiners across all DLPs.
|
|
34723
|
+
*
|
|
34024
34724
|
* @returns Promise resolving to the total refiner count
|
|
34725
|
+
* @example
|
|
34726
|
+
* ```typescript
|
|
34727
|
+
* const count = await vana.data.getRefinersCount();
|
|
34728
|
+
* console.log(`Total refiners registered: ${count}`);
|
|
34729
|
+
* ```
|
|
34025
34730
|
*/
|
|
34026
34731
|
getRefinersCount(): Promise<number>;
|
|
34027
34732
|
/**
|
|
34028
34733
|
* Updates the schema ID for an existing refiner.
|
|
34029
34734
|
*
|
|
34030
|
-
* @
|
|
34735
|
+
* @remarks
|
|
34736
|
+
* Allows the owner of a refiner to update its associated schema ID.
|
|
34737
|
+
* This is useful when refiner output format needs to change.
|
|
34738
|
+
*
|
|
34739
|
+
* @param params - Update parameters
|
|
34740
|
+
* @param params.refinerId - The refiner ID to update
|
|
34741
|
+
* @param params.newSchemaId - The new schema ID to set
|
|
34031
34742
|
* @returns Promise resolving to the transaction hash
|
|
34743
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
34744
|
+
* @throws {Error} When transaction fails - "Failed to update schema ID: {error}"
|
|
34745
|
+
* @example
|
|
34746
|
+
* ```typescript
|
|
34747
|
+
* const result = await vana.data.updateSchemaId({
|
|
34748
|
+
* refinerId: 1,
|
|
34749
|
+
* newSchemaId: 55
|
|
34750
|
+
* });
|
|
34751
|
+
* console.log(`Schema updated in tx ${result.transactionHash}`);
|
|
34752
|
+
* ```
|
|
34032
34753
|
*/
|
|
34033
34754
|
updateSchemaId(params: UpdateSchemaIdParams): Promise<UpdateSchemaIdResult>;
|
|
34034
34755
|
/**
|
|
@@ -34050,6 +34771,17 @@ declare class DataController {
|
|
|
34050
34771
|
account: Address;
|
|
34051
34772
|
publicKey: string;
|
|
34052
34773
|
}>, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
|
|
34774
|
+
/**
|
|
34775
|
+
* Uploads content to storage without registering it on the blockchain.
|
|
34776
|
+
* This method only handles the storage upload and returns the file URL.
|
|
34777
|
+
*
|
|
34778
|
+
* @param content - The content to upload (string, Blob, Buffer, or object - objects will be JSON stringified)
|
|
34779
|
+
* @param filename - Optional filename for the uploaded file (defaults to timestamp-based name)
|
|
34780
|
+
* @param encrypt - Optional flag to encrypt the content before upload
|
|
34781
|
+
* @param providerName - Optional specific storage provider to use
|
|
34782
|
+
* @returns Promise resolving to the storage upload result with url, size, and contentType
|
|
34783
|
+
*/
|
|
34784
|
+
uploadToStorage(content: string | Blob | Buffer | object, filename?: string, encrypt?: boolean, providerName?: string): Promise<StorageUploadResult>;
|
|
34053
34785
|
/**
|
|
34054
34786
|
* Adds a permission for a party to access an existing file.
|
|
34055
34787
|
*
|
|
@@ -34076,24 +34808,36 @@ declare class DataController {
|
|
|
34076
34808
|
* console.log(`Transaction: ${result.transactionHash}`);
|
|
34077
34809
|
* ```
|
|
34078
34810
|
*/
|
|
34079
|
-
addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<FilePermissionResult
|
|
34811
|
+
addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
|
|
34080
34812
|
/**
|
|
34081
|
-
* Submits a file permission transaction
|
|
34813
|
+
* Submits a file permission transaction to the blockchain.
|
|
34082
34814
|
*
|
|
34083
|
-
*
|
|
34815
|
+
* @remarks
|
|
34816
|
+
* This method supports gasless transactions via relayer callbacks when configured.
|
|
34817
|
+
* It encrypts the user's encryption key with the recipient's public key before submission.
|
|
34084
34818
|
* Use this when you want to handle transaction confirmation and event parsing separately.
|
|
34085
34819
|
*
|
|
34086
|
-
* @param fileId - The ID of the file to
|
|
34087
|
-
* @param account - The
|
|
34088
|
-
* @param publicKey - The public key
|
|
34089
|
-
*
|
|
34820
|
+
* @param fileId - The ID of the file to grant permission for
|
|
34821
|
+
* @param account - The recipient's wallet address that will access the file
|
|
34822
|
+
* @param publicKey - The recipient's public key for encryption.
|
|
34823
|
+
* Obtain via `vana.server.getIdentity(account).public_key`
|
|
34824
|
+
* @returns Promise resolving to TransactionHandle for tracking the transaction
|
|
34825
|
+
* @throws {Error} When chain ID is not available
|
|
34826
|
+
* @throws {Error} When encryption key generation fails
|
|
34827
|
+
* @throws {Error} When public key encryption fails
|
|
34828
|
+
*
|
|
34090
34829
|
* @example
|
|
34091
34830
|
* ```typescript
|
|
34092
|
-
* const
|
|
34093
|
-
*
|
|
34831
|
+
* const tx = await vana.data.submitFilePermission(
|
|
34832
|
+
* fileId,
|
|
34833
|
+
* "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
|
|
34834
|
+
* recipientPublicKey
|
|
34835
|
+
* );
|
|
34836
|
+
* const result = await tx.waitForEvents();
|
|
34837
|
+
* console.log(`Permission granted with ID: ${result.permissionId}`);
|
|
34094
34838
|
* ```
|
|
34095
34839
|
*/
|
|
34096
|
-
submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<
|
|
34840
|
+
submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
|
|
34097
34841
|
/**
|
|
34098
34842
|
* Gets the encrypted key for a specific account's permission to access a file.
|
|
34099
34843
|
*
|
|
@@ -34189,10 +34933,10 @@ declare class DataController {
|
|
|
34189
34933
|
gateways?: string[];
|
|
34190
34934
|
}): Promise<Blob>;
|
|
34191
34935
|
/**
|
|
34192
|
-
* Validates a data schema against the Vana meta-schema.
|
|
34936
|
+
* Validates a data schema definition against the Vana meta-schema.
|
|
34193
34937
|
*
|
|
34194
|
-
* @param schema - The data schema to validate
|
|
34195
|
-
* @returns
|
|
34938
|
+
* @param schema - The data schema definition to validate
|
|
34939
|
+
* @returns The validated DataSchema
|
|
34196
34940
|
* @throws SchemaValidationError if invalid
|
|
34197
34941
|
* @example
|
|
34198
34942
|
* ```typescript
|
|
@@ -34209,10 +34953,10 @@ declare class DataController {
|
|
|
34209
34953
|
* }
|
|
34210
34954
|
* };
|
|
34211
34955
|
*
|
|
34212
|
-
* vana.data.
|
|
34956
|
+
* const validatedSchema = vana.data.validateDataSchemaAgainstMetaSchema(schema);
|
|
34213
34957
|
* ```
|
|
34214
34958
|
*/
|
|
34215
|
-
|
|
34959
|
+
validateDataSchemaAgainstMetaSchema(schema: unknown): DataSchema;
|
|
34216
34960
|
/**
|
|
34217
34961
|
* Validates data against a JSON Schema from a data schema.
|
|
34218
34962
|
*
|
|
@@ -34242,9 +34986,9 @@ declare class DataController {
|
|
|
34242
34986
|
*/
|
|
34243
34987
|
validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
|
|
34244
34988
|
/**
|
|
34245
|
-
* Fetches and validates a schema from a URL, then returns the parsed data schema.
|
|
34989
|
+
* Fetches and validates a data schema from a URL, then returns the parsed data schema.
|
|
34246
34990
|
*
|
|
34247
|
-
* @param url - The URL to fetch the schema from
|
|
34991
|
+
* @param url - The URL to fetch the data schema from
|
|
34248
34992
|
* @returns The validated data schema
|
|
34249
34993
|
* @throws SchemaValidationError if invalid or fetch fails
|
|
34250
34994
|
* @example
|
|
@@ -34260,24 +35004,56 @@ declare class DataController {
|
|
|
34260
35004
|
* ```
|
|
34261
35005
|
*/
|
|
34262
35006
|
fetchAndValidateSchema(url: string): Promise<DataSchema>;
|
|
35007
|
+
}
|
|
35008
|
+
|
|
35009
|
+
/**
|
|
35010
|
+
* Configuration options for polling server operations.
|
|
35011
|
+
*/
|
|
35012
|
+
interface PollingOptions {
|
|
35013
|
+
/** Polling interval in milliseconds (default: 500) */
|
|
35014
|
+
pollingInterval?: number;
|
|
35015
|
+
/** Maximum time to wait in milliseconds (default: 30000) */
|
|
35016
|
+
timeout?: number;
|
|
35017
|
+
}
|
|
35018
|
+
/**
|
|
35019
|
+
* Provides a Promise-based interface for server operation lifecycle management.
|
|
35020
|
+
*
|
|
35021
|
+
* @remarks
|
|
35022
|
+
* OperationHandle enables immediate access to operation IDs while providing
|
|
35023
|
+
* Promise-based methods for waiting on results. This pattern matches
|
|
35024
|
+
* TransactionHandle for consistency across the SDK's async operations.
|
|
35025
|
+
*
|
|
35026
|
+
* @category Server Operations
|
|
35027
|
+
*/
|
|
35028
|
+
declare class OperationHandle<T = unknown> {
|
|
35029
|
+
private readonly controller;
|
|
35030
|
+
readonly id: string;
|
|
35031
|
+
private _resultPromise?;
|
|
35032
|
+
constructor(controller: ServerController, id: string);
|
|
34263
35033
|
/**
|
|
34264
|
-
*
|
|
35034
|
+
* Waits for the operation to complete and returns the result.
|
|
34265
35035
|
*
|
|
34266
|
-
* @
|
|
34267
|
-
*
|
|
34268
|
-
*
|
|
35036
|
+
* @remarks
|
|
35037
|
+
* Results are memoized - multiple calls return the same promise.
|
|
35038
|
+
* The method polls the server at regular intervals until the operation
|
|
35039
|
+
* succeeds, fails, or times out. Returns the raw string result from the
|
|
35040
|
+
* server - callers are responsible for parsing if needed.
|
|
35041
|
+
*
|
|
35042
|
+
* @param options - Optional polling configuration
|
|
35043
|
+
* @returns The operation result as a string when completed
|
|
35044
|
+
* @throws {PersonalServerError} When the operation fails or times out
|
|
34269
35045
|
* @example
|
|
34270
35046
|
* ```typescript
|
|
34271
|
-
*
|
|
34272
|
-
*
|
|
34273
|
-
*
|
|
34274
|
-
*
|
|
34275
|
-
*
|
|
34276
|
-
*
|
|
34277
|
-
* }
|
|
35047
|
+
* const result = await handle.waitForResult({
|
|
35048
|
+
* timeout: 60000,
|
|
35049
|
+
* pollingInterval: 500
|
|
35050
|
+
* });
|
|
35051
|
+
* // If expecting JSON, parse it:
|
|
35052
|
+
* const data = JSON.parse(result);
|
|
34278
35053
|
* ```
|
|
34279
35054
|
*/
|
|
34280
|
-
|
|
35055
|
+
waitForResult(options?: PollingOptions): Promise<T>;
|
|
35056
|
+
private pollForCompletion;
|
|
34281
35057
|
}
|
|
34282
35058
|
|
|
34283
35059
|
/**
|
|
@@ -34360,54 +35136,47 @@ declare class ServerController {
|
|
|
34360
35136
|
*/
|
|
34361
35137
|
getIdentity(request: InitPersonalServerParams): Promise<PersonalServerIdentity>;
|
|
34362
35138
|
/**
|
|
34363
|
-
* Creates
|
|
35139
|
+
* Creates a server operation and returns a handle for lifecycle management.
|
|
34364
35140
|
*
|
|
34365
35141
|
* @remarks
|
|
34366
|
-
* This method submits a computation request to the personal server
|
|
34367
|
-
*
|
|
34368
|
-
*
|
|
35142
|
+
* This method submits a computation request to the personal server and returns
|
|
35143
|
+
* an OperationHandle that provides Promise-based methods for waiting on results.
|
|
35144
|
+
* The handle pattern matches TransactionHandle for consistency across async operations.
|
|
35145
|
+
*
|
|
35146
|
+
* @param params - The operation request parameters
|
|
34369
35147
|
* @param params.permissionId - The permission ID authorizing this operation.
|
|
34370
|
-
* Obtain
|
|
34371
|
-
* @returns
|
|
34372
|
-
* @throws {PersonalServerError} When server request fails or parameters are invalid
|
|
34373
|
-
*
|
|
34374
|
-
* @throws {NetworkError} When personal server API communication fails.
|
|
34375
|
-
* Check server URL configuration and network connectivity.
|
|
35148
|
+
* Obtain via `vana.permissions.getUserPermissionGrantsOnChain()`.
|
|
35149
|
+
* @returns An OperationHandle providing access to the operation ID and result methods
|
|
35150
|
+
* @throws {PersonalServerError} When the server request fails or parameters are invalid
|
|
35151
|
+
* @throws {NetworkError} When personal server API communication fails
|
|
34376
35152
|
* @example
|
|
34377
35153
|
* ```typescript
|
|
34378
|
-
* const
|
|
34379
|
-
* permissionId: 123
|
|
35154
|
+
* const operation = await vana.server.createOperation({
|
|
35155
|
+
* permissionId: 123
|
|
34380
35156
|
* });
|
|
35157
|
+
* console.log(`Operation ID: ${operation.id}`);
|
|
34381
35158
|
*
|
|
34382
|
-
*
|
|
35159
|
+
* // Wait for completion
|
|
35160
|
+
* const result = await operation.waitForResult();
|
|
35161
|
+
* console.log("Result:", result);
|
|
34383
35162
|
* ```
|
|
34384
35163
|
*/
|
|
34385
|
-
createOperation(params: CreateOperationParams): Promise<
|
|
35164
|
+
createOperation<T = unknown>(params: CreateOperationParams): Promise<OperationHandle<T>>;
|
|
34386
35165
|
/**
|
|
34387
|
-
*
|
|
35166
|
+
* Retrieves the current status and result of a server operation.
|
|
34388
35167
|
*
|
|
34389
35168
|
* @remarks
|
|
34390
|
-
*
|
|
34391
|
-
*
|
|
34392
|
-
*
|
|
34393
|
-
*
|
|
34394
|
-
*
|
|
34395
|
-
*
|
|
34396
|
-
* @param operationId - The operation ID returned from the initial request submission
|
|
34397
|
-
* @returns A Promise that resolves to the current operation response with status and results
|
|
34398
|
-
* @throws {NetworkError} When the polling request fails or returns invalid data
|
|
35169
|
+
* Common status values: `starting`, `running`, `succeeded`, `failed`, `canceled`.
|
|
35170
|
+
* When status is `succeeded`, the result field contains the operation output.
|
|
35171
|
+
*
|
|
35172
|
+
* @param operationId - The ID of the operation to query
|
|
35173
|
+
* @returns The operation response containing status, result, and metadata
|
|
35174
|
+
* @throws {NetworkError} When the API request fails or returns invalid data
|
|
34399
35175
|
* @example
|
|
34400
35176
|
* ```typescript
|
|
34401
|
-
*
|
|
34402
|
-
*
|
|
34403
|
-
*
|
|
34404
|
-
* while (result.status === "processing") {
|
|
34405
|
-
* await new Promise(resolve => setTimeout(resolve, 1000));
|
|
34406
|
-
* result = await vana.server.getOperation(response.id);
|
|
34407
|
-
* }
|
|
34408
|
-
*
|
|
34409
|
-
* if (result.status === "succeeded") {
|
|
34410
|
-
* console.log("Computation completed:", result.output);
|
|
35177
|
+
* const status = await vana.server.getOperation(operationId);
|
|
35178
|
+
* if (status.status === 'succeeded') {
|
|
35179
|
+
* console.log('Result:', JSON.parse(status.result));
|
|
34411
35180
|
* }
|
|
34412
35181
|
* ```
|
|
34413
35182
|
*/
|
|
@@ -34480,6 +35249,31 @@ interface Chains {
|
|
|
34480
35249
|
}
|
|
34481
35250
|
declare const chains: Chains;
|
|
34482
35251
|
|
|
35252
|
+
/**
|
|
35253
|
+
* Creates or retrieves a cached public client for blockchain read operations.
|
|
35254
|
+
*
|
|
35255
|
+
* @remarks
|
|
35256
|
+
* This function provides an optimized way to access blockchain data by maintaining
|
|
35257
|
+
* a cached client instance per chain. The client is used for reading contract state,
|
|
35258
|
+
* querying events, and other read-only blockchain operations. It automatically
|
|
35259
|
+
* handles HTTP transport configuration and chain switching.
|
|
35260
|
+
*
|
|
35261
|
+
* @param chainId - The chain ID to connect to (defaults to Moksha testnet)
|
|
35262
|
+
* @returns A public client configured for the specified chain with caching optimization
|
|
35263
|
+
* @throws {Error} When the specified chain ID is not supported by the SDK
|
|
35264
|
+
* @example
|
|
35265
|
+
* ```typescript
|
|
35266
|
+
* // Get client for default chain (Moksha testnet)
|
|
35267
|
+
* const client = createClient();
|
|
35268
|
+
*
|
|
35269
|
+
* // Get client for specific chain
|
|
35270
|
+
* const mainnetClient = createClient(14800);
|
|
35271
|
+
*
|
|
35272
|
+
* // Use client for blockchain reads
|
|
35273
|
+
* const blockNumber = await client.getBlockNumber();
|
|
35274
|
+
* ```
|
|
35275
|
+
* @category Blockchain
|
|
35276
|
+
*/
|
|
34483
35277
|
declare const createClient: (chainId?: keyof typeof chains) => PublicClient & {
|
|
34484
35278
|
chain: Chain;
|
|
34485
35279
|
};
|
|
@@ -35198,51 +35992,157 @@ declare class SerializationError extends VanaError {
|
|
|
35198
35992
|
constructor(message: string);
|
|
35199
35993
|
}
|
|
35200
35994
|
/**
|
|
35201
|
-
*
|
|
35995
|
+
* Thrown when a signature operation fails or cannot be completed.
|
|
35202
35996
|
*
|
|
35203
35997
|
* @remarks
|
|
35204
|
-
*
|
|
35205
|
-
*
|
|
35206
|
-
*
|
|
35998
|
+
* This error occurs when wallet signature operations fail due to disconnection,
|
|
35999
|
+
* locked accounts, or other wallet-related issues. It preserves the original
|
|
36000
|
+
* error for debugging while providing consistent error handling across the SDK.
|
|
36001
|
+
*
|
|
36002
|
+
* Recovery strategies:
|
|
36003
|
+
* - Check wallet connection and account unlock status
|
|
36004
|
+
* - Retry operation with explicit user interaction
|
|
36005
|
+
* - For gasless operations, consider switching to direct transactions
|
|
36006
|
+
*
|
|
36007
|
+
* @example
|
|
36008
|
+
* ```typescript
|
|
36009
|
+
* try {
|
|
36010
|
+
* await vana.permissions.grant({ grantee: '0x...' });
|
|
36011
|
+
* } catch (error) {
|
|
36012
|
+
* if (error instanceof SignatureError) {
|
|
36013
|
+
* // Prompt user to unlock wallet
|
|
36014
|
+
* await promptWalletUnlock();
|
|
36015
|
+
* // Retry operation
|
|
36016
|
+
* }
|
|
36017
|
+
* }
|
|
36018
|
+
* ```
|
|
36019
|
+
* @category Error Handling
|
|
35207
36020
|
*/
|
|
35208
36021
|
declare class SignatureError extends VanaError {
|
|
35209
36022
|
readonly originalError?: Error | undefined;
|
|
35210
36023
|
constructor(message: string, originalError?: Error | undefined);
|
|
35211
36024
|
}
|
|
35212
36025
|
/**
|
|
35213
|
-
*
|
|
36026
|
+
* Thrown when network communication fails during API calls or blockchain interactions.
|
|
35214
36027
|
*
|
|
35215
36028
|
* @remarks
|
|
35216
|
-
*
|
|
35217
|
-
*
|
|
36029
|
+
* This error encompasses network connectivity issues, API unavailability,
|
|
36030
|
+
* timeout errors, and CORS restrictions. It's commonly encountered during
|
|
36031
|
+
* IPFS operations, subgraph queries, or RPC calls.
|
|
36032
|
+
*
|
|
36033
|
+
* Recovery strategies:
|
|
36034
|
+
* - Check network connectivity
|
|
36035
|
+
* - Retry with exponential backoff
|
|
36036
|
+
* - Verify API endpoints are accessible
|
|
36037
|
+
* - Switch to alternative network providers or gateways
|
|
36038
|
+
*
|
|
36039
|
+
* @example
|
|
36040
|
+
* ```typescript
|
|
36041
|
+
* try {
|
|
36042
|
+
* const files = await vana.data.getUserFiles({ owner: '0x...' });
|
|
36043
|
+
* } catch (error) {
|
|
36044
|
+
* if (error instanceof NetworkError) {
|
|
36045
|
+
* // Implement retry with exponential backoff
|
|
36046
|
+
* await retryWithBackoff(() => vana.data.getUserFiles({ owner: '0x...' }));
|
|
36047
|
+
* }
|
|
36048
|
+
* }
|
|
36049
|
+
* ```
|
|
36050
|
+
* @category Error Handling
|
|
35218
36051
|
*/
|
|
35219
36052
|
declare class NetworkError extends VanaError {
|
|
35220
36053
|
readonly originalError?: Error | undefined;
|
|
35221
36054
|
constructor(message: string, originalError?: Error | undefined);
|
|
35222
36055
|
}
|
|
35223
36056
|
/**
|
|
35224
|
-
*
|
|
36057
|
+
* Thrown when transaction nonce retrieval fails during gasless operations.
|
|
35225
36058
|
*
|
|
35226
36059
|
* @remarks
|
|
35227
|
-
*
|
|
35228
|
-
*
|
|
36060
|
+
* This error occurs when the SDK cannot retrieve the user's current nonce from
|
|
36061
|
+
* smart contracts, preventing gasless transaction submission. Nonces are critical
|
|
36062
|
+
* for preventing replay attacks in signed transactions.
|
|
36063
|
+
*
|
|
36064
|
+
* Recovery strategies:
|
|
36065
|
+
* - Retry nonce retrieval after brief delay
|
|
36066
|
+
* - Check wallet connection and account status
|
|
36067
|
+
* - Use manual nonce specification if supported by the operation
|
|
36068
|
+
* - Switch to direct transactions as fallback
|
|
36069
|
+
*
|
|
36070
|
+
* @example
|
|
36071
|
+
* ```typescript
|
|
36072
|
+
* try {
|
|
36073
|
+
* await vana.permissions.grant({ grantee: '0x...' });
|
|
36074
|
+
* } catch (error) {
|
|
36075
|
+
* if (error instanceof NonceError) {
|
|
36076
|
+
* // Wait and retry
|
|
36077
|
+
* await delay(1000);
|
|
36078
|
+
* await vana.permissions.grant({ grantee: '0x...' });
|
|
36079
|
+
* }
|
|
36080
|
+
* }
|
|
36081
|
+
* ```
|
|
36082
|
+
* @category Error Handling
|
|
35229
36083
|
*/
|
|
35230
36084
|
declare class NonceError extends VanaError {
|
|
35231
36085
|
constructor(message: string);
|
|
35232
36086
|
}
|
|
35233
36087
|
/**
|
|
35234
|
-
*
|
|
36088
|
+
* Thrown when personal server operations fail or cannot be completed.
|
|
35235
36089
|
*
|
|
35236
36090
|
* @remarks
|
|
35237
|
-
*
|
|
35238
|
-
*
|
|
36091
|
+
* This error occurs during interactions with personal servers for computation
|
|
36092
|
+
* requests, identity retrieval, or operation status checks. Common causes include
|
|
36093
|
+
* server unavailability, untrusted server status, or invalid permission grants.
|
|
36094
|
+
*
|
|
36095
|
+
* Recovery strategies:
|
|
36096
|
+
* - Verify server URL accessibility
|
|
36097
|
+
* - Check server trust status via `vana.permissions.getTrustedServers()`
|
|
36098
|
+
* - Ensure valid permissions exist for the operation
|
|
36099
|
+
* - Retry after server becomes available
|
|
36100
|
+
*
|
|
36101
|
+
* @example
|
|
36102
|
+
* ```typescript
|
|
36103
|
+
* try {
|
|
36104
|
+
* const result = await vana.server.createOperation({ permissionId: 123 });
|
|
36105
|
+
* } catch (error) {
|
|
36106
|
+
* if (error instanceof PersonalServerError) {
|
|
36107
|
+
* // Check if server is trusted
|
|
36108
|
+
* const trustedServers = await vana.permissions.getTrustedServers();
|
|
36109
|
+
* if (!trustedServers.includes(serverId)) {
|
|
36110
|
+
* await vana.permissions.trustServer({ serverId });
|
|
36111
|
+
* }
|
|
36112
|
+
* }
|
|
36113
|
+
* }
|
|
36114
|
+
* ```
|
|
36115
|
+
* @category Error Handling
|
|
35239
36116
|
*/
|
|
35240
36117
|
declare class PersonalServerError extends VanaError {
|
|
35241
36118
|
readonly originalError?: Error | undefined;
|
|
35242
36119
|
constructor(message: string, originalError?: Error | undefined);
|
|
35243
36120
|
}
|
|
35244
36121
|
/**
|
|
35245
|
-
*
|
|
36122
|
+
* Thrown when attempting to register a server with a URL different from its existing registration.
|
|
36123
|
+
*
|
|
36124
|
+
* @remarks
|
|
36125
|
+
* This error occurs when trying to add or trust a server that's already registered
|
|
36126
|
+
* on-chain with a different URL. Server URLs are immutable once registered to
|
|
36127
|
+
* maintain consistency and security. Applications should use the existing URL
|
|
36128
|
+
* or register a new server with a different ID.
|
|
36129
|
+
*
|
|
36130
|
+
* @example
|
|
36131
|
+
* ```typescript
|
|
36132
|
+
* try {
|
|
36133
|
+
* await vana.permissions.addAndTrustServer({
|
|
36134
|
+
* serverId: 1,
|
|
36135
|
+
* serverUrl: 'https://new-url.com',
|
|
36136
|
+
* publicKey: '0x...'
|
|
36137
|
+
* });
|
|
36138
|
+
* } catch (error) {
|
|
36139
|
+
* if (error instanceof ServerUrlMismatchError) {
|
|
36140
|
+
* console.log(`Server already registered with: ${error.existingUrl}`);
|
|
36141
|
+
* // Use existing URL or register new server
|
|
36142
|
+
* }
|
|
36143
|
+
* }
|
|
36144
|
+
* ```
|
|
36145
|
+
* @category Error Handling
|
|
35246
36146
|
*/
|
|
35247
36147
|
declare class ServerUrlMismatchError extends VanaError {
|
|
35248
36148
|
constructor(existingUrl: string, providedUrl: string, serverId: string);
|
|
@@ -35251,7 +36151,25 @@ declare class ServerUrlMismatchError extends VanaError {
|
|
|
35251
36151
|
readonly serverId: string;
|
|
35252
36152
|
}
|
|
35253
36153
|
/**
|
|
35254
|
-
*
|
|
36154
|
+
* Thrown when permission grant, revoke, or validation operations fail.
|
|
36155
|
+
*
|
|
36156
|
+
* @remarks
|
|
36157
|
+
* This error occurs during permission management operations including grants,
|
|
36158
|
+
* revocations, and permission validation checks. Common causes include invalid
|
|
36159
|
+
* grantee addresses, expired permissions, or insufficient privileges.
|
|
36160
|
+
*
|
|
36161
|
+
* @example
|
|
36162
|
+
* ```typescript
|
|
36163
|
+
* try {
|
|
36164
|
+
* await vana.permissions.revoke({ permissionId: 999999 });
|
|
36165
|
+
* } catch (error) {
|
|
36166
|
+
* if (error instanceof PermissionError) {
|
|
36167
|
+
* console.error('Permission operation failed:', error.message);
|
|
36168
|
+
* // Permission may not exist or user may not be owner
|
|
36169
|
+
* }
|
|
36170
|
+
* }
|
|
36171
|
+
* ```
|
|
36172
|
+
* @category Error Handling
|
|
35255
36173
|
*/
|
|
35256
36174
|
declare class PermissionError extends VanaError {
|
|
35257
36175
|
readonly originalError?: Error | undefined;
|
|
@@ -36259,21 +37177,53 @@ declare function withSignatureCache(cache: VanaCacheAdapter, walletAddress: stri
|
|
|
36259
37177
|
|
|
36260
37178
|
declare const CONTRACT_ADDRESSES: Record<number, Record<string, string>>;
|
|
36261
37179
|
/**
|
|
36262
|
-
* Retrieves the deployed contract address for a specific contract on a given chain.
|
|
37180
|
+
* Retrieves the deployed contract address for a specific Vana protocol contract on a given chain.
|
|
36263
37181
|
*
|
|
36264
|
-
* @
|
|
36265
|
-
*
|
|
36266
|
-
*
|
|
36267
|
-
*
|
|
37182
|
+
* @remarks
|
|
37183
|
+
* This function provides type-safe access to contract addresses across all supported Vana networks.
|
|
37184
|
+
* It automatically searches both current and legacy contract registries to ensure backwards
|
|
37185
|
+
* compatibility while providing clear error messages for unsupported combinations.
|
|
37186
|
+
*
|
|
37187
|
+
* The function validates that both the chain ID and contract name are supported before
|
|
37188
|
+
* attempting address lookup, helping developers identify deployment or configuration issues
|
|
37189
|
+
* early in the development process.
|
|
37190
|
+
*
|
|
37191
|
+
* **Supported Chains:**
|
|
37192
|
+
* - 14800: Vana Mainnet
|
|
37193
|
+
* - 1480: Moksha Testnet
|
|
37194
|
+
*
|
|
37195
|
+
* **Contract Categories:**
|
|
37196
|
+
* - Data Management: DataRegistry, DataRefinerRegistry
|
|
37197
|
+
* - Permissions: DataPortabilityPermissions, DataPortabilityServers, DataPortabilityGrantees
|
|
37198
|
+
* - Computing: TeePoolPhala, TeePoolDedicatedGpu, etc.
|
|
37199
|
+
* - Token & Governance: DATImplementation, VanaPoolStaking, etc.
|
|
37200
|
+
*
|
|
37201
|
+
* @param chainId - The chain ID to look up the contract on (14800 for mainnet, 1480 for testnet)
|
|
37202
|
+
* @param contract - The contract name to get the address for (use TypeScript autocomplete for available options)
|
|
37203
|
+
* @returns The contract address as a checksummed hex string (0x...)
|
|
37204
|
+
* @throws {Error} When contract address not found for the specified contract and chain combination.
|
|
37205
|
+
* This typically indicates the contract is not deployed on the requested network.
|
|
36268
37206
|
* @example
|
|
36269
37207
|
* ```typescript
|
|
37208
|
+
* // Get core protocol contract addresses
|
|
37209
|
+
* const dataRegistry = getContractAddress(14800, 'DataRegistry');
|
|
37210
|
+
* const permissions = getContractAddress(14800, 'DataPortabilityPermissions');
|
|
37211
|
+
* const trustedServers = getContractAddress(14800, 'DataPortabilityServers');
|
|
37212
|
+
*
|
|
37213
|
+
* // Handle unsupported combinations gracefully
|
|
36270
37214
|
* try {
|
|
36271
|
-
* const
|
|
36272
|
-
* console.log('DataRegistry address:',
|
|
37215
|
+
* const address = getContractAddress(1480, 'DataRegistry');
|
|
37216
|
+
* console.log('DataRegistry testnet address:', address);
|
|
36273
37217
|
* } catch (error) {
|
|
36274
|
-
* console.error('Contract not
|
|
37218
|
+
* console.error('Contract not available on testnet:', error.message);
|
|
37219
|
+
* // Fallback to mainnet or show user-friendly error
|
|
36275
37220
|
* }
|
|
37221
|
+
*
|
|
37222
|
+
* // TypeScript provides autocomplete for contract names
|
|
37223
|
+
* const poolAddress = getContractAddress(14800, 'TeePoolPhala'); // ✅ Valid
|
|
37224
|
+
* // const invalid = getContractAddress(14800, 'InvalidContract'); // ❌ TypeScript error
|
|
36276
37225
|
* ```
|
|
37226
|
+
* @category Configuration
|
|
36277
37227
|
*/
|
|
36278
37228
|
declare const getContractAddress: (chainId: keyof typeof CONTRACT_ADDRESSES, contract: VanaContract) => `0x${string}`;
|
|
36279
37229
|
|
|
@@ -36448,6 +37398,10 @@ declare class CircuitBreaker {
|
|
|
36448
37398
|
*
|
|
36449
37399
|
* This implementation uses browser-compatible libraries and configurations
|
|
36450
37400
|
* to provide crypto, PGP, and HTTP functionality without Node.js dependencies.
|
|
37401
|
+
*
|
|
37402
|
+
* WARNING: Dependencies that access globals during init
|
|
37403
|
+
* MUST be dynamically imported to support Turbopack.
|
|
37404
|
+
* See: https://github.com/vercel/next.js/issues/82632
|
|
36451
37405
|
*/
|
|
36452
37406
|
|
|
36453
37407
|
/**
|
|
@@ -36787,4 +37741,4 @@ declare function Vana(config: VanaConfig): VanaBrowserImpl;
|
|
|
36787
37741
|
*/
|
|
36788
37742
|
type VanaInstance = VanaBrowserImpl;
|
|
36789
37743
|
|
|
36790
|
-
export { type $defs, type APIResponse, type AddAndTrustServerInput, type AddAndTrustServerParams, type AddAndTrustServerTypedData, type AddRefinerParams, type AddRefinerResult, type AddSchemaParams, type AddSchemaResult, type AllKeys, ApiClient, type ApiClientConfig, type ApiResponse, AsyncQueue, type AsyncResult, type AuthenticationErrorResponse, type Awaited, type BaseConfig, type BaseConfigWithStorage, BaseController, type BatchServerInfoResult, type BatchUploadParams, type BatchUploadResult, type BlockRange, BlockchainError, type BlockchainErrorResponse, type Brand, BrowserPlatformAdapter, type Cache, type CacheConfig, CallbackStorage, type ChainConfig, type ChainConfigWithStorage, type CheckPermissionParams, CircuitBreaker, type ComputeErrorResponse, type ConditionalOptional, type ConfigValidationOptions, type ConfigValidationResult, type ContractAddresses, type ContractCall, type ContractDeployment, ContractFactory, type ContractInfo, type ContractMethodParams, type ContractMethodReturnType, ContractNotFoundError, type Controller, type ControllerContext, type CreateOperationParams, type CreateOperationRequest, type CreateOperationResponse, type CreateSchemaParams, type CreateSchemaResult, DEFAULT_ENCRYPTION_SEED, DEFAULT_IPFS_GATEWAY, DataController, type DataSchema, type DecryptionErrorResponse, type DeepPartial, type DeepReadonly, type DeleteFileParams, type DeleteFileResult, type DownloadFileParams, type DownloadFileResult, type EncryptedUploadParams, type EncryptionInfo, type ErrorResponse, EventEmitter, type EventFilter, type EventLog, type Factory, type FileAccessErrorResponse, type FileAccessPermissions, type FileMetadata, type FilePermissionParams, type FileSharingConfig, type GasEstimate, type GenericRequest, type GenericResponse, type GenericTypedData, type GetFileParams, type GetOperationResponse, type GetUserFilesParams, type GetUserPermissionsOptions, type GetUserTrustedServersParams,
|
|
37744
|
+
export { type $defs, type APIResponse, type AddAndTrustServerInput, type AddAndTrustServerParams, type AddAndTrustServerTypedData, type AddRefinerParams, type AddRefinerResult, type AddSchemaParams, type AddSchemaResult, type AllKeys, ApiClient, type ApiClientConfig, type ApiResponse, AsyncQueue, type AsyncResult, type AuthenticationErrorResponse, type Awaited, type BaseConfig, type BaseConfigWithStorage, BaseController, type BatchServerInfoResult, type BatchUploadParams, type BatchUploadResult, type BlockRange, BlockchainError, type BlockchainErrorResponse, type Brand, BrowserPlatformAdapter, type Cache, type CacheConfig, CallbackStorage, type ChainConfig, type ChainConfigWithStorage, type CheckPermissionParams, CircuitBreaker, type CompleteSchema, type ComputeErrorResponse, type ConditionalOptional, type ConfigValidationOptions, type ConfigValidationResult, type ContractAddresses, type ContractCall, type ContractDeployment, ContractFactory, type ContractInfo, type ContractMethodParams, type ContractMethodReturnType, ContractNotFoundError, type Controller, type ControllerContext, type CreateOperationParams, type CreateOperationRequest, type CreateOperationResponse, type CreateSchemaParams, type CreateSchemaResult, DEFAULT_ENCRYPTION_SEED, DEFAULT_IPFS_GATEWAY, DataController, type DataSchema, type DecryptionErrorResponse, type DeepPartial, type DeepReadonly, type DeleteFileParams, type DeleteFileResult, type DownloadFileParams, type DownloadFileResult, type EncryptedUploadParams, type EncryptionInfo, type ErrorResponse, EventEmitter, type EventFilter, type EventLog, type Factory, type FileAccessErrorResponse, type FileAccessPermissions, type FileMetadata, type FilePermissionParams, type FileSharingConfig, type GasEstimate, type GenericRequest, type GenericResponse, type GenericTypedData, type GetFileParams, type GetOperationResponse, type GetUserFilesParams, type GetUserPermissionsOptions, type GetUserTrustedServersParams, GoogleDriveStorage, GrantExpiredError, type GrantFile, type GrantPermissionParams, GrantSchemaError, GrantValidationError, type GrantValidationErrorResponse, type GrantValidationOptions, type GrantValidationResult, type GrantedPermission, type Grantee, type GranteeInfo, GranteeMismatchError, type GranteeQueryOptions, type HttpMethod, IPFS_GATEWAYS, type IdentityResponseModel, type InitPersonalServerParams, type InternalServerErrorResponse, InvalidConfigurationError, IpfsStorage, type LegacyPermissionParams, type MaybeArray, type MaybePromise, MemoryCache, type Middleware, MiddlewarePipeline, NetworkError, type NetworkInfo, type Nominal, type NonNullable, NonceError, type NotFoundErrorResponse, type Observable, type Observer, type OmitByType, type OnChainPermissionGrant, type OperationErrorResponse, OperationNotAllowedError, type OptionalKeys, type PaginatedGrantees, type PaginatedTrustedServers, type PaginationParams, type PaginationResult, type PartialExcept, type Permission, type PermissionAnalytics, type PermissionCheckResult, PermissionError, type PermissionEvent, type PermissionGrantDomain, type PermissionGrantMessage, type PermissionGrantTypedData, type PermissionInfo, type PermissionInputMessage, type PermissionOperation, type PermissionQueryResult, type PermissionStatus, PermissionsController, PersonalServerError, type PersonalServerIdentity, type PersonalServerModel, type PickByType, type PinataListResponse, type PinataPin, PinataStorage, type PinataUploadResponse, type Plugin, type PostRequestParams, type PromiseResult, ProtocolController, type QueryPermissionsParams, type RateLimitInfo, RateLimiter, type RateLimiterConfig, type Refiner, type RegisterGranteeInput, type RegisterGranteeParams, type RegisterGranteeTypedData, type RelayerCallbacks, type RelayerConfig, RelayerError, type RelayerErrorResponse, type RelayerMetrics, type RelayerQueueInfo, type RelayerRequestOptions, type RelayerStatus, type RelayerStorageResponse, type RelayerStoreParams, type RelayerSubmitParams, type RelayerTransactionResponse, type RelayerTransactionStatus, type RelayerWebhookConfig, type RelayerWebhookPayload, type ReplicateAPIResponse, type ReplicateStatus, type Repository, type RequestOptions, type RequireKeys, type RequiredExcept, type RetryConfig, RetryUtility, type RevokePermissionInput, type RevokePermissionParams, type RuntimeConfig, type Schema, type SchemaMetadata, SchemaValidationError, SchemaValidator, SerializationError, type Server, type components as ServerComponents, ServerController, type $defs as ServerDefs, type ServerFilesAndPermissionParams, type ServerFilesAndPermissionTypedData, type ServerInfo, type operations as ServerOperations, type paths as ServerPaths, type ServerTrustStatus, ServerUrlMismatchError, type webhooks as ServerWebhooks, type Service, SignatureCache, SignatureError, type SimplifiedPermissionMessage, type StateMachine, type StatusInfo, type StorageCallbacks, type StorageConfig, type StorageDownloadOptions, StorageError, type StorageFile, type StorageListOptions, type StorageListResult, StorageManager, type StorageProvider, type StorageProviderConfig, type StorageRequiredMarker, type StorageUploadResult, type TimeRange, TransactionHandle, type TransactionOptions, type TransactionReceipt, type Transformer, type TrustServerInput, type TrustServerParams, type TrustServerTypedData, type TrustedServer, type TrustedServerInfo, type TrustedServerQueryOptions, type UnencryptedUploadParams, type UntrustServerInput, type UntrustServerParams, type UntrustServerTypedData, type UpdateSchemaIdParams, type UpdateSchemaIdResult, type UploadEncryptedFileResult, type UploadFileParams, type UploadFileResult, type UploadParams, type UploadProgress, type UploadResult, type UserFile, UserRejectedRequestError, type ValidationErrorResponse, type ValidationResult, type Validator, Vana, VanaBrowserImpl, type VanaChain, type VanaChainConfig, type VanaChainId, type VanaConfig, type VanaConfigWithStorage, type VanaContract, type VanaContract as VanaContractAbi, type VanaContractInstance, type VanaContractName, VanaCore, VanaCoreFactory, VanaError, type VanaInstance, type VanaPlatformAdapter, type WalletConfig, type WalletConfigWithStorage, __contractCache, chains, checkGrantAccess, clearContractCache, type components, convertIpfsUrl, convertIpfsUrlWithFallbacks, createAndStoreGrant, createBrowserPlatformAdapter, createGrantFile, createPlatformAdapterSafe, createValidatedGrant, decryptBlobWithSignedKey, decryptWithPrivateKey, decryptWithWalletPrivateKey, Vana as default, detectPlatform, encryptBlobWithSignedKey, encryptFileKey, encryptWithWalletPublicKey, extractIpfsHash, fetchAndValidateSchema, fetchWithFallbacks, formatEth, formatNumber, formatToken, generateEncryptionKey, generateEncryptionKeyPair, generatePGPKeyPair, getAbi, getAllChains, getChainConfig, getContractAddress, getContractController, getContractInfo, getEncryptionParameters, getGatewayUrls, getGrantFileHash, getGrantTimeRemaining, getPlatformCapabilities, hasStorageConfig, isAPIResponse, isChainConfig, isGrantExpired, isIpfsUrl, isPlatformSupported, isReplicateAPIResponse, isVanaChain, isVanaChainId, isWalletConfig, moksha, mokshaTestnet, type operations, parseReplicateOutput, type paths, retrieveAndValidateGrant, retrieveGrantFile, safeParseJSON, schemaValidator, shortenAddress, storeGrantFile, summarizeGrant, validateDataAgainstSchema, validateDataSchemaAgainstMetaSchema, validateGrant, validateGrantExpiry, validateGrantFile, validateGranteeAccess, validateOperationAccess, vanaMainnet, type webhooks, withSignatureCache };
|