@opendatalabs/vana-sdk 0.1.0-alpha.c3ea747 → 0.1.0-alpha.c4bed73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chains.browser.cjs +2 -2
- package/dist/chains.browser.cjs.map +1 -1
- package/dist/chains.browser.js +2 -2
- package/dist/chains.browser.js.map +1 -1
- package/dist/chains.cjs +2 -2
- package/dist/chains.cjs.map +1 -1
- package/dist/chains.js +2 -2
- package/dist/chains.js.map +1 -1
- package/dist/chains.node.cjs +2 -2
- package/dist/chains.node.cjs.map +1 -1
- package/dist/chains.node.js +2 -2
- package/dist/chains.node.js.map +1 -1
- package/dist/index.browser.d.ts +1185 -200
- package/dist/index.browser.js +34594 -33127
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +35137 -33665
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.cts +1215 -205
- package/dist/index.node.d.ts +1215 -205
- package/dist/index.node.js +35018 -33549
- package/dist/index.node.js.map +1 -1
- package/package.json +2 -9
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
|
|
|
@@ -984,6 +984,8 @@ interface ServerFilesAndPermissionParams {
|
|
|
984
984
|
grant: string;
|
|
985
985
|
/** File URLs */
|
|
986
986
|
fileUrls: string[];
|
|
987
|
+
/** Schema IDs for each file - use 0 for files without schema validation */
|
|
988
|
+
schemaIds: number[];
|
|
987
989
|
/** Server address */
|
|
988
990
|
serverAddress: Address;
|
|
989
991
|
/** Server URL */
|
|
@@ -1009,6 +1011,8 @@ interface ServerFilesAndPermissionTypedData extends GenericTypedData {
|
|
|
1009
1011
|
grant: string;
|
|
1010
1012
|
/** File URLs */
|
|
1011
1013
|
fileUrls: string[];
|
|
1014
|
+
/** Schema IDs for each file - use 0 for files without schema validation */
|
|
1015
|
+
schemaIds: bigint[];
|
|
1012
1016
|
/** Server address */
|
|
1013
1017
|
serverAddress: Address;
|
|
1014
1018
|
/** Server URL */
|
|
@@ -1019,6 +1023,39 @@ interface ServerFilesAndPermissionTypedData extends GenericTypedData {
|
|
|
1019
1023
|
filePermissions: Permission[][];
|
|
1020
1024
|
};
|
|
1021
1025
|
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Input structure for FilePermission typed data
|
|
1028
|
+
*
|
|
1029
|
+
* @category Permissions
|
|
1030
|
+
*/
|
|
1031
|
+
interface FilePermissionInput extends RecordCompatible {
|
|
1032
|
+
/** User nonce */
|
|
1033
|
+
nonce: bigint;
|
|
1034
|
+
/** File ID to grant permission for */
|
|
1035
|
+
fileId: number;
|
|
1036
|
+
/** Account address to grant permission to */
|
|
1037
|
+
account: Address;
|
|
1038
|
+
/** Encrypted key for the permission */
|
|
1039
|
+
encryptedKey: string;
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* EIP-712 typed data for FilePermission
|
|
1043
|
+
*
|
|
1044
|
+
* @category Permissions
|
|
1045
|
+
*/
|
|
1046
|
+
interface FilePermissionTypedData extends GenericTypedData {
|
|
1047
|
+
/** EIP-712 types */
|
|
1048
|
+
types: {
|
|
1049
|
+
FilePermission: Array<{
|
|
1050
|
+
name: string;
|
|
1051
|
+
type: string;
|
|
1052
|
+
}>;
|
|
1053
|
+
};
|
|
1054
|
+
/** Primary type */
|
|
1055
|
+
primaryType: "FilePermission";
|
|
1056
|
+
/** Message to sign */
|
|
1057
|
+
message: FilePermissionInput;
|
|
1058
|
+
}
|
|
1022
1059
|
|
|
1023
1060
|
/**
|
|
1024
1061
|
* Marker interface to indicate that a Vana instance has storage configured.
|
|
@@ -1243,6 +1280,22 @@ interface RelayerCallbacks {
|
|
|
1243
1280
|
* @returns Promise resolving to the storage URL
|
|
1244
1281
|
*/
|
|
1245
1282
|
storeGrantFile?: (grantData: GrantFile) => Promise<string>;
|
|
1283
|
+
/**
|
|
1284
|
+
* Submit a signed file permission transaction for relay
|
|
1285
|
+
*
|
|
1286
|
+
* @param params - Complete parameters for file permission
|
|
1287
|
+
* @param params.fileId - The file ID to grant permission for
|
|
1288
|
+
* @param params.account - The account address to grant permission to
|
|
1289
|
+
* @param params.encryptedKey - The encrypted key for the permission
|
|
1290
|
+
* @param params.userAddress - The user's address (owner of the file)
|
|
1291
|
+
* @returns Promise resolving to the transaction hash
|
|
1292
|
+
*/
|
|
1293
|
+
submitFilePermission?: (params: {
|
|
1294
|
+
fileId: number;
|
|
1295
|
+
account: Address;
|
|
1296
|
+
encryptedKey: string;
|
|
1297
|
+
userAddress: Address;
|
|
1298
|
+
}) => Promise<Hash>;
|
|
1246
1299
|
}
|
|
1247
1300
|
/**
|
|
1248
1301
|
* Storage callback functions for flexible storage operations.
|
|
@@ -1748,6 +1801,12 @@ interface UserFile$1 {
|
|
|
1748
1801
|
transactionHash?: Address;
|
|
1749
1802
|
/** Additional file properties and custom application data. */
|
|
1750
1803
|
metadata?: FileMetadata;
|
|
1804
|
+
/**
|
|
1805
|
+
* Array of DLP IDs that have submitted proofs for this file.
|
|
1806
|
+
* Each proof represents verification or processing by a Data Liquidity Pool.
|
|
1807
|
+
* Obtain DLP details via `vana.data.getDLP(dlpId)`.
|
|
1808
|
+
*/
|
|
1809
|
+
dlpIds?: number[];
|
|
1751
1810
|
}
|
|
1752
1811
|
/**
|
|
1753
1812
|
* Provides optional metadata for uploaded files and content description.
|
|
@@ -2159,33 +2218,84 @@ interface BatchUploadResult {
|
|
|
2159
2218
|
errors?: string[];
|
|
2160
2219
|
}
|
|
2161
2220
|
/**
|
|
2162
|
-
*
|
|
2221
|
+
* Schema metadata from the blockchain (without fetched definition).
|
|
2222
|
+
*
|
|
2223
|
+
* This represents the on-chain schema registration data before the
|
|
2224
|
+
* definition has been fetched from the storage URL.
|
|
2225
|
+
*
|
|
2226
|
+
* @category Data Management
|
|
2227
|
+
*/
|
|
2228
|
+
interface SchemaMetadata {
|
|
2229
|
+
/** Schema ID */
|
|
2230
|
+
id: number;
|
|
2231
|
+
/** Schema name */
|
|
2232
|
+
name: string;
|
|
2233
|
+
/** Schema dialect ('json' or 'sqlite') */
|
|
2234
|
+
dialect: "json" | "sqlite";
|
|
2235
|
+
/** URL containing the schema definition */
|
|
2236
|
+
definitionUrl: string;
|
|
2237
|
+
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Complete schema with all definition fields populated.
|
|
2240
|
+
* This is what schemas.get() returns - a schema with the definition fetched.
|
|
2241
|
+
*/
|
|
2242
|
+
interface CompleteSchema extends SchemaMetadata {
|
|
2243
|
+
/** Version of the schema */
|
|
2244
|
+
version: string;
|
|
2245
|
+
/** Optional description of the schema */
|
|
2246
|
+
description?: string;
|
|
2247
|
+
/** Optional version of the dialect */
|
|
2248
|
+
dialectVersion?: string;
|
|
2249
|
+
/** The actual schema - JSON Schema object for 'json' dialect, DDL string for 'sqlite' */
|
|
2250
|
+
schema: object | string;
|
|
2251
|
+
}
|
|
2252
|
+
/**
|
|
2253
|
+
* Schema with optional definition fields.
|
|
2163
2254
|
*
|
|
2164
2255
|
* Schemas define the structure and validation rules for user data processed by refiners.
|
|
2165
2256
|
* They ensure data quality and consistency across the Vana network by specifying how
|
|
2166
2257
|
* raw user data should be formatted, validated, and processed.
|
|
2167
2258
|
*
|
|
2259
|
+
* When the definition has been fetched (via schemas.get() or schemas.list() with includeDefinitions),
|
|
2260
|
+
* the version and schema fields will be populated. Otherwise, only the metadata fields are present.
|
|
2261
|
+
*
|
|
2168
2262
|
* @category Data Management
|
|
2169
2263
|
* @example
|
|
2170
2264
|
* ```typescript
|
|
2171
|
-
*
|
|
2265
|
+
* // Complete schema from schemas.get()
|
|
2266
|
+
* const completeSchema: Schema = {
|
|
2172
2267
|
* id: 5,
|
|
2173
2268
|
* name: 'Social Media Profile',
|
|
2174
|
-
*
|
|
2175
|
-
*
|
|
2176
|
-
*
|
|
2269
|
+
* dialect: 'json',
|
|
2270
|
+
* definitionUrl: 'ipfs://QmSchema...',
|
|
2271
|
+
* version: '1.0.0',
|
|
2272
|
+
* description: 'Schema for validating social media profile data',
|
|
2273
|
+
* schema: { // JSON Schema object
|
|
2274
|
+
* type: 'object',
|
|
2275
|
+
* properties: {
|
|
2276
|
+
* username: { type: 'string' }
|
|
2277
|
+
* }
|
|
2278
|
+
* }
|
|
2279
|
+
* };
|
|
2280
|
+
*
|
|
2281
|
+
* // Metadata-only schema from schemas.list() without includeDefinitions
|
|
2282
|
+
* const metadataSchema: Schema = {
|
|
2283
|
+
* id: 5,
|
|
2284
|
+
* name: 'Social Media Profile',
|
|
2285
|
+
* dialect: 'json',
|
|
2286
|
+
* definitionUrl: 'ipfs://QmSchema...'
|
|
2177
2287
|
* };
|
|
2178
2288
|
* ```
|
|
2179
2289
|
*/
|
|
2180
|
-
interface Schema {
|
|
2181
|
-
/**
|
|
2182
|
-
|
|
2183
|
-
/**
|
|
2184
|
-
|
|
2185
|
-
/**
|
|
2186
|
-
|
|
2187
|
-
/**
|
|
2188
|
-
|
|
2290
|
+
interface Schema extends SchemaMetadata {
|
|
2291
|
+
/** Version of the schema (present when definition is fetched) */
|
|
2292
|
+
version?: string;
|
|
2293
|
+
/** Optional description of the schema */
|
|
2294
|
+
description?: string;
|
|
2295
|
+
/** Optional version of the dialect */
|
|
2296
|
+
dialectVersion?: string;
|
|
2297
|
+
/** The actual schema - JSON Schema object for 'json' dialect, DDL string for 'sqlite' (present when definition is fetched) */
|
|
2298
|
+
schema?: object | string;
|
|
2189
2299
|
}
|
|
2190
2300
|
/**
|
|
2191
2301
|
* Represents a refiner with schema information
|
|
@@ -2441,6 +2551,18 @@ declare const contractAbis: {
|
|
|
2441
2551
|
}];
|
|
2442
2552
|
readonly name: "InvalidPermissionsLength";
|
|
2443
2553
|
readonly type: "error";
|
|
2554
|
+
}, {
|
|
2555
|
+
readonly inputs: readonly [{
|
|
2556
|
+
readonly internalType: "uint256";
|
|
2557
|
+
readonly name: "filesLength";
|
|
2558
|
+
readonly type: "uint256";
|
|
2559
|
+
}, {
|
|
2560
|
+
readonly internalType: "uint256";
|
|
2561
|
+
readonly name: "schemaIdsLength";
|
|
2562
|
+
readonly type: "uint256";
|
|
2563
|
+
}];
|
|
2564
|
+
readonly name: "InvalidSchemaIdsLength";
|
|
2565
|
+
readonly type: "error";
|
|
2444
2566
|
}, {
|
|
2445
2567
|
readonly inputs: readonly [];
|
|
2446
2568
|
readonly name: "InvalidSignature";
|
|
@@ -2717,6 +2839,10 @@ declare const contractAbis: {
|
|
|
2717
2839
|
readonly internalType: "string[]";
|
|
2718
2840
|
readonly name: "fileUrls";
|
|
2719
2841
|
readonly type: "string[]";
|
|
2842
|
+
}, {
|
|
2843
|
+
readonly internalType: "uint256[]";
|
|
2844
|
+
readonly name: "schemaIds";
|
|
2845
|
+
readonly type: "uint256[]";
|
|
2720
2846
|
}, {
|
|
2721
2847
|
readonly internalType: "address";
|
|
2722
2848
|
readonly name: "serverAddress";
|
|
@@ -3699,7 +3825,7 @@ declare const contractAbis: {
|
|
|
3699
3825
|
readonly name: "addServerInput";
|
|
3700
3826
|
readonly type: "tuple";
|
|
3701
3827
|
}];
|
|
3702
|
-
readonly name: "
|
|
3828
|
+
readonly name: "addAndTrustServerByManager";
|
|
3703
3829
|
readonly outputs: readonly [];
|
|
3704
3830
|
readonly stateMutability: "nonpayable";
|
|
3705
3831
|
readonly type: "function";
|
|
@@ -4087,6 +4213,20 @@ declare const contractAbis: {
|
|
|
4087
4213
|
readonly outputs: readonly [];
|
|
4088
4214
|
readonly stateMutability: "nonpayable";
|
|
4089
4215
|
readonly type: "function";
|
|
4216
|
+
}, {
|
|
4217
|
+
readonly inputs: readonly [{
|
|
4218
|
+
readonly internalType: "address";
|
|
4219
|
+
readonly name: "userAddress";
|
|
4220
|
+
readonly type: "address";
|
|
4221
|
+
}, {
|
|
4222
|
+
readonly internalType: "uint256";
|
|
4223
|
+
readonly name: "serverId";
|
|
4224
|
+
readonly type: "uint256";
|
|
4225
|
+
}];
|
|
4226
|
+
readonly name: "trustServerByManager";
|
|
4227
|
+
readonly outputs: readonly [];
|
|
4228
|
+
readonly stateMutability: "nonpayable";
|
|
4229
|
+
readonly type: "function";
|
|
4090
4230
|
}, {
|
|
4091
4231
|
readonly inputs: readonly [{
|
|
4092
4232
|
readonly components: readonly [{
|
|
@@ -5145,6 +5285,31 @@ declare const contractAbis: {
|
|
|
5145
5285
|
}];
|
|
5146
5286
|
readonly name: "FileAdded";
|
|
5147
5287
|
readonly type: "event";
|
|
5288
|
+
}, {
|
|
5289
|
+
readonly anonymous: false;
|
|
5290
|
+
readonly inputs: readonly [{
|
|
5291
|
+
readonly indexed: true;
|
|
5292
|
+
readonly internalType: "uint256";
|
|
5293
|
+
readonly name: "fileId";
|
|
5294
|
+
readonly type: "uint256";
|
|
5295
|
+
}, {
|
|
5296
|
+
readonly indexed: true;
|
|
5297
|
+
readonly internalType: "address";
|
|
5298
|
+
readonly name: "ownerAddress";
|
|
5299
|
+
readonly type: "address";
|
|
5300
|
+
}, {
|
|
5301
|
+
readonly indexed: false;
|
|
5302
|
+
readonly internalType: "string";
|
|
5303
|
+
readonly name: "url";
|
|
5304
|
+
readonly type: "string";
|
|
5305
|
+
}, {
|
|
5306
|
+
readonly indexed: false;
|
|
5307
|
+
readonly internalType: "uint256";
|
|
5308
|
+
readonly name: "schemaId";
|
|
5309
|
+
readonly type: "uint256";
|
|
5310
|
+
}];
|
|
5311
|
+
readonly name: "FileAddedV2";
|
|
5312
|
+
readonly type: "event";
|
|
5148
5313
|
}, {
|
|
5149
5314
|
readonly anonymous: false;
|
|
5150
5315
|
readonly inputs: readonly [{
|
|
@@ -5571,6 +5736,16 @@ declare const contractAbis: {
|
|
|
5571
5736
|
}];
|
|
5572
5737
|
readonly stateMutability: "view";
|
|
5573
5738
|
readonly type: "function";
|
|
5739
|
+
}, {
|
|
5740
|
+
readonly inputs: readonly [];
|
|
5741
|
+
readonly name: "emitLegacyEvents";
|
|
5742
|
+
readonly outputs: readonly [{
|
|
5743
|
+
readonly internalType: "bool";
|
|
5744
|
+
readonly name: "";
|
|
5745
|
+
readonly type: "bool";
|
|
5746
|
+
}];
|
|
5747
|
+
readonly stateMutability: "view";
|
|
5748
|
+
readonly type: "function";
|
|
5574
5749
|
}, {
|
|
5575
5750
|
readonly inputs: readonly [{
|
|
5576
5751
|
readonly internalType: "string";
|
|
@@ -5689,6 +5864,10 @@ declare const contractAbis: {
|
|
|
5689
5864
|
readonly internalType: "string";
|
|
5690
5865
|
readonly name: "url";
|
|
5691
5866
|
readonly type: "string";
|
|
5867
|
+
}, {
|
|
5868
|
+
readonly internalType: "uint256";
|
|
5869
|
+
readonly name: "schemaId";
|
|
5870
|
+
readonly type: "uint256";
|
|
5692
5871
|
}, {
|
|
5693
5872
|
readonly internalType: "uint256";
|
|
5694
5873
|
readonly name: "addedAtBlock";
|
|
@@ -5906,6 +6085,16 @@ declare const contractAbis: {
|
|
|
5906
6085
|
readonly outputs: readonly [];
|
|
5907
6086
|
readonly stateMutability: "nonpayable";
|
|
5908
6087
|
readonly type: "function";
|
|
6088
|
+
}, {
|
|
6089
|
+
readonly inputs: readonly [{
|
|
6090
|
+
readonly internalType: "bool";
|
|
6091
|
+
readonly name: "newEmitLegacyEvents";
|
|
6092
|
+
readonly type: "bool";
|
|
6093
|
+
}];
|
|
6094
|
+
readonly name: "updateEmitLegacyEvents";
|
|
6095
|
+
readonly outputs: readonly [];
|
|
6096
|
+
readonly stateMutability: "nonpayable";
|
|
6097
|
+
readonly type: "function";
|
|
5909
6098
|
}, {
|
|
5910
6099
|
readonly inputs: readonly [{
|
|
5911
6100
|
readonly internalType: "address";
|
|
@@ -28710,6 +28899,95 @@ type VanaContract = keyof ContractAbis;
|
|
|
28710
28899
|
*/
|
|
28711
28900
|
declare function getAbi<T extends VanaContract>(contract: T): ContractAbis[T];
|
|
28712
28901
|
|
|
28902
|
+
/**
|
|
28903
|
+
* Comprehensive mapping of SDK transaction operations to blockchain events.
|
|
28904
|
+
* Used by the generic transaction parser to know which contract and event
|
|
28905
|
+
* to look for when parsing transaction results.
|
|
28906
|
+
*/
|
|
28907
|
+
declare const EVENT_MAPPINGS: {
|
|
28908
|
+
readonly grant: {
|
|
28909
|
+
readonly contract: "DataPortabilityPermissions";
|
|
28910
|
+
readonly event: "PermissionAdded";
|
|
28911
|
+
};
|
|
28912
|
+
readonly revoke: {
|
|
28913
|
+
readonly contract: "DataPortabilityPermissions";
|
|
28914
|
+
readonly event: "PermissionRevoked";
|
|
28915
|
+
};
|
|
28916
|
+
readonly revokePermission: {
|
|
28917
|
+
readonly contract: "DataPortabilityPermissions";
|
|
28918
|
+
readonly event: "PermissionRevoked";
|
|
28919
|
+
};
|
|
28920
|
+
readonly addServerFilesAndPermissions: {
|
|
28921
|
+
readonly contract: "DataPortabilityPermissions";
|
|
28922
|
+
readonly event: "PermissionAdded";
|
|
28923
|
+
};
|
|
28924
|
+
readonly trustServer: {
|
|
28925
|
+
readonly contract: "DataPortabilityServers";
|
|
28926
|
+
readonly event: "ServerTrusted";
|
|
28927
|
+
};
|
|
28928
|
+
readonly untrustServer: {
|
|
28929
|
+
readonly contract: "DataPortabilityServers";
|
|
28930
|
+
readonly event: "ServerUntrusted";
|
|
28931
|
+
};
|
|
28932
|
+
readonly registerServer: {
|
|
28933
|
+
readonly contract: "DataPortabilityServers";
|
|
28934
|
+
readonly event: "ServerRegistered";
|
|
28935
|
+
};
|
|
28936
|
+
readonly updateServer: {
|
|
28937
|
+
readonly contract: "DataPortabilityServers";
|
|
28938
|
+
readonly event: "ServerUpdated";
|
|
28939
|
+
};
|
|
28940
|
+
readonly addAndTrustServer: {
|
|
28941
|
+
readonly contract: "DataPortabilityServers";
|
|
28942
|
+
readonly event: "ServerTrusted";
|
|
28943
|
+
};
|
|
28944
|
+
readonly addFile: {
|
|
28945
|
+
readonly contract: "DataRegistry";
|
|
28946
|
+
readonly event: "FileAddedV2";
|
|
28947
|
+
};
|
|
28948
|
+
readonly addFileWithPermissionsAndSchema: {
|
|
28949
|
+
readonly contract: "DataRegistry";
|
|
28950
|
+
readonly event: "FileAddedV2";
|
|
28951
|
+
};
|
|
28952
|
+
readonly addFileWithSchema: {
|
|
28953
|
+
readonly contract: "DataRegistry";
|
|
28954
|
+
readonly event: "FileAddedV2";
|
|
28955
|
+
};
|
|
28956
|
+
readonly addFileWithPermissions: {
|
|
28957
|
+
readonly contract: "DataRegistry";
|
|
28958
|
+
readonly event: "FileAddedV2";
|
|
28959
|
+
};
|
|
28960
|
+
readonly addRefinement: {
|
|
28961
|
+
readonly contract: "DataRegistry";
|
|
28962
|
+
readonly event: "RefinementAdded";
|
|
28963
|
+
};
|
|
28964
|
+
readonly addRefiner: {
|
|
28965
|
+
readonly contract: "DataRefinerRegistry";
|
|
28966
|
+
readonly event: "RefinerAdded";
|
|
28967
|
+
};
|
|
28968
|
+
readonly updateSchemaId: {
|
|
28969
|
+
readonly contract: "DataRefinerRegistry";
|
|
28970
|
+
readonly event: "SchemaAdded";
|
|
28971
|
+
};
|
|
28972
|
+
readonly addSchema: {
|
|
28973
|
+
readonly contract: "DataRefinerRegistry";
|
|
28974
|
+
readonly event: "SchemaAdded";
|
|
28975
|
+
};
|
|
28976
|
+
readonly updateRefinement: {
|
|
28977
|
+
readonly contract: "DataRegistry";
|
|
28978
|
+
readonly event: "RefinementUpdated";
|
|
28979
|
+
};
|
|
28980
|
+
readonly addFilePermission: {
|
|
28981
|
+
readonly contract: "DataRegistry";
|
|
28982
|
+
readonly event: "PermissionGranted";
|
|
28983
|
+
};
|
|
28984
|
+
readonly registerGrantee: {
|
|
28985
|
+
readonly contract: "DataPortabilityGrantees";
|
|
28986
|
+
readonly event: "GranteeRegistered";
|
|
28987
|
+
};
|
|
28988
|
+
};
|
|
28989
|
+
type TransactionOperation = keyof typeof EVENT_MAPPINGS;
|
|
28990
|
+
|
|
28713
28991
|
/**
|
|
28714
28992
|
* Base interface for all transaction results.
|
|
28715
28993
|
* Contains the event data plus transaction metadata.
|
|
@@ -28747,6 +29025,50 @@ interface PermissionRevokeResult extends BaseTransactionResult {
|
|
|
28747
29025
|
/** ID of the permission that was revoked */
|
|
28748
29026
|
permissionId: bigint;
|
|
28749
29027
|
}
|
|
29028
|
+
/**
|
|
29029
|
+
* Result of a successful server trust operation.
|
|
29030
|
+
* Contains data from the ServerTrusted blockchain event.
|
|
29031
|
+
*/
|
|
29032
|
+
interface ServerTrustResult extends BaseTransactionResult {
|
|
29033
|
+
/** Address of the user who trusted the server */
|
|
29034
|
+
user: Address;
|
|
29035
|
+
/** Address/ID of the trusted server */
|
|
29036
|
+
serverId: Address;
|
|
29037
|
+
/** URL of the trusted server */
|
|
29038
|
+
serverUrl: string;
|
|
29039
|
+
}
|
|
29040
|
+
/**
|
|
29041
|
+
* Result of a successful server untrust operation.
|
|
29042
|
+
* Contains data from the ServerUntrusted blockchain event.
|
|
29043
|
+
*/
|
|
29044
|
+
interface ServerUntrustResult extends BaseTransactionResult {
|
|
29045
|
+
/** Address of the user who untrusted the server */
|
|
29046
|
+
user: Address;
|
|
29047
|
+
/** Address/ID of the untrusted server */
|
|
29048
|
+
serverId: Address;
|
|
29049
|
+
}
|
|
29050
|
+
/**
|
|
29051
|
+
* Result of a successful server update operation.
|
|
29052
|
+
* Contains data from the ServerUpdated blockchain event.
|
|
29053
|
+
*/
|
|
29054
|
+
interface ServerUpdateResult extends BaseTransactionResult {
|
|
29055
|
+
/** ID of the server that was updated */
|
|
29056
|
+
serverId: bigint;
|
|
29057
|
+
/** New URL of the server */
|
|
29058
|
+
url: string;
|
|
29059
|
+
}
|
|
29060
|
+
/**
|
|
29061
|
+
* Result of a successful grantee registration operation.
|
|
29062
|
+
* Contains data from the GranteeRegistered blockchain event.
|
|
29063
|
+
*/
|
|
29064
|
+
interface GranteeRegisterResult extends BaseTransactionResult {
|
|
29065
|
+
/** Unique grantee ID assigned by the registry */
|
|
29066
|
+
granteeId: bigint;
|
|
29067
|
+
/** Address of the registered grantee */
|
|
29068
|
+
granteeAddress: Address;
|
|
29069
|
+
/** Display name of the grantee */
|
|
29070
|
+
name: string;
|
|
29071
|
+
}
|
|
28750
29072
|
/**
|
|
28751
29073
|
* Result of a successful file permission addition operation.
|
|
28752
29074
|
* Contains data from the FilePermissionAdded blockchain event.
|
|
@@ -28760,6 +29082,80 @@ interface FilePermissionResult extends BaseTransactionResult {
|
|
|
28760
29082
|
encryptedKey: string;
|
|
28761
29083
|
}
|
|
28762
29084
|
|
|
29085
|
+
/**
|
|
29086
|
+
* Provides a unified interface for blockchain transaction results with lazy-loaded event parsing.
|
|
29087
|
+
*
|
|
29088
|
+
* @remarks
|
|
29089
|
+
* TransactionHandle enables immediate access to transaction hashes while providing optional
|
|
29090
|
+
* lazy-loaded access to receipts and parsed event data. All transaction-submitting methods
|
|
29091
|
+
* in the SDK return this handle, allowing developers to choose between immediate hash access
|
|
29092
|
+
* or waiting for event data. Results are memoized to prevent redundant network calls.
|
|
29093
|
+
*
|
|
29094
|
+
* @category Transactions
|
|
29095
|
+
* @example
|
|
29096
|
+
* ```typescript
|
|
29097
|
+
* // Immediate hash access
|
|
29098
|
+
* const tx = await sdk.permissions.submitSignedGrant(typedData, signature);
|
|
29099
|
+
* console.log(`Transaction submitted: ${tx.hash}`);
|
|
29100
|
+
*
|
|
29101
|
+
* // Wait for and parse events
|
|
29102
|
+
* const eventData = await tx.waitForEvents();
|
|
29103
|
+
* console.log(`Permission ID: ${eventData.permissionId}`);
|
|
29104
|
+
*
|
|
29105
|
+
* // Check receipt for gas usage
|
|
29106
|
+
* const receipt = await tx.waitForReceipt();
|
|
29107
|
+
* console.log(`Gas used: ${receipt.gasUsed}`);
|
|
29108
|
+
* ```
|
|
29109
|
+
*/
|
|
29110
|
+
declare class TransactionHandle<TEventData = unknown> {
|
|
29111
|
+
private readonly context;
|
|
29112
|
+
readonly hash: Hash;
|
|
29113
|
+
private readonly operation?;
|
|
29114
|
+
private _receipt?;
|
|
29115
|
+
private _eventData?;
|
|
29116
|
+
private _receiptPromise?;
|
|
29117
|
+
private _eventPromise?;
|
|
29118
|
+
constructor(context: ControllerContext$1, hash: Hash, operation?: TransactionOperation | undefined);
|
|
29119
|
+
/**
|
|
29120
|
+
* Waits for transaction confirmation and returns the receipt.
|
|
29121
|
+
* Results are memoized - multiple calls return the same promise.
|
|
29122
|
+
*
|
|
29123
|
+
* @param options Optional timeout configuration
|
|
29124
|
+
* @param options.timeout Timeout in milliseconds (default: 30000)
|
|
29125
|
+
* @returns Transaction receipt with gas usage, logs, and status
|
|
29126
|
+
*/
|
|
29127
|
+
waitForReceipt(options?: {
|
|
29128
|
+
timeout?: number;
|
|
29129
|
+
}): Promise<TransactionReceipt$1>;
|
|
29130
|
+
/**
|
|
29131
|
+
* Waits for transaction confirmation and parses emitted events.
|
|
29132
|
+
* Results are memoized - multiple calls return the same promise.
|
|
29133
|
+
*
|
|
29134
|
+
* @returns Parsed event data with transaction metadata
|
|
29135
|
+
* @throws {Error} If no operation was specified for event parsing
|
|
29136
|
+
*/
|
|
29137
|
+
waitForEvents(): Promise<TEventData>;
|
|
29138
|
+
/**
|
|
29139
|
+
* Enables string coercion for backwards compatibility.
|
|
29140
|
+
* Allows TransactionHandle to be used anywhere a Hash is expected.
|
|
29141
|
+
*
|
|
29142
|
+
* @example
|
|
29143
|
+
* ```typescript
|
|
29144
|
+
* const hash: Hash = tx; // Works via toString()
|
|
29145
|
+
* console.log(`Transaction: ${tx}`); // Prints hash
|
|
29146
|
+
* ```
|
|
29147
|
+
* @returns The transaction hash as a string
|
|
29148
|
+
*/
|
|
29149
|
+
toString(): string;
|
|
29150
|
+
/**
|
|
29151
|
+
* JSON serialization support.
|
|
29152
|
+
* Returns the hash when serialized to JSON.
|
|
29153
|
+
*
|
|
29154
|
+
* @returns The transaction hash for JSON serialization
|
|
29155
|
+
*/
|
|
29156
|
+
toJSON(): string;
|
|
29157
|
+
}
|
|
29158
|
+
|
|
28763
29159
|
/**
|
|
28764
29160
|
* Google Drive Storage Provider for Vana SDK
|
|
28765
29161
|
*
|
|
@@ -29798,30 +30194,31 @@ declare class PermissionsController {
|
|
|
29798
30194
|
*/
|
|
29799
30195
|
grant(params: GrantPermissionParams$1): Promise<PermissionGrantResult>;
|
|
29800
30196
|
/**
|
|
29801
|
-
* Submits a permission grant transaction and returns
|
|
30197
|
+
* Submits a permission grant transaction and returns a handle for flexible result access.
|
|
29802
30198
|
*
|
|
29803
|
-
*
|
|
29804
|
-
*
|
|
29805
|
-
*
|
|
30199
|
+
* @remarks
|
|
30200
|
+
* This lower-level method provides maximum control over transaction timing.
|
|
30201
|
+
* Returns a TransactionHandle that allows immediate hash access or optional event parsing.
|
|
30202
|
+
* Use this when handling multiple transactions or when you need granular control.
|
|
29806
30203
|
*
|
|
29807
30204
|
* @param params - The permission grant configuration object
|
|
29808
|
-
* @returns Promise
|
|
30205
|
+
* @returns Promise resolving to TransactionHandle with hash and event parsing capabilities
|
|
29809
30206
|
* @throws {RelayerError} When gasless transaction submission fails
|
|
29810
30207
|
* @throws {SignatureError} When user rejects the signature request
|
|
29811
30208
|
* @throws {SerializationError} When grant data cannot be serialized
|
|
29812
30209
|
* @throws {BlockchainError} When permission grant preparation fails
|
|
29813
30210
|
* @example
|
|
29814
30211
|
* ```typescript
|
|
29815
|
-
* // Submit transaction and
|
|
29816
|
-
* const
|
|
29817
|
-
* console.log(`Transaction submitted: ${
|
|
30212
|
+
* // Submit transaction and get immediate hash access
|
|
30213
|
+
* const tx = await vana.permissions.submitPermissionGrant(params);
|
|
30214
|
+
* console.log(`Transaction submitted: ${tx.hash}`);
|
|
29818
30215
|
*
|
|
29819
|
-
* //
|
|
29820
|
-
* const
|
|
29821
|
-
* console.log(`Permission ID: ${
|
|
30216
|
+
* // Optionally wait for and parse events
|
|
30217
|
+
* const eventData = await tx.waitForEvents();
|
|
30218
|
+
* console.log(`Permission ID: ${eventData.permissionId}`);
|
|
29822
30219
|
* ```
|
|
29823
30220
|
*/
|
|
29824
|
-
submitPermissionGrant(params: GrantPermissionParams$1): Promise<
|
|
30221
|
+
submitPermissionGrant(params: GrantPermissionParams$1): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
29825
30222
|
/**
|
|
29826
30223
|
* Prepares a permission grant with preview before signing.
|
|
29827
30224
|
*
|
|
@@ -29849,15 +30246,21 @@ declare class PermissionsController {
|
|
|
29849
30246
|
*/
|
|
29850
30247
|
prepareGrant(params: GrantPermissionParams$1): Promise<{
|
|
29851
30248
|
preview: GrantFile;
|
|
29852
|
-
confirm: () => Promise<
|
|
30249
|
+
confirm: () => Promise<TransactionHandle<PermissionGrantResult>>;
|
|
29853
30250
|
}>;
|
|
29854
30251
|
/**
|
|
29855
|
-
*
|
|
29856
|
-
*
|
|
30252
|
+
* Completes the grant process after user confirmation.
|
|
30253
|
+
*
|
|
30254
|
+
* @remarks
|
|
30255
|
+
* This internal method is called by the confirm() function returned from prepareGrant().
|
|
30256
|
+
* It handles IPFS upload, signature creation, and transaction submission.
|
|
29857
30257
|
*
|
|
29858
30258
|
* @param params - The permission grant parameters containing user and operation details
|
|
29859
30259
|
* @param grantFile - The prepared grant file with permissions and metadata
|
|
29860
|
-
* @returns Promise resolving to
|
|
30260
|
+
* @returns Promise resolving to TransactionHandle for flexible result access
|
|
30261
|
+
* @throws {BlockchainError} When permission grant confirmation fails
|
|
30262
|
+
* @throws {NetworkError} When IPFS upload fails
|
|
30263
|
+
* @throws {SignatureError} When user rejects the signature
|
|
29861
30264
|
*/
|
|
29862
30265
|
private confirmGrantInternal;
|
|
29863
30266
|
/**
|
|
@@ -29913,49 +30316,106 @@ declare class PermissionsController {
|
|
|
29913
30316
|
* );
|
|
29914
30317
|
* ```
|
|
29915
30318
|
*/
|
|
29916
|
-
submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<
|
|
30319
|
+
submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
29917
30320
|
/**
|
|
29918
30321
|
* Submits an already-signed trust server transaction to the blockchain.
|
|
30322
|
+
*
|
|
30323
|
+
* @remarks
|
|
29919
30324
|
* This method extracts the trust server input from typed data and submits it directly.
|
|
30325
|
+
* Used internally by trust server methods after signature collection.
|
|
29920
30326
|
*
|
|
29921
30327
|
* @param typedData - The EIP-712 typed data for TrustServer
|
|
29922
|
-
* @param signature - The user's signature
|
|
29923
|
-
* @returns Promise resolving to
|
|
30328
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
30329
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30330
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30331
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
30332
|
+
* @example
|
|
30333
|
+
* ```typescript
|
|
30334
|
+
* const txHandle = await vana.permissions.submitSignedTrustServer(
|
|
30335
|
+
* typedData,
|
|
30336
|
+
* "0x1234..."
|
|
30337
|
+
* );
|
|
30338
|
+
* const result = await txHandle.waitForEvents();
|
|
30339
|
+
* ```
|
|
29924
30340
|
*/
|
|
29925
|
-
submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<
|
|
30341
|
+
submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
|
|
29926
30342
|
/**
|
|
29927
30343
|
* Submits an already-signed add and trust server transaction to the blockchain.
|
|
30344
|
+
*
|
|
30345
|
+
* @remarks
|
|
29928
30346
|
* This method extracts the add and trust server input from typed data and submits it directly.
|
|
30347
|
+
* Combines server registration and trust operations in a single transaction.
|
|
29929
30348
|
*
|
|
29930
30349
|
* @param typedData - The EIP-712 typed data for AddAndTrustServer
|
|
29931
|
-
* @param signature - The user's signature
|
|
29932
|
-
* @returns Promise resolving to
|
|
30350
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
30351
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30352
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30353
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
30354
|
+
* @example
|
|
30355
|
+
* ```typescript
|
|
30356
|
+
* const txHandle = await vana.permissions.submitSignedAddAndTrustServer(
|
|
30357
|
+
* typedData,
|
|
30358
|
+
* "0x1234..."
|
|
30359
|
+
* );
|
|
30360
|
+
* const result = await txHandle.waitForEvents();
|
|
30361
|
+
* ```
|
|
29933
30362
|
*/
|
|
29934
|
-
submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<
|
|
30363
|
+
submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
|
|
29935
30364
|
/**
|
|
29936
30365
|
* Submits an already-signed permission revoke transaction to the blockchain.
|
|
30366
|
+
*
|
|
30367
|
+
* @remarks
|
|
29937
30368
|
* This method handles the revocation of previously granted permissions.
|
|
30369
|
+
* Used internally by revocation methods after signature collection.
|
|
29938
30370
|
*
|
|
29939
30371
|
* @param typedData - The EIP-712 typed data for PermissionRevoke
|
|
29940
|
-
* @param signature - The user's signature
|
|
29941
|
-
* @returns Promise resolving to
|
|
30372
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
30373
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30374
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30375
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
30376
|
+
* @example
|
|
30377
|
+
* ```typescript
|
|
30378
|
+
* const txHandle = await vana.permissions.submitSignedRevoke(
|
|
30379
|
+
* typedData,
|
|
30380
|
+
* "0x1234..."
|
|
30381
|
+
* );
|
|
30382
|
+
* const result = await txHandle.waitForEvents();
|
|
30383
|
+
* ```
|
|
29942
30384
|
*/
|
|
29943
|
-
submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<
|
|
30385
|
+
submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionRevokeResult>>;
|
|
29944
30386
|
/**
|
|
29945
30387
|
* Submits an already-signed untrust server transaction to the blockchain.
|
|
30388
|
+
*
|
|
30389
|
+
* @remarks
|
|
29946
30390
|
* This method handles the removal of trusted servers.
|
|
30391
|
+
* Used internally by untrust server methods after signature collection.
|
|
29947
30392
|
*
|
|
29948
30393
|
* @param typedData - The EIP-712 typed data for UntrustServer
|
|
29949
|
-
* @param signature - The user's signature
|
|
29950
|
-
* @returns Promise resolving to
|
|
30394
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
30395
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30396
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30397
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
30398
|
+
* @example
|
|
30399
|
+
* ```typescript
|
|
30400
|
+
* const txHandle = await vana.permissions.submitSignedUntrustServer(
|
|
30401
|
+
* typedData,
|
|
30402
|
+
* "0x1234..."
|
|
30403
|
+
* );
|
|
30404
|
+
* const result = await txHandle.waitForEvents();
|
|
30405
|
+
* ```
|
|
29951
30406
|
*/
|
|
29952
|
-
submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<
|
|
30407
|
+
submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<ServerUntrustResult>>;
|
|
29953
30408
|
/**
|
|
29954
30409
|
* Submits a signed transaction directly to the blockchain.
|
|
29955
30410
|
*
|
|
30411
|
+
* @remarks
|
|
30412
|
+
* Internal method used when relayer callbacks are not available. Formats the signature
|
|
30413
|
+
* and submits the permission grant directly to the smart contract.
|
|
30414
|
+
*
|
|
29956
30415
|
* @param typedData - The typed data structure for the permission grant
|
|
29957
30416
|
* @param signature - The cryptographic signature authorizing the transaction
|
|
29958
30417
|
* @returns Promise resolving to the transaction hash
|
|
30418
|
+
* @throws {BlockchainError} When contract submission fails
|
|
29959
30419
|
*/
|
|
29960
30420
|
private submitDirectTransaction;
|
|
29961
30421
|
/**
|
|
@@ -30002,19 +30462,33 @@ declare class PermissionsController {
|
|
|
30002
30462
|
* console.log(`Revocation submitted: ${txHash}`);
|
|
30003
30463
|
* ```
|
|
30004
30464
|
*/
|
|
30005
|
-
submitPermissionRevoke(params: RevokePermissionParams): Promise<
|
|
30465
|
+
submitPermissionRevoke(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
|
|
30006
30466
|
/**
|
|
30007
|
-
* Revokes a permission with a signature
|
|
30467
|
+
* Revokes a permission with a signature for gasless transactions.
|
|
30468
|
+
*
|
|
30469
|
+
* @remarks
|
|
30470
|
+
* This method creates an EIP-712 signature for permission revocation and submits
|
|
30471
|
+
* it either through relayer callbacks or directly to the blockchain. Provides
|
|
30472
|
+
* gasless revocation when relayer is configured.
|
|
30008
30473
|
*
|
|
30009
30474
|
* @param params - Parameters for revoking the permission
|
|
30010
|
-
* @
|
|
30475
|
+
* @param params.permissionId - Permission identifier to revoke (accepts bigint, number, or string)
|
|
30476
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30011
30477
|
* @throws {BlockchainError} When chain ID is not available
|
|
30012
30478
|
* @throws {NonceError} When retrieving user nonce fails
|
|
30013
30479
|
* @throws {SignatureError} When user rejects the signature request
|
|
30014
30480
|
* @throws {RelayerError} When gasless submission fails
|
|
30015
30481
|
* @throws {PermissionError} When revocation fails for any other reason
|
|
30482
|
+
* @example
|
|
30483
|
+
* ```typescript
|
|
30484
|
+
* const txHandle = await vana.permissions.submitRevokeWithSignature({
|
|
30485
|
+
* permissionId: 123n
|
|
30486
|
+
* });
|
|
30487
|
+
* const result = await txHandle.waitForEvents();
|
|
30488
|
+
* console.log(`Permission ${result.permissionId} revoked`);
|
|
30489
|
+
* ```
|
|
30016
30490
|
*/
|
|
30017
|
-
submitRevokeWithSignature(params: RevokePermissionParams): Promise<
|
|
30491
|
+
submitRevokeWithSignature(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
|
|
30018
30492
|
/**
|
|
30019
30493
|
* @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
|
|
30020
30494
|
*
|
|
@@ -30039,6 +30513,18 @@ declare class PermissionsController {
|
|
|
30039
30513
|
* const serversNonce = await this.getServersUserNonce();
|
|
30040
30514
|
* ```
|
|
30041
30515
|
*/
|
|
30516
|
+
/**
|
|
30517
|
+
* @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
|
|
30518
|
+
*
|
|
30519
|
+
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
30520
|
+
*
|
|
30521
|
+
* @remarks
|
|
30522
|
+
* This method is deprecated in favor of more specific nonce methods that target
|
|
30523
|
+
* the appropriate contract for the operation being performed.
|
|
30524
|
+
*
|
|
30525
|
+
* @returns Promise resolving to the user's current nonce as a bigint
|
|
30526
|
+
* @throws {NonceError} When retrieving the nonce fails
|
|
30527
|
+
*/
|
|
30042
30528
|
private getUserNonce;
|
|
30043
30529
|
/**
|
|
30044
30530
|
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
@@ -30054,6 +30540,16 @@ declare class PermissionsController {
|
|
|
30054
30540
|
* console.log(`Current servers nonce: ${nonce}`);
|
|
30055
30541
|
* ```
|
|
30056
30542
|
*/
|
|
30543
|
+
/**
|
|
30544
|
+
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
30545
|
+
*
|
|
30546
|
+
* @remarks
|
|
30547
|
+
* Used for server-related operations (trust/untrust) to prevent replay attacks.
|
|
30548
|
+
* The nonce must be incremented with each server operation.
|
|
30549
|
+
*
|
|
30550
|
+
* @returns Promise resolving to the user's current nonce as a bigint
|
|
30551
|
+
* @throws {NonceError} When retrieving the nonce fails
|
|
30552
|
+
*/
|
|
30057
30553
|
private getServersUserNonce;
|
|
30058
30554
|
/**
|
|
30059
30555
|
* Retrieves the user's current nonce from the DataPortabilityPermissions contract.
|
|
@@ -30069,6 +30565,16 @@ declare class PermissionsController {
|
|
|
30069
30565
|
* console.log(`Current permissions nonce: ${nonce}`);
|
|
30070
30566
|
* ```
|
|
30071
30567
|
*/
|
|
30568
|
+
/**
|
|
30569
|
+
* Retrieves the user's current nonce from the DataPortabilityPermissions contract.
|
|
30570
|
+
*
|
|
30571
|
+
* @remarks
|
|
30572
|
+
* Used for permission-related operations (grant/revoke) to prevent replay attacks.
|
|
30573
|
+
* The nonce must be incremented with each permission operation.
|
|
30574
|
+
*
|
|
30575
|
+
* @returns Promise resolving to the user's current nonce as a bigint
|
|
30576
|
+
* @throws {NonceError} When retrieving the nonce fails
|
|
30577
|
+
*/
|
|
30072
30578
|
private getPermissionsUserNonce;
|
|
30073
30579
|
/**
|
|
30074
30580
|
* Composes the EIP-712 typed data for PermissionGrant (new simplified format).
|
|
@@ -30090,6 +30596,7 @@ declare class PermissionsController {
|
|
|
30090
30596
|
* @param params.granteeId - Grantee ID
|
|
30091
30597
|
* @param params.grant - Grant URL or grant data
|
|
30092
30598
|
* @param params.fileUrls - Array of file URLs
|
|
30599
|
+
* @param params.schemaIds - Schema IDs for each file
|
|
30093
30600
|
* @param params.serverAddress - Server address
|
|
30094
30601
|
* @param params.serverUrl - Server URL
|
|
30095
30602
|
* @param params.serverPublicKey - Server public key
|
|
@@ -30195,7 +30702,7 @@ declare class PermissionsController {
|
|
|
30195
30702
|
* console.log('Now trusting servers:', trustedServers);
|
|
30196
30703
|
* ```
|
|
30197
30704
|
*/
|
|
30198
|
-
addAndTrustServer(params: AddAndTrustServerParams): Promise<
|
|
30705
|
+
addAndTrustServer(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
|
|
30199
30706
|
/**
|
|
30200
30707
|
* Trusts a server for data processing (legacy method).
|
|
30201
30708
|
*
|
|
@@ -30203,14 +30710,14 @@ declare class PermissionsController {
|
|
|
30203
30710
|
* @returns Promise resolving to transaction hash
|
|
30204
30711
|
* @deprecated Use addAndTrustServer instead
|
|
30205
30712
|
*/
|
|
30206
|
-
submitTrustServer(params: TrustServerParams): Promise<
|
|
30713
|
+
submitTrustServer(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
|
|
30207
30714
|
/**
|
|
30208
30715
|
* Adds and trusts a server using a signature (gasless transaction).
|
|
30209
30716
|
*
|
|
30210
30717
|
* @param params - Parameters for adding and trusting the server
|
|
30211
|
-
* @returns Promise resolving to
|
|
30718
|
+
* @returns Promise resolving to TransactionHandle with ServerTrustResult event data
|
|
30212
30719
|
*/
|
|
30213
|
-
submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<
|
|
30720
|
+
submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
|
|
30214
30721
|
/**
|
|
30215
30722
|
* Trusts a server using a signature (gasless transaction - legacy method).
|
|
30216
30723
|
*
|
|
@@ -30224,13 +30731,24 @@ declare class PermissionsController {
|
|
|
30224
30731
|
* @throws {ServerUrlMismatchError} When server URL doesn't match existing registration
|
|
30225
30732
|
* @throws {BlockchainError} When trust operation fails for any other reason
|
|
30226
30733
|
*/
|
|
30227
|
-
submitTrustServerWithSignature(params: TrustServerParams): Promise<
|
|
30734
|
+
submitTrustServerWithSignature(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
|
|
30228
30735
|
/**
|
|
30229
30736
|
* Submits a direct untrust server transaction (without signature).
|
|
30230
30737
|
*
|
|
30231
30738
|
* @param params - The untrust server parameters containing server details
|
|
30232
30739
|
* @returns Promise resolving to the transaction hash
|
|
30233
30740
|
*/
|
|
30741
|
+
/**
|
|
30742
|
+
* Submits an untrust server transaction directly to the blockchain.
|
|
30743
|
+
*
|
|
30744
|
+
* @remarks
|
|
30745
|
+
* Internal method used for direct blockchain submission of untrust server operations
|
|
30746
|
+
* when relayer callbacks are not available.
|
|
30747
|
+
*
|
|
30748
|
+
* @param params - The untrust server parameters
|
|
30749
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30750
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30751
|
+
*/
|
|
30234
30752
|
private submitDirectUntrustTransaction;
|
|
30235
30753
|
/**
|
|
30236
30754
|
* Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
|
|
@@ -30260,7 +30778,7 @@ declare class PermissionsController {
|
|
|
30260
30778
|
* console.log('Still trusting servers:', trustedServers);
|
|
30261
30779
|
* ```
|
|
30262
30780
|
*/
|
|
30263
|
-
submitUntrustServer(params: UntrustServerParams): Promise<
|
|
30781
|
+
submitUntrustServer(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
|
|
30264
30782
|
/**
|
|
30265
30783
|
* Untrusts a server using a signature (gasless transaction).
|
|
30266
30784
|
*
|
|
@@ -30273,7 +30791,7 @@ declare class PermissionsController {
|
|
|
30273
30791
|
* @throws {RelayerError} When gasless submission fails
|
|
30274
30792
|
* @throws {BlockchainError} When untrust transaction fails
|
|
30275
30793
|
*/
|
|
30276
|
-
submitUntrustServerWithSignature(params: UntrustServerParams): Promise<
|
|
30794
|
+
submitUntrustServerWithSignature(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
|
|
30277
30795
|
/**
|
|
30278
30796
|
* Retrieves all servers trusted by a user from the DataPortabilityServers contract.
|
|
30279
30797
|
*
|
|
@@ -30324,22 +30842,60 @@ declare class PermissionsController {
|
|
|
30324
30842
|
/**
|
|
30325
30843
|
* Gets server information for multiple servers efficiently.
|
|
30326
30844
|
*
|
|
30327
|
-
* @
|
|
30328
|
-
*
|
|
30845
|
+
* @remarks
|
|
30846
|
+
* This method uses multicall to fetch information for multiple servers in a single
|
|
30847
|
+
* blockchain call, improving performance when querying many servers. Failed lookups
|
|
30848
|
+
* are returned separately for error handling.
|
|
30849
|
+
*
|
|
30850
|
+
* @param serverIds - Array of numeric server IDs to query
|
|
30851
|
+
* @returns Promise resolving to batch result containing successful lookups and failed IDs
|
|
30329
30852
|
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
30853
|
+
* @example
|
|
30854
|
+
* ```typescript
|
|
30855
|
+
* const result = await vana.permissions.getServerInfoBatch([1, 2, 3, 999]);
|
|
30856
|
+
*
|
|
30857
|
+
* // Process successful lookups
|
|
30858
|
+
* result.servers.forEach((server, id) => {
|
|
30859
|
+
* console.log(`Server ${id}: ${server.url}`);
|
|
30860
|
+
* });
|
|
30861
|
+
*
|
|
30862
|
+
* // Handle failed lookups
|
|
30863
|
+
* if (result.failed.length > 0) {
|
|
30864
|
+
* console.log(`Failed to fetch: ${result.failed.join(', ')}`);
|
|
30865
|
+
* }
|
|
30866
|
+
* ```
|
|
30330
30867
|
*/
|
|
30331
30868
|
getServerInfoBatch(serverIds: number[]): Promise<BatchServerInfoResult>;
|
|
30332
30869
|
/**
|
|
30333
30870
|
* Checks whether a specific server is trusted by a user.
|
|
30334
30871
|
*
|
|
30335
|
-
* @
|
|
30872
|
+
* @remarks
|
|
30873
|
+
* This method queries the user's trusted server list and checks if the specified
|
|
30874
|
+
* server is present. Returns both the trust status and the index in the trust list
|
|
30875
|
+
* if trusted.
|
|
30876
|
+
*
|
|
30877
|
+
* @param serverId - Numeric server ID to check
|
|
30336
30878
|
* @param userAddress - Optional user address (defaults to current user)
|
|
30337
|
-
* @returns Promise resolving to server trust status
|
|
30879
|
+
* @returns Promise resolving to server trust status with trust index if applicable
|
|
30880
|
+
* @throws {BlockchainError} When reading from contract fails
|
|
30881
|
+
* @example
|
|
30882
|
+
* ```typescript
|
|
30883
|
+
* const status = await vana.permissions.checkServerTrustStatus(1);
|
|
30884
|
+
* if (status.isTrusted) {
|
|
30885
|
+
* console.log(`Server is trusted at index ${status.trustIndex}`);
|
|
30886
|
+
* } else {
|
|
30887
|
+
* console.log('Server is not trusted');
|
|
30888
|
+
* }
|
|
30889
|
+
* ```
|
|
30338
30890
|
*/
|
|
30339
30891
|
checkServerTrustStatus(serverId: number, userAddress?: Address): Promise<ServerTrustStatus>;
|
|
30340
30892
|
/**
|
|
30341
30893
|
* Composes EIP-712 typed data for AddAndTrustServer.
|
|
30342
30894
|
*
|
|
30895
|
+
* @remarks
|
|
30896
|
+
* Creates the complete typed data structure required for EIP-712 signature generation
|
|
30897
|
+
* when adding and trusting a new server in a single transaction.
|
|
30898
|
+
*
|
|
30343
30899
|
* @param input - The add and trust server input data containing server details
|
|
30344
30900
|
* @returns Promise resolving to the typed data structure for server add and trust
|
|
30345
30901
|
*/
|
|
@@ -30421,7 +30977,7 @@ declare class PermissionsController {
|
|
|
30421
30977
|
* console.log(`Grantee registered in transaction: ${txHash}`);
|
|
30422
30978
|
* ```
|
|
30423
30979
|
*/
|
|
30424
|
-
submitRegisterGrantee(params: RegisterGranteeParams): Promise<
|
|
30980
|
+
submitRegisterGrantee(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
|
|
30425
30981
|
/**
|
|
30426
30982
|
* Registers a grantee with a signature (gasless transaction)
|
|
30427
30983
|
*
|
|
@@ -30437,7 +30993,7 @@ declare class PermissionsController {
|
|
|
30437
30993
|
* });
|
|
30438
30994
|
* ```
|
|
30439
30995
|
*/
|
|
30440
|
-
submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<
|
|
30996
|
+
submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
|
|
30441
30997
|
/**
|
|
30442
30998
|
* Submits a signed register grantee transaction via relayer
|
|
30443
30999
|
*
|
|
@@ -30450,7 +31006,7 @@ declare class PermissionsController {
|
|
|
30450
31006
|
* const result = await vana.permissions.submitSignedRegisterGrantee(typedData, signature);
|
|
30451
31007
|
* ```
|
|
30452
31008
|
*/
|
|
30453
|
-
submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<
|
|
31009
|
+
submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<TransactionHandle<GranteeRegisterResult>>;
|
|
30454
31010
|
/**
|
|
30455
31011
|
* Retrieves all registered grantees from the DataPortabilityGrantees contract.
|
|
30456
31012
|
*
|
|
@@ -30737,7 +31293,7 @@ declare class PermissionsController {
|
|
|
30737
31293
|
* @param url - New URL for the server
|
|
30738
31294
|
* @returns Promise resolving to transaction hash
|
|
30739
31295
|
*/
|
|
30740
|
-
submitUpdateServer(serverId: bigint, url: string): Promise<
|
|
31296
|
+
submitUpdateServer(serverId: bigint, url: string): Promise<TransactionHandle<ServerUpdateResult>>;
|
|
30741
31297
|
/**
|
|
30742
31298
|
* Get all permission IDs for a user
|
|
30743
31299
|
*
|
|
@@ -30777,49 +31333,106 @@ declare class PermissionsController {
|
|
|
30777
31333
|
* @throws {BlockchainError} When permission addition fails
|
|
30778
31334
|
* @throws {NetworkError} When network communication fails
|
|
30779
31335
|
*/
|
|
30780
|
-
submitAddPermission(params: ServerFilesAndPermissionParams): Promise<
|
|
31336
|
+
submitAddPermission(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
30781
31337
|
/**
|
|
30782
31338
|
* Submits an already-signed add permission transaction to the blockchain.
|
|
30783
31339
|
* This method supports both relayer-based gasless transactions and direct transactions.
|
|
30784
31340
|
*
|
|
30785
31341
|
* @param typedData - The EIP-712 typed data for AddPermission
|
|
30786
31342
|
* @param signature - The user's signature
|
|
30787
|
-
* @returns Promise resolving to
|
|
31343
|
+
* @returns Promise resolving to TransactionHandle with PermissionGrantResult event data
|
|
30788
31344
|
* @throws {RelayerError} When gasless transaction submission fails
|
|
30789
31345
|
* @throws {BlockchainError} When permission addition fails
|
|
30790
31346
|
* @throws {NetworkError} When network communication fails
|
|
30791
31347
|
*/
|
|
30792
|
-
submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<
|
|
31348
|
+
submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
30793
31349
|
/**
|
|
30794
|
-
*
|
|
31350
|
+
* Submits server files and permissions with signature to the blockchain, supporting schema validation and gasless transactions.
|
|
31351
|
+
*
|
|
31352
|
+
* @remarks
|
|
31353
|
+
* This method validates files against their specified schemas before submission.
|
|
31354
|
+
* Schema validation ensures data conforms to expected formats before on-chain registration.
|
|
31355
|
+
* Files with schemaId = 0 bypass validation. The method supports atomic batch operations
|
|
31356
|
+
* where all files and permissions are registered in a single transaction.
|
|
30795
31357
|
*
|
|
30796
31358
|
* @param params - Parameters for adding server files and permissions
|
|
30797
|
-
* @
|
|
30798
|
-
* @
|
|
31359
|
+
* @param params.granteeId - The ID of the permission grantee
|
|
31360
|
+
* @param params.grant - Grant URL containing permission parameters (typically IPFS)
|
|
31361
|
+
* @param params.fileUrls - Array of file URLs to register
|
|
31362
|
+
* @param params.schemaIds - Schema IDs for each file. Use 0 for files without schema validation.
|
|
31363
|
+
* Array length must match fileUrls length.
|
|
31364
|
+
* @param params.serverAddress - Server wallet address for decryption permissions
|
|
31365
|
+
* @param params.serverUrl - Server endpoint URL
|
|
31366
|
+
* @param params.serverPublicKey - Server's public key for encryption.
|
|
31367
|
+
* Obtain via `vana.server.getIdentity(userAddress).public_key`.
|
|
31368
|
+
* @param params.filePermissions - Nested array of permissions for each file
|
|
31369
|
+
* @returns TransactionHandle with immediate hash access and event parsing capability
|
|
31370
|
+
* @throws {Error} When schemaIds array length doesn't match fileUrls array length
|
|
31371
|
+
* @throws {SchemaValidationError} When file data doesn't match the specified schema.
|
|
31372
|
+
* Verify data structure matches schema definition from `vana.schemas.get(schemaId)`.
|
|
31373
|
+
* @throws {RelayerError} When gasless transaction submission fails.
|
|
31374
|
+
* Retry without relayer configuration to submit direct transaction.
|
|
30799
31375
|
* @throws {SignatureError} When user rejects the signature request
|
|
30800
31376
|
* @throws {BlockchainError} When server files and permissions addition fails
|
|
30801
|
-
* @throws {NetworkError} When network communication fails
|
|
31377
|
+
* @throws {NetworkError} When network communication fails.
|
|
31378
|
+
* Check network connection or configure alternative gateways.
|
|
31379
|
+
*
|
|
31380
|
+
* @example
|
|
31381
|
+
* ```typescript
|
|
31382
|
+
* const result = await vana.permissions.submitAddServerFilesAndPermissions({
|
|
31383
|
+
* granteeId: BigInt(1),
|
|
31384
|
+
* grant: "ipfs://QmXxx...",
|
|
31385
|
+
* fileUrls: ["https://storage.example.com/data.json"],
|
|
31386
|
+
* schemaIds: [123], // LinkedIn profile schema ID
|
|
31387
|
+
* serverAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
|
|
31388
|
+
* serverUrl: "https://server.example.com",
|
|
31389
|
+
* serverPublicKey: serverInfo.public_key,
|
|
31390
|
+
* filePermissions: [[{
|
|
31391
|
+
* account: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
|
|
31392
|
+
* key: encryptedKey
|
|
31393
|
+
* }]]
|
|
31394
|
+
* });
|
|
31395
|
+
* const events = await result.waitForEvents();
|
|
31396
|
+
* console.log(`Permission ID: ${events.permissionId}`);
|
|
31397
|
+
* ```
|
|
30802
31398
|
*/
|
|
30803
|
-
submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<
|
|
31399
|
+
submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
30804
31400
|
/**
|
|
30805
31401
|
* Submits an already-signed add server files and permissions transaction to the blockchain.
|
|
30806
|
-
*
|
|
31402
|
+
*
|
|
31403
|
+
* @remarks
|
|
31404
|
+
* This method returns a TransactionHandle that provides immediate access to the transaction hash
|
|
31405
|
+
* while allowing lazy-loaded access to parsed event data. Use `waitForEvents()` to retrieve
|
|
31406
|
+
* the permission ID and other event details after transaction confirmation.
|
|
30807
31407
|
*
|
|
30808
31408
|
* @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
|
|
30809
31409
|
* @param signature - The user's signature
|
|
30810
|
-
* @returns
|
|
31410
|
+
* @returns TransactionHandle with immediate hash access and optional event parsing
|
|
30811
31411
|
* @throws {RelayerError} When gasless transaction submission fails
|
|
30812
31412
|
* @throws {BlockchainError} When server files and permissions addition fails
|
|
30813
31413
|
* @throws {NetworkError} When network communication fails
|
|
31414
|
+
*
|
|
31415
|
+
* @example
|
|
31416
|
+
* ```typescript
|
|
31417
|
+
* const tx = await vana.permissions.submitSignedAddServerFilesAndPermissions(
|
|
31418
|
+
* typedData,
|
|
31419
|
+
* signature
|
|
31420
|
+
* );
|
|
31421
|
+
* console.log(`Transaction submitted: ${tx.hash}`);
|
|
31422
|
+
*
|
|
31423
|
+
* // Wait for confirmation and get the permission ID
|
|
31424
|
+
* const { permissionId } = await tx.waitForEvents();
|
|
31425
|
+
* console.log(`Permission created with ID: ${permissionId}`);
|
|
31426
|
+
* ```
|
|
30814
31427
|
*/
|
|
30815
|
-
submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<
|
|
31428
|
+
submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
30816
31429
|
/**
|
|
30817
31430
|
* Submit permission revocation with signature to the blockchain
|
|
30818
31431
|
*
|
|
30819
31432
|
* @param permissionId - Permission ID to revoke
|
|
30820
31433
|
* @returns Promise resolving to transaction hash
|
|
30821
31434
|
*/
|
|
30822
|
-
submitRevokePermission(permissionId: bigint): Promise<
|
|
31435
|
+
submitRevokePermission(permissionId: bigint): Promise<TransactionHandle<PermissionRevokeResult>>;
|
|
30823
31436
|
/**
|
|
30824
31437
|
* Submits a signed add permission transaction directly to the blockchain.
|
|
30825
31438
|
*
|
|
@@ -30849,10 +31462,10 @@ declare class PermissionsController {
|
|
|
30849
31462
|
interface CreateSchemaParams {
|
|
30850
31463
|
/** The name of the schema */
|
|
30851
31464
|
name: string;
|
|
30852
|
-
/** The
|
|
30853
|
-
|
|
31465
|
+
/** The dialect of the schema (e.g., 'json' or 'sqlite') */
|
|
31466
|
+
dialect: "json" | "sqlite";
|
|
30854
31467
|
/** The schema definition object or JSON string */
|
|
30855
|
-
|
|
31468
|
+
schema: object | string;
|
|
30856
31469
|
}
|
|
30857
31470
|
/**
|
|
30858
31471
|
* Result of creating a new schema.
|
|
@@ -30897,8 +31510,8 @@ interface CreateSchemaResult {
|
|
|
30897
31510
|
* // Create a new schema with automatic IPFS upload
|
|
30898
31511
|
* const result = await vana.schemas.create({
|
|
30899
31512
|
* name: "User Profile",
|
|
30900
|
-
*
|
|
30901
|
-
*
|
|
31513
|
+
* dialect: "json",
|
|
31514
|
+
* schema: {
|
|
30902
31515
|
* type: "object",
|
|
30903
31516
|
* properties: {
|
|
30904
31517
|
* name: { type: "string" },
|
|
@@ -30933,7 +31546,7 @@ declare class SchemaController {
|
|
|
30933
31546
|
* - Uploads the definition to IPFS to generate a permanent URL
|
|
30934
31547
|
* - Registers the schema on the blockchain with the generated URL
|
|
30935
31548
|
*
|
|
30936
|
-
* @param params - Schema creation parameters including name,
|
|
31549
|
+
* @param params - Schema creation parameters including name, dialect, and definition
|
|
30937
31550
|
* @returns Promise resolving to creation results with schema ID and transaction hash
|
|
30938
31551
|
* @throws {SchemaValidationError} When the schema definition is invalid
|
|
30939
31552
|
* @throws {Error} When IPFS upload or blockchain registration fails
|
|
@@ -30942,8 +31555,8 @@ declare class SchemaController {
|
|
|
30942
31555
|
* // Create a JSON schema for user profiles
|
|
30943
31556
|
* const result = await vana.schemas.create({
|
|
30944
31557
|
* name: "User Profile",
|
|
30945
|
-
*
|
|
30946
|
-
*
|
|
31558
|
+
* dialect: "json",
|
|
31559
|
+
* schema: {
|
|
30947
31560
|
* type: "object",
|
|
30948
31561
|
* properties: {
|
|
30949
31562
|
* name: { type: "string" },
|
|
@@ -30958,27 +31571,28 @@ declare class SchemaController {
|
|
|
30958
31571
|
*/
|
|
30959
31572
|
create(params: CreateSchemaParams): Promise<CreateSchemaResult>;
|
|
30960
31573
|
/**
|
|
30961
|
-
* Retrieves a schema by its ID.
|
|
31574
|
+
* Retrieves a complete schema by its ID with definition fetched and flattened.
|
|
30962
31575
|
*
|
|
30963
31576
|
* @param schemaId - The ID of the schema to retrieve
|
|
30964
31577
|
* @param options - Optional parameters
|
|
30965
31578
|
* @param options.subgraphUrl - Custom subgraph URL to use instead of default
|
|
30966
|
-
* @returns Promise resolving to the schema object
|
|
30967
|
-
* @throws {Error} When the schema is not found or chain is unavailable
|
|
31579
|
+
* @returns Promise resolving to the complete schema object with all fields populated
|
|
31580
|
+
* @throws {Error} When the schema is not found, definition cannot be fetched, or chain is unavailable
|
|
30968
31581
|
* @example
|
|
30969
31582
|
* ```typescript
|
|
30970
31583
|
* const schema = await vana.schemas.get(1);
|
|
30971
|
-
* console.log(`Schema: ${schema.name} (${schema.
|
|
31584
|
+
* console.log(`Schema: ${schema.name} (${schema.dialect})`);
|
|
31585
|
+
* console.log(`Version: ${schema.version}`);
|
|
31586
|
+
* console.log(`Description: ${schema.description}`);
|
|
31587
|
+
* console.log('Schema:', schema.schema);
|
|
30972
31588
|
*
|
|
30973
|
-
* //
|
|
30974
|
-
*
|
|
30975
|
-
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
30976
|
-
* });
|
|
31589
|
+
* // Use directly with validator (schema has all required fields)
|
|
31590
|
+
* validator.validateDataAgainstSchema(data, schema);
|
|
30977
31591
|
* ```
|
|
30978
31592
|
*/
|
|
30979
31593
|
get(schemaId: number, options?: {
|
|
30980
31594
|
subgraphUrl?: string;
|
|
30981
|
-
}): Promise<
|
|
31595
|
+
}): Promise<CompleteSchema>;
|
|
30982
31596
|
/**
|
|
30983
31597
|
* Gets the total number of schemas registered on the network.
|
|
30984
31598
|
*
|
|
@@ -31007,27 +31621,25 @@ declare class SchemaController {
|
|
|
31007
31621
|
* @param options.limit - Maximum number of schemas to return
|
|
31008
31622
|
* @param options.offset - Number of schemas to skip
|
|
31009
31623
|
* @param options.subgraphUrl - Custom subgraph URL to use instead of default
|
|
31624
|
+
* @param options.includeDefinitions - Whether to fetch and include schema definitions (default: false for performance)
|
|
31010
31625
|
* @returns Promise resolving to an array of schemas
|
|
31011
31626
|
* @example
|
|
31012
31627
|
* ```typescript
|
|
31013
|
-
* // Get all schemas
|
|
31628
|
+
* // Get all schemas (without definitions for performance)
|
|
31014
31629
|
* const schemas = await vana.schemas.list();
|
|
31015
31630
|
*
|
|
31631
|
+
* // Get schemas with definitions
|
|
31632
|
+
* const schemas = await vana.schemas.list({ includeDefinitions: true });
|
|
31633
|
+
*
|
|
31016
31634
|
* // Get schemas with pagination
|
|
31017
31635
|
* const schemas = await vana.schemas.list({ limit: 10, offset: 0 });
|
|
31018
|
-
*
|
|
31019
|
-
* // With custom subgraph
|
|
31020
|
-
* const schemas = await vana.schemas.list({
|
|
31021
|
-
* limit: 10,
|
|
31022
|
-
* offset: 0,
|
|
31023
|
-
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
31024
|
-
* });
|
|
31025
31636
|
* ```
|
|
31026
31637
|
*/
|
|
31027
31638
|
list(options?: {
|
|
31028
31639
|
limit?: number;
|
|
31029
31640
|
offset?: number;
|
|
31030
31641
|
subgraphUrl?: string;
|
|
31642
|
+
includeDefinitions?: boolean;
|
|
31031
31643
|
}): Promise<Schema[]>;
|
|
31032
31644
|
/**
|
|
31033
31645
|
* Adds a schema using the legacy method (low-level API).
|
|
@@ -31074,6 +31686,13 @@ declare class SchemaController {
|
|
|
31074
31686
|
* @returns Promise resolving to the user's address
|
|
31075
31687
|
*/
|
|
31076
31688
|
private getUserAddress;
|
|
31689
|
+
/**
|
|
31690
|
+
* Fetches and attaches definitions to an array of schemas.
|
|
31691
|
+
*
|
|
31692
|
+
* @param schemas - Array of schemas to fetch definitions for
|
|
31693
|
+
* @private
|
|
31694
|
+
*/
|
|
31695
|
+
private _fetchDefinitionsForSchemas;
|
|
31077
31696
|
}
|
|
31078
31697
|
|
|
31079
31698
|
/**
|
|
@@ -31115,16 +31734,16 @@ declare class SchemaValidationError extends Error {
|
|
|
31115
31734
|
}>);
|
|
31116
31735
|
}
|
|
31117
31736
|
/**
|
|
31118
|
-
*
|
|
31737
|
+
* Data schema validation utility class
|
|
31119
31738
|
*/
|
|
31120
31739
|
declare class SchemaValidator {
|
|
31121
31740
|
private ajv;
|
|
31122
31741
|
private dataSchemaValidator;
|
|
31123
31742
|
constructor();
|
|
31124
31743
|
/**
|
|
31125
|
-
* Validates a data schema against the Vana meta-schema
|
|
31744
|
+
* Validates a data schema definition against the Vana meta-schema
|
|
31126
31745
|
*
|
|
31127
|
-
* @param schema - The data schema to validate
|
|
31746
|
+
* @param schema - The data schema definition to validate
|
|
31128
31747
|
* @throws SchemaValidationError if invalid
|
|
31129
31748
|
* @example
|
|
31130
31749
|
* ```typescript
|
|
@@ -31143,39 +31762,35 @@ declare class SchemaValidator {
|
|
|
31143
31762
|
* }
|
|
31144
31763
|
* };
|
|
31145
31764
|
*
|
|
31146
|
-
* validator.
|
|
31765
|
+
* validator.validateDataSchemaAgainstMetaSchema(schema); // throws if invalid
|
|
31147
31766
|
* ```
|
|
31148
31767
|
*/
|
|
31149
|
-
|
|
31768
|
+
validateDataSchemaAgainstMetaSchema(schema: unknown): asserts schema is DataSchema;
|
|
31150
31769
|
/**
|
|
31151
|
-
* Validates data against a JSON Schema
|
|
31770
|
+
* Validates data against a JSON Schema
|
|
31152
31771
|
*
|
|
31153
31772
|
* @param data - The data to validate
|
|
31154
|
-
* @param schema - The
|
|
31773
|
+
* @param schema - The schema containing the validation rules (must have been validated or fetched from chain)
|
|
31155
31774
|
* @throws SchemaValidationError if invalid
|
|
31156
31775
|
* @example
|
|
31157
31776
|
* ```typescript
|
|
31158
31777
|
* const validator = new SchemaValidator();
|
|
31159
31778
|
*
|
|
31160
|
-
*
|
|
31779
|
+
* // Works with Schema from schemas.get()
|
|
31780
|
+
* const schema = await vana.schemas.get(1);
|
|
31781
|
+
* validator.validateDataAgainstSchema(userData, schema);
|
|
31782
|
+
*
|
|
31783
|
+
* // Also works with pre-validated DataSchema object
|
|
31784
|
+
* const dataSchema = validator.validateDataSchemaAgainstMetaSchema({
|
|
31161
31785
|
* name: "User Profile",
|
|
31162
31786
|
* version: "1.0.0",
|
|
31163
31787
|
* dialect: "json",
|
|
31164
|
-
* schema: {
|
|
31165
|
-
*
|
|
31166
|
-
*
|
|
31167
|
-
* name: { type: "string" },
|
|
31168
|
-
* age: { type: "number" }
|
|
31169
|
-
* },
|
|
31170
|
-
* required: ["name"]
|
|
31171
|
-
* }
|
|
31172
|
-
* };
|
|
31173
|
-
*
|
|
31174
|
-
* const userData = { name: "Alice", age: 30 };
|
|
31175
|
-
* validator.validateDataAgainstSchema(userData, schema);
|
|
31788
|
+
* schema: { type: "object", properties: { name: { type: "string" } } }
|
|
31789
|
+
* });
|
|
31790
|
+
* validator.validateDataAgainstSchema(userData, dataSchema);
|
|
31176
31791
|
* ```
|
|
31177
31792
|
*/
|
|
31178
|
-
validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
|
|
31793
|
+
validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
|
|
31179
31794
|
/**
|
|
31180
31795
|
* Validates a SQLite DDL string for basic syntax
|
|
31181
31796
|
* Note: This is a basic validation, full SQL parsing would require a proper SQL parser
|
|
@@ -31186,9 +31801,9 @@ declare class SchemaValidator {
|
|
|
31186
31801
|
*/
|
|
31187
31802
|
validateSQLiteDDL(ddl: string, dialectVersion?: string): void;
|
|
31188
31803
|
/**
|
|
31189
|
-
* Fetches and validates a schema from a URL
|
|
31804
|
+
* Fetches and validates a data schema from a URL
|
|
31190
31805
|
*
|
|
31191
|
-
* @param url - The URL to fetch the schema from
|
|
31806
|
+
* @param url - The URL to fetch the data schema from
|
|
31192
31807
|
* @returns The validated data schema
|
|
31193
31808
|
* @throws SchemaValidationError if invalid or fetch fails
|
|
31194
31809
|
* @example
|
|
@@ -31204,13 +31819,24 @@ declare class SchemaValidator {
|
|
|
31204
31819
|
*/
|
|
31205
31820
|
declare const schemaValidator: SchemaValidator;
|
|
31206
31821
|
/**
|
|
31207
|
-
* Convenience function to validate a data schema
|
|
31822
|
+
* Convenience function to validate a data schema definition against the Vana meta-schema
|
|
31208
31823
|
*
|
|
31209
|
-
* @param schema - The data schema to validate
|
|
31210
|
-
* @returns
|
|
31824
|
+
* @param schema - The data schema definition to validate
|
|
31825
|
+
* @returns The validated DataSchema
|
|
31211
31826
|
* @throws SchemaValidationError if invalid
|
|
31827
|
+
* @example
|
|
31828
|
+
* ```typescript
|
|
31829
|
+
* const schemaDefinition = {
|
|
31830
|
+
* name: "User Profile",
|
|
31831
|
+
* version: "1.0.0",
|
|
31832
|
+
* dialect: "json",
|
|
31833
|
+
* schema: { type: "object", properties: { name: { type: "string" } } }
|
|
31834
|
+
* };
|
|
31835
|
+
*
|
|
31836
|
+
* const validatedSchema = validateDataSchemaAgainstMetaSchema(schemaDefinition);
|
|
31837
|
+
* ```
|
|
31212
31838
|
*/
|
|
31213
|
-
declare function
|
|
31839
|
+
declare function validateDataSchemaAgainstMetaSchema(schema: unknown): DataSchema;
|
|
31214
31840
|
/**
|
|
31215
31841
|
* Convenience function to validate data against a schema
|
|
31216
31842
|
*
|
|
@@ -31219,11 +31845,11 @@ declare function validateDataSchema(schema: unknown): asserts schema is DataSche
|
|
|
31219
31845
|
* @returns void - Function doesn't return a value
|
|
31220
31846
|
* @throws SchemaValidationError if invalid
|
|
31221
31847
|
*/
|
|
31222
|
-
declare function validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
|
|
31848
|
+
declare function validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
|
|
31223
31849
|
/**
|
|
31224
|
-
* Convenience function to fetch and validate a schema from a URL
|
|
31850
|
+
* Convenience function to fetch and validate a data schema from a URL
|
|
31225
31851
|
*
|
|
31226
|
-
* @param url - The URL to fetch the schema from
|
|
31852
|
+
* @param url - The URL to fetch the data schema from
|
|
31227
31853
|
* @returns The validated data schema
|
|
31228
31854
|
* @throws SchemaValidationError if invalid or fetch fails
|
|
31229
31855
|
*/
|
|
@@ -33714,6 +34340,89 @@ declare class DataController {
|
|
|
33714
34340
|
owner: Address;
|
|
33715
34341
|
subgraphUrl?: string;
|
|
33716
34342
|
}): Promise<UserFile$1[]>;
|
|
34343
|
+
/**
|
|
34344
|
+
* Fetches proof data for multiple files from the subgraph.
|
|
34345
|
+
*
|
|
34346
|
+
* @private
|
|
34347
|
+
* @param fileIds - Array of file IDs to fetch proofs for
|
|
34348
|
+
* @param subgraphUrl - The subgraph endpoint URL
|
|
34349
|
+
* @returns Map of file IDs to their associated DLP IDs
|
|
34350
|
+
*/
|
|
34351
|
+
private _fetchProofsFromSubgraph;
|
|
34352
|
+
/**
|
|
34353
|
+
* Fetches proof data for multiple files from the blockchain.
|
|
34354
|
+
* Falls back to this when subgraph is unavailable.
|
|
34355
|
+
*
|
|
34356
|
+
* @private
|
|
34357
|
+
* @param fileIds - Array of file IDs to fetch proofs for
|
|
34358
|
+
* @returns Map of file IDs to their associated DLP IDs
|
|
34359
|
+
*/
|
|
34360
|
+
private _fetchProofsFromChain;
|
|
34361
|
+
/**
|
|
34362
|
+
* Retrieves information about a specific Data Liquidity Pool (DLP).
|
|
34363
|
+
*
|
|
34364
|
+
* @remarks
|
|
34365
|
+
* DLPs are entities that process and verify data files in the Vana network.
|
|
34366
|
+
* This method fetches DLP metadata including name, status, and performance rating.
|
|
34367
|
+
* Uses subgraph first for efficiency, falls back to chain if unavailable.
|
|
34368
|
+
*
|
|
34369
|
+
* @param dlpId - The unique identifier of the DLP
|
|
34370
|
+
* @param options - Optional parameters
|
|
34371
|
+
* @param options.subgraphUrl - Custom subgraph URL to override default
|
|
34372
|
+
* @returns Promise resolving to DLP information
|
|
34373
|
+
* @throws {Error} When DLP cannot be found - "DLP not found: {dlpId}"
|
|
34374
|
+
* @throws {Error} When query fails - "Failed to fetch DLP: {error}"
|
|
34375
|
+
* @example
|
|
34376
|
+
* ```typescript
|
|
34377
|
+
* const dlp = await vana.data.getDLP(26);
|
|
34378
|
+
* console.log(`DLP ${dlp.name}: ${dlp.status}`);
|
|
34379
|
+
* ```
|
|
34380
|
+
*/
|
|
34381
|
+
getDLP(dlpId: number, options?: {
|
|
34382
|
+
subgraphUrl?: string;
|
|
34383
|
+
}): Promise<{
|
|
34384
|
+
id: number;
|
|
34385
|
+
name: string;
|
|
34386
|
+
metadata?: string;
|
|
34387
|
+
status?: number;
|
|
34388
|
+
address?: Address;
|
|
34389
|
+
owner?: Address;
|
|
34390
|
+
}>;
|
|
34391
|
+
/**
|
|
34392
|
+
* Lists all Data Liquidity Pools (DLPs) with optional pagination.
|
|
34393
|
+
*
|
|
34394
|
+
* @remarks
|
|
34395
|
+
* Fetches a paginated list of all DLPs registered in the network.
|
|
34396
|
+
* Uses subgraph for efficient querying with fallback to chain multicall.
|
|
34397
|
+
*
|
|
34398
|
+
* @param options - Optional parameters for pagination and filtering
|
|
34399
|
+
* @param options.limit - Maximum number of DLPs to return (default: 100)
|
|
34400
|
+
* @param options.offset - Number of DLPs to skip (default: 0)
|
|
34401
|
+
* @param options.subgraphUrl - Custom subgraph URL to override default
|
|
34402
|
+
* @returns Promise resolving to array of DLP information
|
|
34403
|
+
* @throws {Error} When query fails - "Failed to list DLPs: {error}"
|
|
34404
|
+
* @example
|
|
34405
|
+
* ```typescript
|
|
34406
|
+
* // Get first 10 DLPs
|
|
34407
|
+
* const dlps = await vana.data.listDLPs({ limit: 10 });
|
|
34408
|
+
* dlps.forEach(dlp => console.log(`${dlp.id}: ${dlp.name}`));
|
|
34409
|
+
*
|
|
34410
|
+
* // Get next page
|
|
34411
|
+
* const nextPage = await vana.data.listDLPs({ limit: 10, offset: 10 });
|
|
34412
|
+
* ```
|
|
34413
|
+
*/
|
|
34414
|
+
listDLPs(options?: {
|
|
34415
|
+
limit?: number;
|
|
34416
|
+
offset?: number;
|
|
34417
|
+
subgraphUrl?: string;
|
|
34418
|
+
}): Promise<Array<{
|
|
34419
|
+
id: number;
|
|
34420
|
+
name: string;
|
|
34421
|
+
metadata?: string;
|
|
34422
|
+
status?: number;
|
|
34423
|
+
address?: Address;
|
|
34424
|
+
owner?: Address;
|
|
34425
|
+
}>>;
|
|
33717
34426
|
/**
|
|
33718
34427
|
* Retrieves a list of permissions granted by a user.
|
|
33719
34428
|
*
|
|
@@ -33862,12 +34571,25 @@ declare class DataController {
|
|
|
33862
34571
|
/**
|
|
33863
34572
|
* Registers a file URL directly on the blockchain with a schema ID.
|
|
33864
34573
|
*
|
|
33865
|
-
* @
|
|
34574
|
+
* @remarks
|
|
34575
|
+
* This method registers an existing file URL on the DataRegistry contract
|
|
34576
|
+
* with a schema ID, without uploading any data. Useful when you have already
|
|
34577
|
+
* uploaded content to storage and just need to register it on-chain.
|
|
34578
|
+
*
|
|
34579
|
+
* @param url - The URL of the file to register (IPFS or HTTP/HTTPS)
|
|
33866
34580
|
* @param schemaId - The schema ID to associate with the file
|
|
33867
34581
|
* @returns Promise resolving to the file ID and transaction hash
|
|
33868
|
-
*
|
|
33869
|
-
*
|
|
33870
|
-
*
|
|
34582
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
34583
|
+
* @throws {Error} When wallet address is unavailable - "No addresses available"
|
|
34584
|
+
* @throws {Error} When transaction fails - "Failed to register file with schema"
|
|
34585
|
+
* @example
|
|
34586
|
+
* ```typescript
|
|
34587
|
+
* const { fileId, transactionHash } = await vana.data.registerFileWithSchema(
|
|
34588
|
+
* "ipfs://QmXxx...",
|
|
34589
|
+
* 1
|
|
34590
|
+
* );
|
|
34591
|
+
* console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
|
|
34592
|
+
* ```
|
|
33871
34593
|
*/
|
|
33872
34594
|
registerFileWithSchema(url: string, schemaId: number): Promise<{
|
|
33873
34595
|
fileId: number;
|
|
@@ -33927,35 +34649,112 @@ declare class DataController {
|
|
|
33927
34649
|
/**
|
|
33928
34650
|
* Adds a new refiner to the DataRefinerRegistry.
|
|
33929
34651
|
*
|
|
33930
|
-
* @
|
|
34652
|
+
* @remarks
|
|
34653
|
+
* Refiners are data processing templates that define how raw data should be
|
|
34654
|
+
* transformed into structured formats. Each refiner is associated with a DLP
|
|
34655
|
+
* (Data Liquidity Pool), has a specific schema for output, and includes
|
|
34656
|
+
* instructions for the refinement process.
|
|
34657
|
+
*
|
|
34658
|
+
* @param params - Refiner configuration parameters
|
|
34659
|
+
* @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
|
|
34660
|
+
* @param params.name - Human-readable name for the refiner
|
|
34661
|
+
* @param params.schemaId - Schema ID that defines the output format
|
|
34662
|
+
* @param params.refinementInstructionUrl - URL containing processing instructions
|
|
33931
34663
|
* @returns Promise resolving to the new refiner ID and transaction hash
|
|
34664
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
34665
|
+
* @throws {Error} When transaction fails - "Failed to add refiner: {error}"
|
|
34666
|
+
* @example
|
|
34667
|
+
* ```typescript
|
|
34668
|
+
* const result = await vana.data.addRefiner({
|
|
34669
|
+
* dlpId: 1,
|
|
34670
|
+
* name: "Social Media Sentiment Analyzer",
|
|
34671
|
+
* schemaId: 42,
|
|
34672
|
+
* refinementInstructionUrl: "ipfs://QmXxx..."
|
|
34673
|
+
* });
|
|
34674
|
+
* console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
|
|
34675
|
+
* ```
|
|
33932
34676
|
*/
|
|
33933
34677
|
addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
|
|
33934
34678
|
/**
|
|
33935
34679
|
* Retrieves a refiner by its ID.
|
|
33936
34680
|
*
|
|
33937
|
-
* @
|
|
33938
|
-
*
|
|
34681
|
+
* @remarks
|
|
34682
|
+
* Queries the DataRefinerRegistry contract to get complete information about
|
|
34683
|
+
* a specific refiner including its DLP association, schema, and instructions.
|
|
34684
|
+
*
|
|
34685
|
+
* @param refinerId - The numeric refiner ID to retrieve
|
|
34686
|
+
* @returns Promise resolving to the refiner information object
|
|
34687
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
34688
|
+
* @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
|
|
34689
|
+
* @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
|
|
34690
|
+
* @example
|
|
34691
|
+
* ```typescript
|
|
34692
|
+
* const refiner = await vana.data.getRefiner(1);
|
|
34693
|
+
* console.log({
|
|
34694
|
+
* name: refiner.name,
|
|
34695
|
+
* dlp: refiner.dlpId,
|
|
34696
|
+
* schema: refiner.schemaId,
|
|
34697
|
+
* instructions: refiner.refinementInstructionUrl
|
|
34698
|
+
* });
|
|
34699
|
+
* ```
|
|
33939
34700
|
*/
|
|
33940
34701
|
getRefiner(refinerId: number): Promise<Refiner>;
|
|
33941
34702
|
/**
|
|
33942
34703
|
* Validates if a schema ID exists in the registry.
|
|
33943
34704
|
*
|
|
33944
|
-
* @
|
|
33945
|
-
*
|
|
34705
|
+
* @remarks
|
|
34706
|
+
* Checks the DataRefinerRegistry contract to determine if a given schema ID
|
|
34707
|
+
* has been registered and is available for use.
|
|
34708
|
+
*
|
|
34709
|
+
* @param schemaId - The numeric schema ID to validate
|
|
34710
|
+
* @returns Promise resolving to true if schema exists, false otherwise
|
|
34711
|
+
* @example
|
|
34712
|
+
* ```typescript
|
|
34713
|
+
* const isValid = await vana.data.isValidSchemaId(42);
|
|
34714
|
+
* if (isValid) {
|
|
34715
|
+
* console.log('Schema 42 is available for use');
|
|
34716
|
+
* } else {
|
|
34717
|
+
* console.log('Schema 42 does not exist');
|
|
34718
|
+
* }
|
|
34719
|
+
* ```
|
|
33946
34720
|
*/
|
|
33947
34721
|
isValidSchemaId(schemaId: number): Promise<boolean>;
|
|
33948
34722
|
/**
|
|
33949
34723
|
* Gets the total number of refiners in the registry.
|
|
33950
34724
|
*
|
|
34725
|
+
* @remarks
|
|
34726
|
+
* Queries the DataRefinerRegistry contract to get the total count of all
|
|
34727
|
+
* registered refiners across all DLPs.
|
|
34728
|
+
*
|
|
33951
34729
|
* @returns Promise resolving to the total refiner count
|
|
34730
|
+
* @example
|
|
34731
|
+
* ```typescript
|
|
34732
|
+
* const count = await vana.data.getRefinersCount();
|
|
34733
|
+
* console.log(`Total refiners registered: ${count}`);
|
|
34734
|
+
* ```
|
|
33952
34735
|
*/
|
|
33953
34736
|
getRefinersCount(): Promise<number>;
|
|
33954
34737
|
/**
|
|
33955
34738
|
* Updates the schema ID for an existing refiner.
|
|
33956
34739
|
*
|
|
33957
|
-
* @
|
|
34740
|
+
* @remarks
|
|
34741
|
+
* Allows the owner of a refiner to update its associated schema ID.
|
|
34742
|
+
* This is useful when refiner output format needs to change.
|
|
34743
|
+
*
|
|
34744
|
+
* @param params - Update parameters
|
|
34745
|
+
* @param params.refinerId - The refiner ID to update
|
|
34746
|
+
* @param params.newSchemaId - The new schema ID to set
|
|
33958
34747
|
* @returns Promise resolving to the transaction hash
|
|
34748
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
34749
|
+
* @throws {Error} When transaction fails - "Failed to update schema ID: {error}"
|
|
34750
|
+
* @example
|
|
34751
|
+
* ```typescript
|
|
34752
|
+
* const result = await vana.data.updateSchemaId({
|
|
34753
|
+
* refinerId: 1,
|
|
34754
|
+
* newSchemaId: 55
|
|
34755
|
+
* });
|
|
34756
|
+
* console.log(`Schema updated in tx ${result.transactionHash}`);
|
|
34757
|
+
* ```
|
|
33959
34758
|
*/
|
|
33960
34759
|
updateSchemaId(params: UpdateSchemaIdParams): Promise<UpdateSchemaIdResult>;
|
|
33961
34760
|
/**
|
|
@@ -34014,24 +34813,47 @@ declare class DataController {
|
|
|
34014
34813
|
* console.log(`Transaction: ${result.transactionHash}`);
|
|
34015
34814
|
* ```
|
|
34016
34815
|
*/
|
|
34017
|
-
addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<FilePermissionResult
|
|
34816
|
+
addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
|
|
34018
34817
|
/**
|
|
34019
|
-
* Submits a file permission transaction
|
|
34818
|
+
* Submits a file permission transaction to the blockchain.
|
|
34020
34819
|
*
|
|
34021
|
-
*
|
|
34820
|
+
* @remarks
|
|
34821
|
+
* This method supports gasless transactions via relayer callbacks when configured.
|
|
34822
|
+
* It encrypts the user's encryption key with the recipient's public key before submission.
|
|
34022
34823
|
* Use this when you want to handle transaction confirmation and event parsing separately.
|
|
34023
34824
|
*
|
|
34024
|
-
* @param fileId - The ID of the file to
|
|
34025
|
-
* @param account - The
|
|
34026
|
-
* @param publicKey - The public key
|
|
34027
|
-
*
|
|
34825
|
+
* @param fileId - The ID of the file to grant permission for
|
|
34826
|
+
* @param account - The recipient's wallet address that will access the file
|
|
34827
|
+
* @param publicKey - The recipient's public key for encryption.
|
|
34828
|
+
* Obtain via `vana.server.getIdentity(account).public_key`
|
|
34829
|
+
* @returns Promise resolving to TransactionHandle for tracking the transaction
|
|
34830
|
+
* @throws {Error} When chain ID is not available
|
|
34831
|
+
* @throws {Error} When encryption key generation fails
|
|
34832
|
+
* @throws {Error} When public key encryption fails
|
|
34833
|
+
*
|
|
34028
34834
|
* @example
|
|
34029
34835
|
* ```typescript
|
|
34030
|
-
* const
|
|
34031
|
-
*
|
|
34836
|
+
* const tx = await vana.data.submitFilePermission(
|
|
34837
|
+
* fileId,
|
|
34838
|
+
* "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
|
|
34839
|
+
* recipientPublicKey
|
|
34840
|
+
* );
|
|
34841
|
+
* const result = await tx.waitForEvents();
|
|
34842
|
+
* console.log(`Permission granted with ID: ${result.permissionId}`);
|
|
34032
34843
|
* ```
|
|
34033
34844
|
*/
|
|
34034
|
-
submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<
|
|
34845
|
+
submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
|
|
34846
|
+
/**
|
|
34847
|
+
* Composes the EIP-712 typed data for FilePermission.
|
|
34848
|
+
*
|
|
34849
|
+
* @param params - The parameters for composing the file permission message
|
|
34850
|
+
* @param params.nonce - The user's nonce for preventing replay attacks
|
|
34851
|
+
* @param params.fileId - The ID of the file to grant permission for
|
|
34852
|
+
* @param params.account - The account address to grant permission to
|
|
34853
|
+
* @param params.encryptedKey - The encrypted key for the permission
|
|
34854
|
+
* @returns Promise resolving to the typed data structure
|
|
34855
|
+
*/
|
|
34856
|
+
private composeFilePermissionMessage;
|
|
34035
34857
|
/**
|
|
34036
34858
|
* Gets the encrypted key for a specific account's permission to access a file.
|
|
34037
34859
|
*
|
|
@@ -34127,10 +34949,10 @@ declare class DataController {
|
|
|
34127
34949
|
gateways?: string[];
|
|
34128
34950
|
}): Promise<Blob>;
|
|
34129
34951
|
/**
|
|
34130
|
-
* Validates a data schema against the Vana meta-schema.
|
|
34952
|
+
* Validates a data schema definition against the Vana meta-schema.
|
|
34131
34953
|
*
|
|
34132
|
-
* @param schema - The data schema to validate
|
|
34133
|
-
* @returns
|
|
34954
|
+
* @param schema - The data schema definition to validate
|
|
34955
|
+
* @returns The validated DataSchema
|
|
34134
34956
|
* @throws SchemaValidationError if invalid
|
|
34135
34957
|
* @example
|
|
34136
34958
|
* ```typescript
|
|
@@ -34147,10 +34969,10 @@ declare class DataController {
|
|
|
34147
34969
|
* }
|
|
34148
34970
|
* };
|
|
34149
34971
|
*
|
|
34150
|
-
* vana.data.
|
|
34972
|
+
* const validatedSchema = vana.data.validateDataSchemaAgainstMetaSchema(schema);
|
|
34151
34973
|
* ```
|
|
34152
34974
|
*/
|
|
34153
|
-
|
|
34975
|
+
validateDataSchemaAgainstMetaSchema(schema: unknown): DataSchema;
|
|
34154
34976
|
/**
|
|
34155
34977
|
* Validates data against a JSON Schema from a data schema.
|
|
34156
34978
|
*
|
|
@@ -34180,9 +35002,9 @@ declare class DataController {
|
|
|
34180
35002
|
*/
|
|
34181
35003
|
validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
|
|
34182
35004
|
/**
|
|
34183
|
-
* Fetches and validates a schema from a URL, then returns the parsed data schema.
|
|
35005
|
+
* Fetches and validates a data schema from a URL, then returns the parsed data schema.
|
|
34184
35006
|
*
|
|
34185
|
-
* @param url - The URL to fetch the schema from
|
|
35007
|
+
* @param url - The URL to fetch the data schema from
|
|
34186
35008
|
* @returns The validated data schema
|
|
34187
35009
|
* @throws SchemaValidationError if invalid or fetch fails
|
|
34188
35010
|
* @example
|
|
@@ -34198,24 +35020,6 @@ declare class DataController {
|
|
|
34198
35020
|
* ```
|
|
34199
35021
|
*/
|
|
34200
35022
|
fetchAndValidateSchema(url: string): Promise<DataSchema>;
|
|
34201
|
-
/**
|
|
34202
|
-
* Retrieves a schema by ID and fetches its definition URL to get the full data schema.
|
|
34203
|
-
*
|
|
34204
|
-
* @param schemaId - The schema ID to retrieve and validate
|
|
34205
|
-
* @returns The validated data schema
|
|
34206
|
-
* @throws SchemaValidationError if schema is invalid
|
|
34207
|
-
* @example
|
|
34208
|
-
* ```typescript
|
|
34209
|
-
* // Get schema from registry and validate its schema
|
|
34210
|
-
* const schema = await vana.data.getValidatedSchema(123);
|
|
34211
|
-
*
|
|
34212
|
-
* // Use it to validate user data
|
|
34213
|
-
* if (schema.dialect === "json") {
|
|
34214
|
-
* vana.data.validateDataAgainstSchema(userData, schema);
|
|
34215
|
-
* }
|
|
34216
|
-
* ```
|
|
34217
|
-
*/
|
|
34218
|
-
getValidatedSchema(schemaId: number): Promise<DataSchema>;
|
|
34219
35023
|
}
|
|
34220
35024
|
|
|
34221
35025
|
/**
|
|
@@ -34418,6 +35222,31 @@ interface Chains {
|
|
|
34418
35222
|
}
|
|
34419
35223
|
declare const chains: Chains;
|
|
34420
35224
|
|
|
35225
|
+
/**
|
|
35226
|
+
* Creates or retrieves a cached public client for blockchain read operations.
|
|
35227
|
+
*
|
|
35228
|
+
* @remarks
|
|
35229
|
+
* This function provides an optimized way to access blockchain data by maintaining
|
|
35230
|
+
* a cached client instance per chain. The client is used for reading contract state,
|
|
35231
|
+
* querying events, and other read-only blockchain operations. It automatically
|
|
35232
|
+
* handles HTTP transport configuration and chain switching.
|
|
35233
|
+
*
|
|
35234
|
+
* @param chainId - The chain ID to connect to (defaults to Moksha testnet)
|
|
35235
|
+
* @returns A public client configured for the specified chain with caching optimization
|
|
35236
|
+
* @throws {Error} When the specified chain ID is not supported by the SDK
|
|
35237
|
+
* @example
|
|
35238
|
+
* ```typescript
|
|
35239
|
+
* // Get client for default chain (Moksha testnet)
|
|
35240
|
+
* const client = createClient();
|
|
35241
|
+
*
|
|
35242
|
+
* // Get client for specific chain
|
|
35243
|
+
* const mainnetClient = createClient(14800);
|
|
35244
|
+
*
|
|
35245
|
+
* // Use client for blockchain reads
|
|
35246
|
+
* const blockNumber = await client.getBlockNumber();
|
|
35247
|
+
* ```
|
|
35248
|
+
* @category Blockchain
|
|
35249
|
+
*/
|
|
34421
35250
|
declare const createClient: (chainId?: keyof typeof chains) => PublicClient & {
|
|
34422
35251
|
chain: Chain;
|
|
34423
35252
|
};
|
|
@@ -35136,51 +35965,157 @@ declare class SerializationError extends VanaError {
|
|
|
35136
35965
|
constructor(message: string);
|
|
35137
35966
|
}
|
|
35138
35967
|
/**
|
|
35139
|
-
*
|
|
35968
|
+
* Thrown when a signature operation fails or cannot be completed.
|
|
35140
35969
|
*
|
|
35141
35970
|
* @remarks
|
|
35142
|
-
*
|
|
35143
|
-
*
|
|
35144
|
-
*
|
|
35971
|
+
* This error occurs when wallet signature operations fail due to disconnection,
|
|
35972
|
+
* locked accounts, or other wallet-related issues. It preserves the original
|
|
35973
|
+
* error for debugging while providing consistent error handling across the SDK.
|
|
35974
|
+
*
|
|
35975
|
+
* Recovery strategies:
|
|
35976
|
+
* - Check wallet connection and account unlock status
|
|
35977
|
+
* - Retry operation with explicit user interaction
|
|
35978
|
+
* - For gasless operations, consider switching to direct transactions
|
|
35979
|
+
*
|
|
35980
|
+
* @example
|
|
35981
|
+
* ```typescript
|
|
35982
|
+
* try {
|
|
35983
|
+
* await vana.permissions.grant({ grantee: '0x...' });
|
|
35984
|
+
* } catch (error) {
|
|
35985
|
+
* if (error instanceof SignatureError) {
|
|
35986
|
+
* // Prompt user to unlock wallet
|
|
35987
|
+
* await promptWalletUnlock();
|
|
35988
|
+
* // Retry operation
|
|
35989
|
+
* }
|
|
35990
|
+
* }
|
|
35991
|
+
* ```
|
|
35992
|
+
* @category Error Handling
|
|
35145
35993
|
*/
|
|
35146
35994
|
declare class SignatureError extends VanaError {
|
|
35147
35995
|
readonly originalError?: Error | undefined;
|
|
35148
35996
|
constructor(message: string, originalError?: Error | undefined);
|
|
35149
35997
|
}
|
|
35150
35998
|
/**
|
|
35151
|
-
*
|
|
35999
|
+
* Thrown when network communication fails during API calls or blockchain interactions.
|
|
35152
36000
|
*
|
|
35153
36001
|
* @remarks
|
|
35154
|
-
*
|
|
35155
|
-
*
|
|
36002
|
+
* This error encompasses network connectivity issues, API unavailability,
|
|
36003
|
+
* timeout errors, and CORS restrictions. It's commonly encountered during
|
|
36004
|
+
* IPFS operations, subgraph queries, or RPC calls.
|
|
36005
|
+
*
|
|
36006
|
+
* Recovery strategies:
|
|
36007
|
+
* - Check network connectivity
|
|
36008
|
+
* - Retry with exponential backoff
|
|
36009
|
+
* - Verify API endpoints are accessible
|
|
36010
|
+
* - Switch to alternative network providers or gateways
|
|
36011
|
+
*
|
|
36012
|
+
* @example
|
|
36013
|
+
* ```typescript
|
|
36014
|
+
* try {
|
|
36015
|
+
* const files = await vana.data.getUserFiles({ owner: '0x...' });
|
|
36016
|
+
* } catch (error) {
|
|
36017
|
+
* if (error instanceof NetworkError) {
|
|
36018
|
+
* // Implement retry with exponential backoff
|
|
36019
|
+
* await retryWithBackoff(() => vana.data.getUserFiles({ owner: '0x...' }));
|
|
36020
|
+
* }
|
|
36021
|
+
* }
|
|
36022
|
+
* ```
|
|
36023
|
+
* @category Error Handling
|
|
35156
36024
|
*/
|
|
35157
36025
|
declare class NetworkError extends VanaError {
|
|
35158
36026
|
readonly originalError?: Error | undefined;
|
|
35159
36027
|
constructor(message: string, originalError?: Error | undefined);
|
|
35160
36028
|
}
|
|
35161
36029
|
/**
|
|
35162
|
-
*
|
|
36030
|
+
* Thrown when transaction nonce retrieval fails during gasless operations.
|
|
35163
36031
|
*
|
|
35164
36032
|
* @remarks
|
|
35165
|
-
*
|
|
35166
|
-
*
|
|
36033
|
+
* This error occurs when the SDK cannot retrieve the user's current nonce from
|
|
36034
|
+
* smart contracts, preventing gasless transaction submission. Nonces are critical
|
|
36035
|
+
* for preventing replay attacks in signed transactions.
|
|
36036
|
+
*
|
|
36037
|
+
* Recovery strategies:
|
|
36038
|
+
* - Retry nonce retrieval after brief delay
|
|
36039
|
+
* - Check wallet connection and account status
|
|
36040
|
+
* - Use manual nonce specification if supported by the operation
|
|
36041
|
+
* - Switch to direct transactions as fallback
|
|
36042
|
+
*
|
|
36043
|
+
* @example
|
|
36044
|
+
* ```typescript
|
|
36045
|
+
* try {
|
|
36046
|
+
* await vana.permissions.grant({ grantee: '0x...' });
|
|
36047
|
+
* } catch (error) {
|
|
36048
|
+
* if (error instanceof NonceError) {
|
|
36049
|
+
* // Wait and retry
|
|
36050
|
+
* await delay(1000);
|
|
36051
|
+
* await vana.permissions.grant({ grantee: '0x...' });
|
|
36052
|
+
* }
|
|
36053
|
+
* }
|
|
36054
|
+
* ```
|
|
36055
|
+
* @category Error Handling
|
|
35167
36056
|
*/
|
|
35168
36057
|
declare class NonceError extends VanaError {
|
|
35169
36058
|
constructor(message: string);
|
|
35170
36059
|
}
|
|
35171
36060
|
/**
|
|
35172
|
-
*
|
|
36061
|
+
* Thrown when personal server operations fail or cannot be completed.
|
|
35173
36062
|
*
|
|
35174
36063
|
* @remarks
|
|
35175
|
-
*
|
|
35176
|
-
*
|
|
36064
|
+
* This error occurs during interactions with personal servers for computation
|
|
36065
|
+
* requests, identity retrieval, or operation status checks. Common causes include
|
|
36066
|
+
* server unavailability, untrusted server status, or invalid permission grants.
|
|
36067
|
+
*
|
|
36068
|
+
* Recovery strategies:
|
|
36069
|
+
* - Verify server URL accessibility
|
|
36070
|
+
* - Check server trust status via `vana.permissions.getTrustedServers()`
|
|
36071
|
+
* - Ensure valid permissions exist for the operation
|
|
36072
|
+
* - Retry after server becomes available
|
|
36073
|
+
*
|
|
36074
|
+
* @example
|
|
36075
|
+
* ```typescript
|
|
36076
|
+
* try {
|
|
36077
|
+
* const result = await vana.server.createOperation({ permissionId: 123 });
|
|
36078
|
+
* } catch (error) {
|
|
36079
|
+
* if (error instanceof PersonalServerError) {
|
|
36080
|
+
* // Check if server is trusted
|
|
36081
|
+
* const trustedServers = await vana.permissions.getTrustedServers();
|
|
36082
|
+
* if (!trustedServers.includes(serverId)) {
|
|
36083
|
+
* await vana.permissions.trustServer({ serverId });
|
|
36084
|
+
* }
|
|
36085
|
+
* }
|
|
36086
|
+
* }
|
|
36087
|
+
* ```
|
|
36088
|
+
* @category Error Handling
|
|
35177
36089
|
*/
|
|
35178
36090
|
declare class PersonalServerError extends VanaError {
|
|
35179
36091
|
readonly originalError?: Error | undefined;
|
|
35180
36092
|
constructor(message: string, originalError?: Error | undefined);
|
|
35181
36093
|
}
|
|
35182
36094
|
/**
|
|
35183
|
-
*
|
|
36095
|
+
* Thrown when attempting to register a server with a URL different from its existing registration.
|
|
36096
|
+
*
|
|
36097
|
+
* @remarks
|
|
36098
|
+
* This error occurs when trying to add or trust a server that's already registered
|
|
36099
|
+
* on-chain with a different URL. Server URLs are immutable once registered to
|
|
36100
|
+
* maintain consistency and security. Applications should use the existing URL
|
|
36101
|
+
* or register a new server with a different ID.
|
|
36102
|
+
*
|
|
36103
|
+
* @example
|
|
36104
|
+
* ```typescript
|
|
36105
|
+
* try {
|
|
36106
|
+
* await vana.permissions.addAndTrustServer({
|
|
36107
|
+
* serverId: 1,
|
|
36108
|
+
* serverUrl: 'https://new-url.com',
|
|
36109
|
+
* publicKey: '0x...'
|
|
36110
|
+
* });
|
|
36111
|
+
* } catch (error) {
|
|
36112
|
+
* if (error instanceof ServerUrlMismatchError) {
|
|
36113
|
+
* console.log(`Server already registered with: ${error.existingUrl}`);
|
|
36114
|
+
* // Use existing URL or register new server
|
|
36115
|
+
* }
|
|
36116
|
+
* }
|
|
36117
|
+
* ```
|
|
36118
|
+
* @category Error Handling
|
|
35184
36119
|
*/
|
|
35185
36120
|
declare class ServerUrlMismatchError extends VanaError {
|
|
35186
36121
|
constructor(existingUrl: string, providedUrl: string, serverId: string);
|
|
@@ -35189,7 +36124,25 @@ declare class ServerUrlMismatchError extends VanaError {
|
|
|
35189
36124
|
readonly serverId: string;
|
|
35190
36125
|
}
|
|
35191
36126
|
/**
|
|
35192
|
-
*
|
|
36127
|
+
* Thrown when permission grant, revoke, or validation operations fail.
|
|
36128
|
+
*
|
|
36129
|
+
* @remarks
|
|
36130
|
+
* This error occurs during permission management operations including grants,
|
|
36131
|
+
* revocations, and permission validation checks. Common causes include invalid
|
|
36132
|
+
* grantee addresses, expired permissions, or insufficient privileges.
|
|
36133
|
+
*
|
|
36134
|
+
* @example
|
|
36135
|
+
* ```typescript
|
|
36136
|
+
* try {
|
|
36137
|
+
* await vana.permissions.revoke({ permissionId: 999999 });
|
|
36138
|
+
* } catch (error) {
|
|
36139
|
+
* if (error instanceof PermissionError) {
|
|
36140
|
+
* console.error('Permission operation failed:', error.message);
|
|
36141
|
+
* // Permission may not exist or user may not be owner
|
|
36142
|
+
* }
|
|
36143
|
+
* }
|
|
36144
|
+
* ```
|
|
36145
|
+
* @category Error Handling
|
|
35193
36146
|
*/
|
|
35194
36147
|
declare class PermissionError extends VanaError {
|
|
35195
36148
|
readonly originalError?: Error | undefined;
|
|
@@ -36197,21 +37150,53 @@ declare function withSignatureCache(cache: VanaCacheAdapter, walletAddress: stri
|
|
|
36197
37150
|
|
|
36198
37151
|
declare const CONTRACT_ADDRESSES: Record<number, Record<string, string>>;
|
|
36199
37152
|
/**
|
|
36200
|
-
* Retrieves the deployed contract address for a specific contract on a given chain.
|
|
37153
|
+
* Retrieves the deployed contract address for a specific Vana protocol contract on a given chain.
|
|
36201
37154
|
*
|
|
36202
|
-
* @
|
|
36203
|
-
*
|
|
36204
|
-
*
|
|
36205
|
-
*
|
|
37155
|
+
* @remarks
|
|
37156
|
+
* This function provides type-safe access to contract addresses across all supported Vana networks.
|
|
37157
|
+
* It automatically searches both current and legacy contract registries to ensure backwards
|
|
37158
|
+
* compatibility while providing clear error messages for unsupported combinations.
|
|
37159
|
+
*
|
|
37160
|
+
* The function validates that both the chain ID and contract name are supported before
|
|
37161
|
+
* attempting address lookup, helping developers identify deployment or configuration issues
|
|
37162
|
+
* early in the development process.
|
|
37163
|
+
*
|
|
37164
|
+
* **Supported Chains:**
|
|
37165
|
+
* - 14800: Vana Mainnet
|
|
37166
|
+
* - 1480: Moksha Testnet
|
|
37167
|
+
*
|
|
37168
|
+
* **Contract Categories:**
|
|
37169
|
+
* - Data Management: DataRegistry, DataRefinerRegistry
|
|
37170
|
+
* - Permissions: DataPortabilityPermissions, DataPortabilityServers, DataPortabilityGrantees
|
|
37171
|
+
* - Computing: TeePoolPhala, TeePoolDedicatedGpu, etc.
|
|
37172
|
+
* - Token & Governance: DATImplementation, VanaPoolStaking, etc.
|
|
37173
|
+
*
|
|
37174
|
+
* @param chainId - The chain ID to look up the contract on (14800 for mainnet, 1480 for testnet)
|
|
37175
|
+
* @param contract - The contract name to get the address for (use TypeScript autocomplete for available options)
|
|
37176
|
+
* @returns The contract address as a checksummed hex string (0x...)
|
|
37177
|
+
* @throws {Error} When contract address not found for the specified contract and chain combination.
|
|
37178
|
+
* This typically indicates the contract is not deployed on the requested network.
|
|
36206
37179
|
* @example
|
|
36207
37180
|
* ```typescript
|
|
37181
|
+
* // Get core protocol contract addresses
|
|
37182
|
+
* const dataRegistry = getContractAddress(14800, 'DataRegistry');
|
|
37183
|
+
* const permissions = getContractAddress(14800, 'DataPortabilityPermissions');
|
|
37184
|
+
* const trustedServers = getContractAddress(14800, 'DataPortabilityServers');
|
|
37185
|
+
*
|
|
37186
|
+
* // Handle unsupported combinations gracefully
|
|
36208
37187
|
* try {
|
|
36209
|
-
* const
|
|
36210
|
-
* console.log('DataRegistry address:',
|
|
37188
|
+
* const address = getContractAddress(1480, 'DataRegistry');
|
|
37189
|
+
* console.log('DataRegistry testnet address:', address);
|
|
36211
37190
|
* } catch (error) {
|
|
36212
|
-
* console.error('Contract not
|
|
37191
|
+
* console.error('Contract not available on testnet:', error.message);
|
|
37192
|
+
* // Fallback to mainnet or show user-friendly error
|
|
36213
37193
|
* }
|
|
37194
|
+
*
|
|
37195
|
+
* // TypeScript provides autocomplete for contract names
|
|
37196
|
+
* const poolAddress = getContractAddress(14800, 'TeePoolPhala'); // ✅ Valid
|
|
37197
|
+
* // const invalid = getContractAddress(14800, 'InvalidContract'); // ❌ TypeScript error
|
|
36214
37198
|
* ```
|
|
37199
|
+
* @category Configuration
|
|
36215
37200
|
*/
|
|
36216
37201
|
declare const getContractAddress: (chainId: keyof typeof CONTRACT_ADDRESSES, contract: VanaContract) => `0x${string}`;
|
|
36217
37202
|
|
|
@@ -36729,4 +37714,4 @@ declare function Vana(config: VanaConfig): VanaBrowserImpl;
|
|
|
36729
37714
|
*/
|
|
36730
37715
|
type VanaInstance = VanaBrowserImpl;
|
|
36731
37716
|
|
|
36732
|
-
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, 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, 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, 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,
|
|
37717
|
+
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 FilePermissionInput, type FilePermissionParams, type FilePermissionTypedData, 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 };
|