@opendatalabs/vana-sdk 0.1.0-alpha.761813a → 0.1.0-alpha.8eb4e46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/dist/chains.browser.cjs.map +1 -1
- package/dist/chains.browser.js.map +1 -1
- package/dist/chains.cjs.map +1 -1
- package/dist/chains.js.map +1 -1
- package/dist/chains.node.cjs.map +1 -1
- package/dist/chains.node.js.map +1 -1
- package/dist/index.browser.d.ts +906 -269
- package/dist/index.browser.js +639 -530
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +643 -536
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.cts +907 -270
- package/dist/index.node.d.ts +907 -270
- package/dist/index.node.js +638 -530
- package/dist/index.node.js.map +1 -1
- package/dist/platform.browser.js +1 -57
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.cjs +1 -57
- package/dist/platform.cjs.map +1 -1
- package/dist/platform.js +1 -57
- package/dist/platform.js.map +1 -1
- package/dist/platform.node.cjs +1 -57
- package/dist/platform.node.cjs.map +1 -1
- package/dist/platform.node.js +1 -57
- package/dist/platform.node.js.map +1 -1
- package/package.json +10 -2
package/dist/index.node.d.ts
CHANGED
|
@@ -158,37 +158,56 @@ declare class StorageError extends Error {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
|
-
* Represents
|
|
161
|
+
* Represents on-chain permission grant data without expensive off-chain resolution.
|
|
162
162
|
*
|
|
163
|
-
* This interface
|
|
164
|
-
*
|
|
165
|
-
*
|
|
163
|
+
* This interface contains only the fast, on-chain data that can be retrieved
|
|
164
|
+
* efficiently from the subgraph without making individual IPFS or contract calls.
|
|
165
|
+
* Use this for fast permission listing in UIs, then call `retrieveGrantFile()`
|
|
166
|
+
* on specific grants when detailed data is needed.
|
|
166
167
|
*
|
|
167
168
|
* @category Permissions
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* // Fast: Get all on-chain permission data
|
|
172
|
+
* const grants = await vana.permissions.getUserPermissionGrantsOnChain();
|
|
173
|
+
*
|
|
174
|
+
* // Lazy: Resolve detailed data for specific permission when needed
|
|
175
|
+
* const grantFile = await retrieveGrantFile(grants[0].grantUrl);
|
|
176
|
+
* console.log('Operation:', grantFile.operation);
|
|
177
|
+
* ```
|
|
168
178
|
*/
|
|
169
|
-
interface
|
|
179
|
+
interface OnChainPermissionGrant {
|
|
170
180
|
/** Unique identifier for the permission */
|
|
171
181
|
id: bigint;
|
|
172
|
-
/**
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
|
|
182
|
+
/** The grant URL containing detailed permission parameters (IPFS link) */
|
|
183
|
+
grantUrl: string;
|
|
184
|
+
/** Cryptographic signature that authorized this permission */
|
|
185
|
+
grantSignature: string;
|
|
186
|
+
/** Hash of the grant file content for integrity verification */
|
|
187
|
+
grantHash: string;
|
|
188
|
+
/** Nonce used when granting the permission */
|
|
189
|
+
nonce: bigint;
|
|
190
|
+
/** Block number when permission was granted */
|
|
191
|
+
addedAtBlock: bigint;
|
|
192
|
+
/** Timestamp when permission was added */
|
|
193
|
+
addedAtTimestamp: bigint;
|
|
194
|
+
/** Transaction hash of the grant transaction */
|
|
195
|
+
transactionHash: string;
|
|
184
196
|
/** Address that granted the permission */
|
|
185
197
|
grantor: Address;
|
|
186
|
-
/**
|
|
187
|
-
grantee: Address;
|
|
188
|
-
/** Whether the permission is still active */
|
|
198
|
+
/** Whether the permission is still active (not revoked) */
|
|
189
199
|
active: boolean;
|
|
190
|
-
|
|
191
|
-
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Options for retrieving user permissions
|
|
203
|
+
*
|
|
204
|
+
* @category Permissions
|
|
205
|
+
*/
|
|
206
|
+
interface GetUserPermissionsOptions {
|
|
207
|
+
/** Maximum number of permissions to retrieve */
|
|
208
|
+
limit?: number;
|
|
209
|
+
/** Custom subgraph URL to use for querying */
|
|
210
|
+
subgraphUrl?: string;
|
|
192
211
|
}
|
|
193
212
|
/**
|
|
194
213
|
* Parameters for granting data access permission to an application.
|
|
@@ -201,7 +220,7 @@ interface GrantedPermission {
|
|
|
201
220
|
* @example
|
|
202
221
|
* ```typescript
|
|
203
222
|
* const params: GrantPermissionParams = {
|
|
204
|
-
*
|
|
223
|
+
* grantee: '0x1234...', // Application address
|
|
205
224
|
* operation: 'llm_inference',
|
|
206
225
|
* files: [1, 2, 3], // File IDs to grant access to
|
|
207
226
|
* parameters: {
|
|
@@ -214,7 +233,7 @@ interface GrantedPermission {
|
|
|
214
233
|
*/
|
|
215
234
|
interface GrantPermissionParams$1 {
|
|
216
235
|
/** The on-chain identity of the application */
|
|
217
|
-
|
|
236
|
+
grantee: Address;
|
|
218
237
|
/** The class of computation, e.g., "llm_inference" */
|
|
219
238
|
operation: string;
|
|
220
239
|
/** Array of file IDs to grant permission for */
|
|
@@ -493,6 +512,41 @@ interface QueryPermissionsParams {
|
|
|
493
512
|
/** Offset for pagination */
|
|
494
513
|
offset?: number;
|
|
495
514
|
}
|
|
515
|
+
/**
|
|
516
|
+
* Granted permission details
|
|
517
|
+
*
|
|
518
|
+
* @category Permissions
|
|
519
|
+
*/
|
|
520
|
+
interface GrantedPermission {
|
|
521
|
+
/** Unique identifier for the permission */
|
|
522
|
+
id: bigint;
|
|
523
|
+
/** Array of file IDs that the permission applies to */
|
|
524
|
+
files: number[];
|
|
525
|
+
/** The type of operation being granted permission for */
|
|
526
|
+
operation: string;
|
|
527
|
+
/** Grant file reference (IPFS hash or URL) */
|
|
528
|
+
grant: string;
|
|
529
|
+
/** Address of the application granted permission */
|
|
530
|
+
grantee: Address;
|
|
531
|
+
/** Address of the user who granted permission */
|
|
532
|
+
grantor: Address;
|
|
533
|
+
/** Custom parameters for the operation */
|
|
534
|
+
parameters: Record<string, unknown>;
|
|
535
|
+
/** Whether the permission is still active */
|
|
536
|
+
active: boolean;
|
|
537
|
+
/** Data status for the permission */
|
|
538
|
+
dataStatus?: string;
|
|
539
|
+
/** Nonce used for the permission */
|
|
540
|
+
nonce?: number;
|
|
541
|
+
/** Timestamp when permission was granted */
|
|
542
|
+
grantedAt?: number;
|
|
543
|
+
/** Optional expiration timestamp */
|
|
544
|
+
expiresAt?: number;
|
|
545
|
+
/** Transaction hash of the grant transaction */
|
|
546
|
+
transactionHash?: string;
|
|
547
|
+
/** Block number when permission was granted */
|
|
548
|
+
blockNumber?: bigint;
|
|
549
|
+
}
|
|
496
550
|
/**
|
|
497
551
|
* Permission query result
|
|
498
552
|
*
|
|
@@ -715,6 +769,16 @@ interface ServerTrustStatus {
|
|
|
715
769
|
trustIndex?: number;
|
|
716
770
|
}
|
|
717
771
|
|
|
772
|
+
/**
|
|
773
|
+
* Marker interface to indicate that a Vana instance has storage configured.
|
|
774
|
+
* Used for compile-time type safety to ensure storage-dependent methods
|
|
775
|
+
* are only called on properly configured instances.
|
|
776
|
+
*
|
|
777
|
+
* @category Configuration
|
|
778
|
+
*/
|
|
779
|
+
interface StorageRequiredMarker {
|
|
780
|
+
readonly __storageRequired: true;
|
|
781
|
+
}
|
|
718
782
|
/**
|
|
719
783
|
* Configuration for storage providers used by the SDK.
|
|
720
784
|
*
|
|
@@ -837,9 +901,10 @@ interface RelayerCallbacks {
|
|
|
837
901
|
*
|
|
838
902
|
* @param params - Complete parameters for file addition
|
|
839
903
|
* @param params.url - The file URL to register
|
|
840
|
-
* @param params.userAddress - The user's address
|
|
904
|
+
* @param params.userAddress - The user's address (defaults to connected wallet if not specified)
|
|
841
905
|
* @param params.permissions - Array of encrypted permissions (empty array if none)
|
|
842
906
|
* @param params.schemaId - Schema ID for validation (0 if none)
|
|
907
|
+
* @param params.ownerAddress - Optional owner address (defaults to userAddress if not specified)
|
|
843
908
|
* @returns Promise resolving to object with fileId and transactionHash
|
|
844
909
|
*/
|
|
845
910
|
submitFileAdditionComplete?: (params: {
|
|
@@ -850,6 +915,7 @@ interface RelayerCallbacks {
|
|
|
850
915
|
key: string;
|
|
851
916
|
}>;
|
|
852
917
|
schemaId: number;
|
|
918
|
+
ownerAddress?: Address;
|
|
853
919
|
}) => Promise<{
|
|
854
920
|
fileId: number;
|
|
855
921
|
transactionHash: Hash;
|
|
@@ -863,7 +929,122 @@ interface RelayerCallbacks {
|
|
|
863
929
|
storeGrantFile?: (grantData: GrantFile) => Promise<string>;
|
|
864
930
|
}
|
|
865
931
|
/**
|
|
866
|
-
*
|
|
932
|
+
* Storage callback functions for flexible storage operations.
|
|
933
|
+
*
|
|
934
|
+
* Instead of hardcoding storage behavior (HTTP endpoints, etc.), users can provide
|
|
935
|
+
* custom callback functions to handle storage operations in any way they choose.
|
|
936
|
+
* This pattern matches the relayer callbacks approach, providing maximum flexibility.
|
|
937
|
+
*
|
|
938
|
+
* @category Configuration
|
|
939
|
+
* @example
|
|
940
|
+
* ```typescript
|
|
941
|
+
* const storageCallbacks: StorageCallbacks = {
|
|
942
|
+
* async upload(blob, filename, metadata) {
|
|
943
|
+
* // Custom implementation - could be HTTP, S3, local filesystem, etc.
|
|
944
|
+
* const formData = new FormData();
|
|
945
|
+
* formData.append('file', blob, filename);
|
|
946
|
+
* const response = await fetch('/api/storage/upload', {
|
|
947
|
+
* method: 'POST',
|
|
948
|
+
* body: formData
|
|
949
|
+
* });
|
|
950
|
+
* const data = await response.json();
|
|
951
|
+
* return {
|
|
952
|
+
* url: data.url,
|
|
953
|
+
* size: blob.size,
|
|
954
|
+
* contentType: blob.type,
|
|
955
|
+
* metadata: data.metadata
|
|
956
|
+
* };
|
|
957
|
+
* },
|
|
958
|
+
*
|
|
959
|
+
* async download(identifier) {
|
|
960
|
+
* const response = await fetch(`/api/storage/download/${identifier}`);
|
|
961
|
+
* return response.blob();
|
|
962
|
+
* }
|
|
963
|
+
* };
|
|
964
|
+
* ```
|
|
965
|
+
*/
|
|
966
|
+
interface StorageCallbacks {
|
|
967
|
+
/**
|
|
968
|
+
* Upload a blob to storage
|
|
969
|
+
*
|
|
970
|
+
* @param blob - The data to upload
|
|
971
|
+
* @param filename - Optional filename hint
|
|
972
|
+
* @param metadata - Optional metadata for the upload
|
|
973
|
+
* @returns Upload result with identifier and metadata
|
|
974
|
+
*/
|
|
975
|
+
upload: (blob: Blob, filename?: string, metadata?: Record<string, unknown>) => Promise<StorageUploadResult>;
|
|
976
|
+
/**
|
|
977
|
+
* Download data from storage
|
|
978
|
+
*
|
|
979
|
+
* @param identifier - The storage identifier (could be URL, hash, path, or any unique ID)
|
|
980
|
+
* @param options - Optional download options
|
|
981
|
+
* @returns The downloaded data as a Blob
|
|
982
|
+
*/
|
|
983
|
+
download: (identifier: string, options?: StorageDownloadOptions) => Promise<Blob>;
|
|
984
|
+
/**
|
|
985
|
+
* List stored items (optional)
|
|
986
|
+
*
|
|
987
|
+
* @param prefix - Optional prefix to filter results
|
|
988
|
+
* @param options - Optional listing options
|
|
989
|
+
* @returns Array of storage items with metadata
|
|
990
|
+
*/
|
|
991
|
+
list?: (prefix?: string, options?: StorageListOptions) => Promise<StorageListResult>;
|
|
992
|
+
/**
|
|
993
|
+
* Delete a stored item (optional)
|
|
994
|
+
*
|
|
995
|
+
* @param identifier - The storage identifier to delete
|
|
996
|
+
* @returns Promise that resolves to true if deletion succeeded
|
|
997
|
+
*/
|
|
998
|
+
delete?: (identifier: string) => Promise<boolean>;
|
|
999
|
+
/**
|
|
1000
|
+
* Extract identifier from a URL or return as-is (optional)
|
|
1001
|
+
* Used for backward compatibility with URL-based systems
|
|
1002
|
+
*
|
|
1003
|
+
* @param url - The URL to extract from
|
|
1004
|
+
* @returns The extracted identifier
|
|
1005
|
+
*/
|
|
1006
|
+
extractIdentifier?: (url: string) => string;
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Options for storage download operations
|
|
1010
|
+
*
|
|
1011
|
+
* @category Configuration
|
|
1012
|
+
*/
|
|
1013
|
+
interface StorageDownloadOptions {
|
|
1014
|
+
/** Optional HTTP headers */
|
|
1015
|
+
headers?: Record<string, string>;
|
|
1016
|
+
/** Optional abort signal for cancellation */
|
|
1017
|
+
signal?: AbortSignal;
|
|
1018
|
+
/** Optional byte range for partial downloads */
|
|
1019
|
+
range?: {
|
|
1020
|
+
start?: number;
|
|
1021
|
+
end?: number;
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Result from storage list operations
|
|
1026
|
+
*
|
|
1027
|
+
* @category Configuration
|
|
1028
|
+
*/
|
|
1029
|
+
interface StorageListResult {
|
|
1030
|
+
/** Array of storage items */
|
|
1031
|
+
items: Array<{
|
|
1032
|
+
/** Item identifier */
|
|
1033
|
+
identifier: string;
|
|
1034
|
+
/** Item size in bytes */
|
|
1035
|
+
size?: number;
|
|
1036
|
+
/** Last modified timestamp */
|
|
1037
|
+
lastModified?: Date;
|
|
1038
|
+
/** Item metadata */
|
|
1039
|
+
metadata?: Record<string, unknown>;
|
|
1040
|
+
}>;
|
|
1041
|
+
/** Continuation token for pagination */
|
|
1042
|
+
continuationToken?: string;
|
|
1043
|
+
/** Whether more results are available */
|
|
1044
|
+
hasMore?: boolean;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Base configuration interface without storage requirements
|
|
867
1048
|
*
|
|
868
1049
|
* @category Configuration
|
|
869
1050
|
*/
|
|
@@ -881,6 +1062,42 @@ interface BaseConfig {
|
|
|
881
1062
|
* Can be overridden per method call if needed.
|
|
882
1063
|
*/
|
|
883
1064
|
subgraphUrl?: string;
|
|
1065
|
+
/**
|
|
1066
|
+
* Optional default IPFS gateways to use for fetching files.
|
|
1067
|
+
* These gateways will be used by default in fetchFromIPFS unless overridden per-call.
|
|
1068
|
+
* If not provided, the SDK will use public gateways.
|
|
1069
|
+
*
|
|
1070
|
+
* @example ['https://gateway.pinata.cloud', 'https://ipfs.io']
|
|
1071
|
+
*/
|
|
1072
|
+
ipfsGateways?: string[];
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Base configuration interface that requires storage for storage-dependent operations
|
|
1076
|
+
*
|
|
1077
|
+
* @category Configuration
|
|
1078
|
+
*/
|
|
1079
|
+
interface BaseConfigWithStorage {
|
|
1080
|
+
/**
|
|
1081
|
+
* Optional relayer callback functions for handling gasless transactions.
|
|
1082
|
+
* Provides flexible relay mechanism - can use HTTP, WebSocket, or any custom implementation.
|
|
1083
|
+
*/
|
|
1084
|
+
relayerCallbacks?: RelayerCallbacks;
|
|
1085
|
+
/** Required storage providers configuration for file upload/download */
|
|
1086
|
+
storage: StorageConfig;
|
|
1087
|
+
/**
|
|
1088
|
+
* Optional subgraph URL for querying user files and permissions.
|
|
1089
|
+
* If not provided, defaults to the built-in subgraph URL for the current chain.
|
|
1090
|
+
* Can be overridden per method call if needed.
|
|
1091
|
+
*/
|
|
1092
|
+
subgraphUrl?: string;
|
|
1093
|
+
/**
|
|
1094
|
+
* Optional default IPFS gateways to use for fetching files.
|
|
1095
|
+
* These gateways will be used by default in fetchFromIPFS unless overridden per-call.
|
|
1096
|
+
* If not provided, the SDK will use public gateways.
|
|
1097
|
+
*
|
|
1098
|
+
* @example ['https://gateway.pinata.cloud', 'https://ipfs.io']
|
|
1099
|
+
*/
|
|
1100
|
+
ipfsGateways?: string[];
|
|
884
1101
|
}
|
|
885
1102
|
/**
|
|
886
1103
|
* Configuration with wallet client
|
|
@@ -893,6 +1110,17 @@ interface WalletConfig extends BaseConfig {
|
|
|
893
1110
|
chain: VanaChain;
|
|
894
1111
|
};
|
|
895
1112
|
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Configuration with wallet client that requires storage
|
|
1115
|
+
*
|
|
1116
|
+
* @category Configuration
|
|
1117
|
+
*/
|
|
1118
|
+
interface WalletConfigWithStorage extends BaseConfigWithStorage {
|
|
1119
|
+
/** The viem WalletClient instance used for signing transactions */
|
|
1120
|
+
walletClient: WalletClient & {
|
|
1121
|
+
chain: VanaChain;
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
896
1124
|
/**
|
|
897
1125
|
* Configuration with chain and account details
|
|
898
1126
|
*
|
|
@@ -906,6 +1134,19 @@ interface ChainConfig extends BaseConfig {
|
|
|
906
1134
|
/** Optional account for signing transactions */
|
|
907
1135
|
account?: Account;
|
|
908
1136
|
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Configuration with chain and account details that requires storage
|
|
1139
|
+
*
|
|
1140
|
+
* @category Configuration
|
|
1141
|
+
*/
|
|
1142
|
+
interface ChainConfigWithStorage extends BaseConfigWithStorage {
|
|
1143
|
+
/** The chain ID for Vana network */
|
|
1144
|
+
chainId: VanaChainId;
|
|
1145
|
+
/** RPC URL for the chain (optional, will use default for the chain if not provided) */
|
|
1146
|
+
rpcUrl?: string;
|
|
1147
|
+
/** Optional account for signing transactions */
|
|
1148
|
+
account?: Account;
|
|
1149
|
+
}
|
|
909
1150
|
/**
|
|
910
1151
|
* Main configuration interface for initializing the Vana SDK.
|
|
911
1152
|
*
|
|
@@ -945,6 +1186,32 @@ interface ChainConfig extends BaseConfig {
|
|
|
945
1186
|
* ```
|
|
946
1187
|
*/
|
|
947
1188
|
type VanaConfig = WalletConfig | ChainConfig;
|
|
1189
|
+
/**
|
|
1190
|
+
* Configuration interface for Vana SDK that requires storage providers.
|
|
1191
|
+
*
|
|
1192
|
+
* Use this type when you need to ensure storage is configured for operations
|
|
1193
|
+
* like file uploads, permission grants without pre-stored URLs, or schema creation.
|
|
1194
|
+
*
|
|
1195
|
+
* @category Configuration
|
|
1196
|
+
* @example
|
|
1197
|
+
* ```typescript
|
|
1198
|
+
* // Configuration that guarantees storage availability
|
|
1199
|
+
* const config: VanaConfigWithStorage = {
|
|
1200
|
+
* walletClient: createWalletClient({
|
|
1201
|
+
* account: privateKeyToAccount('0x...'),
|
|
1202
|
+
* chain: moksha,
|
|
1203
|
+
* transport: http()
|
|
1204
|
+
* }),
|
|
1205
|
+
* storage: {
|
|
1206
|
+
* providers: {
|
|
1207
|
+
* ipfs: new IPFSStorage({ gateway: 'https://gateway.pinata.cloud' })
|
|
1208
|
+
* },
|
|
1209
|
+
* defaultProvider: 'ipfs'
|
|
1210
|
+
* }
|
|
1211
|
+
* };
|
|
1212
|
+
* ```
|
|
1213
|
+
*/
|
|
1214
|
+
type VanaConfigWithStorage = WalletConfigWithStorage | ChainConfigWithStorage;
|
|
948
1215
|
/**
|
|
949
1216
|
* Runtime configuration information
|
|
950
1217
|
*
|
|
@@ -993,6 +1260,22 @@ declare function isWalletConfig(config: VanaConfig): config is WalletConfig;
|
|
|
993
1260
|
* ```
|
|
994
1261
|
*/
|
|
995
1262
|
declare function isChainConfig(config: VanaConfig): config is ChainConfig;
|
|
1263
|
+
/**
|
|
1264
|
+
* Validates whether a configuration has required storage providers.
|
|
1265
|
+
*
|
|
1266
|
+
* @param config - The configuration object to check
|
|
1267
|
+
* @returns True if the config has storage providers configured
|
|
1268
|
+
* @example
|
|
1269
|
+
* ```typescript
|
|
1270
|
+
* if (hasStorageConfig(config)) {
|
|
1271
|
+
* // Safe to use storage-dependent operations
|
|
1272
|
+
* await vana.data.uploadFile(file);
|
|
1273
|
+
* } else {
|
|
1274
|
+
* console.log('Storage not configured - some operations may fail');
|
|
1275
|
+
* }
|
|
1276
|
+
* ```
|
|
1277
|
+
*/
|
|
1278
|
+
declare function hasStorageConfig(config: VanaConfig): config is VanaConfigWithStorage;
|
|
996
1279
|
/**
|
|
997
1280
|
* Configuration validation options
|
|
998
1281
|
*
|
|
@@ -1144,6 +1427,10 @@ interface FileMetadata {
|
|
|
1144
1427
|
* @remarks
|
|
1145
1428
|
* This is the primary interface for uploading user data through the simplified `vana.data.upload()` method.
|
|
1146
1429
|
* It handles the complete workflow including encryption, storage, and blockchain registration.
|
|
1430
|
+
*
|
|
1431
|
+
* When using permissions with encryption enabled (default), you must provide the public key
|
|
1432
|
+
* for each permission recipient.
|
|
1433
|
+
*
|
|
1147
1434
|
* @example
|
|
1148
1435
|
* ```typescript
|
|
1149
1436
|
* // Basic file upload
|
|
@@ -1159,14 +1446,27 @@ interface FileMetadata {
|
|
|
1159
1446
|
* schemaId: 1
|
|
1160
1447
|
* });
|
|
1161
1448
|
*
|
|
1162
|
-
* // Upload with permissions for an app
|
|
1449
|
+
* // Upload with permissions for an app (encrypted - requires publicKey)
|
|
1163
1450
|
* const result = await vana.data.upload({
|
|
1164
1451
|
* content: "Data for AI analysis",
|
|
1165
1452
|
* filename: "analysis.txt",
|
|
1166
1453
|
* permissions: [{
|
|
1167
|
-
*
|
|
1454
|
+
* grantee: "0x1234...",
|
|
1168
1455
|
* operation: "llm_inference",
|
|
1169
|
-
* parameters: { model: "gpt-4" }
|
|
1456
|
+
* parameters: { model: "gpt-4" },
|
|
1457
|
+
* publicKey: "0x04..." // Required when encrypt is true (default)
|
|
1458
|
+
* }]
|
|
1459
|
+
* });
|
|
1460
|
+
*
|
|
1461
|
+
* // Upload without encryption (publicKey optional)
|
|
1462
|
+
* const result = await vana.data.upload({
|
|
1463
|
+
* content: "Public data",
|
|
1464
|
+
* filename: "public.txt",
|
|
1465
|
+
* encrypt: false,
|
|
1466
|
+
* permissions: [{
|
|
1467
|
+
* grantee: "0x1234...",
|
|
1468
|
+
* operation: "read",
|
|
1469
|
+
* parameters: {}
|
|
1170
1470
|
* }]
|
|
1171
1471
|
* });
|
|
1172
1472
|
* ```
|
|
@@ -1185,6 +1485,32 @@ interface UploadParams {
|
|
|
1185
1485
|
encrypt?: boolean;
|
|
1186
1486
|
/** Optional storage provider name. */
|
|
1187
1487
|
providerName?: string;
|
|
1488
|
+
/** Optional owner address (defaults to current wallet address). */
|
|
1489
|
+
owner?: Address;
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Upload parameters with encryption enabled (requires EncryptedPermissionParams).
|
|
1493
|
+
*
|
|
1494
|
+
* @remarks
|
|
1495
|
+
* This interface ensures type safety when using encrypted uploads with permissions.
|
|
1496
|
+
* @category Data Management
|
|
1497
|
+
*/
|
|
1498
|
+
interface EncryptedUploadParams extends Omit<UploadParams, "permissions" | "encrypt"> {
|
|
1499
|
+
/** Permissions with required public keys for encrypted data sharing. */
|
|
1500
|
+
permissions?: EncryptedPermissionParams[];
|
|
1501
|
+
/** Encryption is enabled. */
|
|
1502
|
+
encrypt: true;
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Upload parameters with encryption disabled.
|
|
1506
|
+
*
|
|
1507
|
+
* @remarks
|
|
1508
|
+
* This interface is used when uploading unencrypted data.
|
|
1509
|
+
* @category Data Management
|
|
1510
|
+
*/
|
|
1511
|
+
interface UnencryptedUploadParams extends Omit<UploadParams, "encrypt"> {
|
|
1512
|
+
/** Encryption is disabled. */
|
|
1513
|
+
encrypt: false;
|
|
1188
1514
|
}
|
|
1189
1515
|
/**
|
|
1190
1516
|
* Permission parameters for granting access during file upload.
|
|
@@ -1195,7 +1521,7 @@ interface UploadParams {
|
|
|
1195
1521
|
*/
|
|
1196
1522
|
interface PermissionParams {
|
|
1197
1523
|
/** The address of the application to grant permission to. */
|
|
1198
|
-
|
|
1524
|
+
grantee: Address;
|
|
1199
1525
|
/** The operation type (e.g., "llm_inference"). */
|
|
1200
1526
|
operation: string;
|
|
1201
1527
|
/** Additional parameters for the permission. */
|
|
@@ -1207,6 +1533,18 @@ interface PermissionParams {
|
|
|
1207
1533
|
/** Public key of the recipient to encrypt the data key for (required for upload with permissions). */
|
|
1208
1534
|
publicKey?: string;
|
|
1209
1535
|
}
|
|
1536
|
+
/**
|
|
1537
|
+
* Permission parameters with required public key for encrypted uploads.
|
|
1538
|
+
*
|
|
1539
|
+
* @remarks
|
|
1540
|
+
* This type extends PermissionParams and makes publicKey required, ensuring
|
|
1541
|
+
* compile-time safety when permissions are used with encryption.
|
|
1542
|
+
* @category Data Management
|
|
1543
|
+
*/
|
|
1544
|
+
interface EncryptedPermissionParams extends PermissionParams {
|
|
1545
|
+
/** Public key of the recipient to encrypt the data key for. */
|
|
1546
|
+
publicKey: string;
|
|
1547
|
+
}
|
|
1210
1548
|
/**
|
|
1211
1549
|
* Result of the high-level upload operation.
|
|
1212
1550
|
*
|
|
@@ -2102,88 +2440,96 @@ declare class PinataStorage implements StorageProvider {
|
|
|
2102
2440
|
private isValidCID;
|
|
2103
2441
|
}
|
|
2104
2442
|
|
|
2105
|
-
interface ServerProxyConfig {
|
|
2106
|
-
/** Server endpoint for file uploads */
|
|
2107
|
-
uploadUrl: string;
|
|
2108
|
-
/** Server endpoint for file downloads */
|
|
2109
|
-
downloadUrl: string;
|
|
2110
|
-
}
|
|
2111
2443
|
/**
|
|
2112
|
-
*
|
|
2444
|
+
* Storage provider that delegates all operations to user-provided callbacks.
|
|
2113
2445
|
*
|
|
2114
|
-
*
|
|
2115
|
-
*
|
|
2116
|
-
*
|
|
2117
|
-
* endpoints, allowing you to implement any storage strategy (IPFS, S3, local filesystem, etc.)
|
|
2118
|
-
* on the server side while maintaining a consistent client interface.
|
|
2446
|
+
* This provider follows the same flexible pattern as relayer callbacks,
|
|
2447
|
+
* allowing users to implement storage operations in any way they choose
|
|
2448
|
+
* (HTTP, WebSocket, direct cloud APIs, local filesystem, etc.).
|
|
2119
2449
|
*
|
|
2120
2450
|
* @category Storage
|
|
2121
|
-
*
|
|
2122
2451
|
* @example
|
|
2123
2452
|
* ```typescript
|
|
2124
|
-
*
|
|
2125
|
-
*
|
|
2126
|
-
*
|
|
2127
|
-
*
|
|
2128
|
-
*
|
|
2129
|
-
*
|
|
2130
|
-
*
|
|
2453
|
+
* // HTTP-based implementation
|
|
2454
|
+
* const httpCallbacks: StorageCallbacks = {
|
|
2455
|
+
* async upload(blob, filename) {
|
|
2456
|
+
* const formData = new FormData();
|
|
2457
|
+
* formData.append('file', blob, filename);
|
|
2458
|
+
* const response = await fetch('/api/storage/upload', {
|
|
2459
|
+
* method: 'POST',
|
|
2460
|
+
* body: formData
|
|
2461
|
+
* });
|
|
2462
|
+
* const data = await response.json();
|
|
2463
|
+
* return {
|
|
2464
|
+
* url: data.url,
|
|
2465
|
+
* size: blob.size,
|
|
2466
|
+
* contentType: blob.type
|
|
2467
|
+
* };
|
|
2468
|
+
* },
|
|
2469
|
+
* async download(identifier) {
|
|
2470
|
+
* const response = await fetch(`/api/storage/download/${identifier}`);
|
|
2471
|
+
* return response.blob();
|
|
2472
|
+
* }
|
|
2473
|
+
* };
|
|
2131
2474
|
*
|
|
2132
|
-
*
|
|
2133
|
-
*
|
|
2475
|
+
* const storage = new CallbackStorage(httpCallbacks);
|
|
2476
|
+
*
|
|
2477
|
+
* // Direct S3 implementation
|
|
2478
|
+
* const s3Callbacks: StorageCallbacks = {
|
|
2479
|
+
* async upload(blob, filename) {
|
|
2480
|
+
* const url = await getPresignedUploadUrl(filename);
|
|
2481
|
+
* await fetch(url, { method: 'PUT', body: blob });
|
|
2482
|
+
* return {
|
|
2483
|
+
* url: `s3://my-bucket/${filename}`,
|
|
2484
|
+
* size: blob.size,
|
|
2485
|
+
* contentType: blob.type
|
|
2486
|
+
* };
|
|
2487
|
+
* },
|
|
2488
|
+
* async download(identifier) {
|
|
2489
|
+
* const url = await getPresignedDownloadUrl(identifier);
|
|
2490
|
+
* const response = await fetch(url);
|
|
2491
|
+
* return response.blob();
|
|
2492
|
+
* }
|
|
2493
|
+
* };
|
|
2134
2494
|
* ```
|
|
2135
2495
|
*/
|
|
2136
|
-
declare class
|
|
2137
|
-
private
|
|
2138
|
-
constructor(
|
|
2496
|
+
declare class CallbackStorage implements StorageProvider {
|
|
2497
|
+
private readonly callbacks;
|
|
2498
|
+
constructor(callbacks: StorageCallbacks);
|
|
2139
2499
|
/**
|
|
2140
|
-
*
|
|
2500
|
+
* Upload a file using the provided callback
|
|
2141
2501
|
*
|
|
2142
|
-
* @
|
|
2143
|
-
*
|
|
2144
|
-
*
|
|
2145
|
-
* and must return a JSON response with `success: true` and an `identifier` field.
|
|
2146
|
-
*
|
|
2147
|
-
* @param file - The file to upload
|
|
2148
|
-
* @param filename - Optional custom filename
|
|
2149
|
-
* @returns Promise that resolves to the server-provided identifier
|
|
2150
|
-
* @throws {StorageError} When the upload fails or server returns an error
|
|
2151
|
-
*
|
|
2152
|
-
* @example
|
|
2153
|
-
* ```typescript
|
|
2154
|
-
* const identifier = await serverStorage.upload(fileBlob, { name: "report.pdf" });
|
|
2155
|
-
* console.log("File uploaded with identifier:", identifier);
|
|
2156
|
-
* ```
|
|
2502
|
+
* @param file - The blob to upload
|
|
2503
|
+
* @param filename - Optional filename for the upload
|
|
2504
|
+
* @returns The upload result with URL and metadata
|
|
2157
2505
|
*/
|
|
2158
2506
|
upload(file: Blob, filename?: string): Promise<StorageUploadResult>;
|
|
2159
2507
|
/**
|
|
2160
|
-
*
|
|
2508
|
+
* Download a file using the provided callback
|
|
2161
2509
|
*
|
|
2162
|
-
* @
|
|
2163
|
-
*
|
|
2164
|
-
|
|
2165
|
-
|
|
2510
|
+
* @param url - The URL or identifier to download
|
|
2511
|
+
* @returns The downloaded blob
|
|
2512
|
+
*/
|
|
2513
|
+
download(url: string): Promise<Blob>;
|
|
2514
|
+
/**
|
|
2515
|
+
* List files using the provided callback (if available)
|
|
2166
2516
|
*
|
|
2167
|
-
* @param
|
|
2168
|
-
* @returns
|
|
2169
|
-
|
|
2517
|
+
* @param options - Optional list options including filters and pagination
|
|
2518
|
+
* @returns Array of storage files
|
|
2519
|
+
*/
|
|
2520
|
+
list(options?: StorageListOptions): Promise<StorageFile[]>;
|
|
2521
|
+
/**
|
|
2522
|
+
* Delete a file using the provided callback (if available)
|
|
2170
2523
|
*
|
|
2171
|
-
* @
|
|
2172
|
-
*
|
|
2173
|
-
* const fileBlob = await serverStorage.download("file-123");
|
|
2174
|
-
* const url = URL.createObjectURL(fileBlob);
|
|
2175
|
-
* ```
|
|
2524
|
+
* @param url - The URL or identifier to delete
|
|
2525
|
+
* @returns True if deletion succeeded
|
|
2176
2526
|
*/
|
|
2177
|
-
|
|
2178
|
-
list(_options?: StorageListOptions): Promise<StorageFile[]>;
|
|
2179
|
-
delete(_url: string): Promise<boolean>;
|
|
2527
|
+
delete(url: string): Promise<boolean>;
|
|
2180
2528
|
/**
|
|
2181
|
-
*
|
|
2529
|
+
* Get provider configuration
|
|
2182
2530
|
*
|
|
2183
|
-
* @
|
|
2184
|
-
* @returns identifier string
|
|
2531
|
+
* @returns Provider configuration metadata
|
|
2185
2532
|
*/
|
|
2186
|
-
private extractIdentifierFromUrl;
|
|
2187
2533
|
getConfig(): StorageProviderConfig;
|
|
2188
2534
|
}
|
|
2189
2535
|
|
|
@@ -2509,6 +2855,12 @@ interface ControllerContext$1 {
|
|
|
2509
2855
|
subgraphUrl?: string;
|
|
2510
2856
|
/** Adapts SDK functionality to the current runtime environment. */
|
|
2511
2857
|
platform: VanaPlatformAdapter;
|
|
2858
|
+
/** Validates that storage is available for storage-dependent operations. */
|
|
2859
|
+
validateStorageRequired?: () => void;
|
|
2860
|
+
/** Checks whether storage is configured without throwing an error. */
|
|
2861
|
+
hasStorage?: () => boolean;
|
|
2862
|
+
/** Default IPFS gateways to use for fetching files. */
|
|
2863
|
+
ipfsGateways?: string[];
|
|
2512
2864
|
}
|
|
2513
2865
|
/**
|
|
2514
2866
|
* Manages gasless data access permissions and trusted server registry operations.
|
|
@@ -2527,7 +2879,7 @@ interface ControllerContext$1 {
|
|
|
2527
2879
|
* ```typescript
|
|
2528
2880
|
* // Grant permission for an app to access your data
|
|
2529
2881
|
* const txHash = await vana.permissions.grant({
|
|
2530
|
-
*
|
|
2882
|
+
* grantee: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
|
|
2531
2883
|
* operation: "llm_inference",
|
|
2532
2884
|
* parameters: { model: "gpt-4", maxTokens: 1000 },
|
|
2533
2885
|
* });
|
|
@@ -2565,7 +2917,7 @@ declare class PermissionsController {
|
|
|
2565
2917
|
* @example
|
|
2566
2918
|
* ```typescript
|
|
2567
2919
|
* const txHash = await vana.permissions.grant({
|
|
2568
|
-
*
|
|
2920
|
+
* grantee: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
|
|
2569
2921
|
* operation: "llm_inference",
|
|
2570
2922
|
* parameters: {
|
|
2571
2923
|
* model: "gpt-4",
|
|
@@ -2591,7 +2943,7 @@ declare class PermissionsController {
|
|
|
2591
2943
|
* @example
|
|
2592
2944
|
* ```typescript
|
|
2593
2945
|
* const { preview, confirm } = await vana.permissions.prepareGrant({
|
|
2594
|
-
*
|
|
2946
|
+
* grantee: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
|
|
2595
2947
|
* operation: "llm_inference",
|
|
2596
2948
|
* files: [1, 2, 3],
|
|
2597
2949
|
* parameters: { model: "gpt-4", prompt: "Analyze my social media data" }
|
|
@@ -2634,7 +2986,7 @@ declare class PermissionsController {
|
|
|
2634
2986
|
* @example
|
|
2635
2987
|
* ```typescript
|
|
2636
2988
|
* const { typedData, signature } = await vana.permissions.createAndSign({
|
|
2637
|
-
*
|
|
2989
|
+
* grantee: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
|
|
2638
2990
|
* operation: "data_analysis",
|
|
2639
2991
|
* parameters: { analysisType: "sentiment" },
|
|
2640
2992
|
* });
|
|
@@ -2739,7 +3091,7 @@ declare class PermissionsController {
|
|
|
2739
3091
|
* Composes the EIP-712 typed data for PermissionGrant (new simplified format).
|
|
2740
3092
|
*
|
|
2741
3093
|
* @param params - The parameters for composing the permission grant message
|
|
2742
|
-
* @param params.
|
|
3094
|
+
* @param params.grantee - The recipient address for the permission grant
|
|
2743
3095
|
* @param params.operation - The type of operation being granted permission for
|
|
2744
3096
|
* @param params.files - Array of file IDs that the permission applies to
|
|
2745
3097
|
* @param params.grantUrl - URL where the grant details are stored
|
|
@@ -2768,36 +3120,41 @@ declare class PermissionsController {
|
|
|
2768
3120
|
*/
|
|
2769
3121
|
private getUserAddress;
|
|
2770
3122
|
/**
|
|
2771
|
-
*
|
|
3123
|
+
* Gets on-chain permission grant data without expensive off-chain resolution.
|
|
2772
3124
|
*
|
|
2773
3125
|
* @remarks
|
|
2774
|
-
* This method
|
|
2775
|
-
*
|
|
2776
|
-
*
|
|
2777
|
-
*
|
|
2778
|
-
*
|
|
2779
|
-
*
|
|
2780
|
-
*
|
|
2781
|
-
*
|
|
2782
|
-
*
|
|
2783
|
-
*
|
|
3126
|
+
* This method provides a fast, performance-focused way to retrieve permission grants
|
|
3127
|
+
* by querying only the subgraph without making expensive IPFS or individual contract calls.
|
|
3128
|
+
* It eliminates the N+1 query problem of the legacy `getUserPermissions()` method.
|
|
3129
|
+
*
|
|
3130
|
+
* The returned data contains all on-chain information but does NOT include resolved
|
|
3131
|
+
* operation details, parameters, or file IDs. Use `retrieveGrantFile()` separately
|
|
3132
|
+
* for specific grants when detailed data is needed.
|
|
3133
|
+
*
|
|
3134
|
+
* **Performance**: Completes in ~100-500ms regardless of permission count.
|
|
3135
|
+
* **Reliability**: Single point of failure (subgraph) with clear RPC fallback path.
|
|
3136
|
+
*
|
|
3137
|
+
* @param options - Options for retrieving permissions (limit, subgraph URL)
|
|
3138
|
+
* @returns A Promise that resolves to an array of `OnChainPermissionGrant` objects
|
|
3139
|
+
* @throws {BlockchainError} When subgraph query fails
|
|
3140
|
+
* @throws {NetworkError} When network requests fail
|
|
2784
3141
|
* @example
|
|
2785
3142
|
* ```typescript
|
|
2786
|
-
* // Get all
|
|
2787
|
-
* const
|
|
3143
|
+
* // Fast: Get all on-chain permission data
|
|
3144
|
+
* const grants = await vana.permissions.getUserPermissionGrantsOnChain({ limit: 20 });
|
|
2788
3145
|
*
|
|
2789
|
-
*
|
|
2790
|
-
*
|
|
3146
|
+
* // Display in UI immediately
|
|
3147
|
+
* grants.forEach(grant => {
|
|
3148
|
+
* console.log(`Permission ${grant.id}: ${grant.grantUrl}`);
|
|
2791
3149
|
* });
|
|
2792
3150
|
*
|
|
2793
|
-
* //
|
|
2794
|
-
* const
|
|
3151
|
+
* // Lazy load detailed data for specific permission when user clicks
|
|
3152
|
+
* const grantFile = await retrieveGrantFile(grants[0].grantUrl);
|
|
3153
|
+
* console.log(`Operation: ${grantFile.operation}`);
|
|
3154
|
+
* console.log(`Parameters:`, grantFile.parameters);
|
|
2795
3155
|
* ```
|
|
2796
3156
|
*/
|
|
2797
|
-
|
|
2798
|
-
limit?: number;
|
|
2799
|
-
subgraphUrl?: string;
|
|
2800
|
-
}): Promise<GrantedPermission[]>;
|
|
3157
|
+
getUserPermissionGrantsOnChain(options?: GetUserPermissionsOptions): Promise<OnChainPermissionGrant[]>;
|
|
2801
3158
|
/**
|
|
2802
3159
|
* Gets all permission IDs for a specific file.
|
|
2803
3160
|
*
|
|
@@ -3316,14 +3673,21 @@ interface InitPersonalServerParams {
|
|
|
3316
3673
|
/** The user's wallet address */
|
|
3317
3674
|
userAddress: string;
|
|
3318
3675
|
}
|
|
3676
|
+
/**
|
|
3677
|
+
* Extended personal server identity information including connection details.
|
|
3678
|
+
* This combines the base PersonalServerModel with additional metadata
|
|
3679
|
+
* needed for client connections.
|
|
3680
|
+
*/
|
|
3319
3681
|
interface PersonalServerIdentity {
|
|
3320
|
-
/**
|
|
3682
|
+
/** Resource type identifier */
|
|
3683
|
+
kind: string;
|
|
3684
|
+
/** The server's Ethereum address */
|
|
3321
3685
|
address: string;
|
|
3322
|
-
/**
|
|
3686
|
+
/** The server's public key for encryption */
|
|
3323
3687
|
public_key: string;
|
|
3324
|
-
/**
|
|
3688
|
+
/** The base URL for connecting to this server */
|
|
3325
3689
|
base_url: string;
|
|
3326
|
-
/**
|
|
3690
|
+
/** Human-readable name for this server */
|
|
3327
3691
|
name: string;
|
|
3328
3692
|
}
|
|
3329
3693
|
|
|
@@ -3838,9 +4202,22 @@ interface components {
|
|
|
3838
4202
|
type $defs = Record<string, never>;
|
|
3839
4203
|
type operations = Record<string, never>;
|
|
3840
4204
|
|
|
4205
|
+
type CreateOperationRequest = components["schemas"]["CreateOperationRequest"];
|
|
3841
4206
|
type CreateOperationResponse = components["schemas"]["CreateOperationResponse"];
|
|
3842
4207
|
type GetOperationResponse = components["schemas"]["GetOperationResponse"];
|
|
3843
|
-
type
|
|
4208
|
+
type IdentityResponseModel = components["schemas"]["IdentityResponseModel"];
|
|
4209
|
+
type PersonalServerModel = components["schemas"]["PersonalServerModel"];
|
|
4210
|
+
type ErrorResponse = components["schemas"]["ErrorResponse"];
|
|
4211
|
+
type ValidationErrorResponse = components["schemas"]["ValidationErrorResponse"];
|
|
4212
|
+
type AuthenticationErrorResponse = components["schemas"]["AuthenticationErrorResponse"];
|
|
4213
|
+
type NotFoundErrorResponse = components["schemas"]["NotFoundErrorResponse"];
|
|
4214
|
+
type BlockchainErrorResponse = components["schemas"]["BlockchainErrorResponse"];
|
|
4215
|
+
type FileAccessErrorResponse = components["schemas"]["FileAccessErrorResponse"];
|
|
4216
|
+
type ComputeErrorResponse = components["schemas"]["ComputeErrorResponse"];
|
|
4217
|
+
type DecryptionErrorResponse = components["schemas"]["DecryptionErrorResponse"];
|
|
4218
|
+
type GrantValidationErrorResponse = components["schemas"]["GrantValidationErrorResponse"];
|
|
4219
|
+
type OperationErrorResponse = components["schemas"]["OperationErrorResponse"];
|
|
4220
|
+
type InternalServerErrorResponse = components["schemas"]["InternalServerErrorResponse"];
|
|
3844
4221
|
|
|
3845
4222
|
/**
|
|
3846
4223
|
* Types for external API responses used by the Vana SDK
|
|
@@ -3893,43 +4270,6 @@ interface ReplicateAPIResponse {
|
|
|
3893
4270
|
total_time?: number;
|
|
3894
4271
|
};
|
|
3895
4272
|
}
|
|
3896
|
-
/**
|
|
3897
|
-
* Identity Server Output Types
|
|
3898
|
-
* These define the expected structure of output from Vana's identity server
|
|
3899
|
-
*/
|
|
3900
|
-
/** Output from the identity server model */
|
|
3901
|
-
interface IdentityServerOutput {
|
|
3902
|
-
/** User's EVM address */
|
|
3903
|
-
user_address: string;
|
|
3904
|
-
/** Personal server information */
|
|
3905
|
-
personal_server: {
|
|
3906
|
-
/** Derived address for the personal server */
|
|
3907
|
-
address: string;
|
|
3908
|
-
/** Public key for encryption */
|
|
3909
|
-
public_key: string;
|
|
3910
|
-
};
|
|
3911
|
-
}
|
|
3912
|
-
/** Identity server response with typed output */
|
|
3913
|
-
interface IdentityServerResponse extends Omit<ReplicateAPIResponse, "output"> {
|
|
3914
|
-
/** Parsed identity server output */
|
|
3915
|
-
output?: IdentityServerOutput | string;
|
|
3916
|
-
}
|
|
3917
|
-
/**
|
|
3918
|
-
* Personal Server Output Types
|
|
3919
|
-
* These define the expected structure of output from Vana's personal server
|
|
3920
|
-
*/
|
|
3921
|
-
/** Output from the personal server model */
|
|
3922
|
-
interface PersonalServerOutput {
|
|
3923
|
-
/** User's EVM address */
|
|
3924
|
-
user_address: string;
|
|
3925
|
-
/** Identity information */
|
|
3926
|
-
identity: {
|
|
3927
|
-
/** Additional metadata */
|
|
3928
|
-
metadata?: Record<string, unknown>;
|
|
3929
|
-
/** Derived address (alternative location) */
|
|
3930
|
-
derivedAddress?: string;
|
|
3931
|
-
};
|
|
3932
|
-
}
|
|
3933
4273
|
/**
|
|
3934
4274
|
* Storage Provider API Types
|
|
3935
4275
|
*/
|
|
@@ -4002,38 +4342,6 @@ interface APIResponse<T = unknown> {
|
|
|
4002
4342
|
* ```
|
|
4003
4343
|
*/
|
|
4004
4344
|
declare function isReplicateAPIResponse(value: unknown): value is ReplicateAPIResponse;
|
|
4005
|
-
/**
|
|
4006
|
-
* Validates whether a value is a valid IdentityServerOutput.
|
|
4007
|
-
*
|
|
4008
|
-
* @param value - The value to check
|
|
4009
|
-
* @returns True if the value matches the IdentityServerOutput structure
|
|
4010
|
-
* @example
|
|
4011
|
-
* ```typescript
|
|
4012
|
-
* const output = response.output;
|
|
4013
|
-
*
|
|
4014
|
-
* if (isIdentityServerOutput(output)) {
|
|
4015
|
-
* console.log('User address:', output.user_address);
|
|
4016
|
-
* console.log('Server address:', output.personal_server.address);
|
|
4017
|
-
* }
|
|
4018
|
-
* ```
|
|
4019
|
-
*/
|
|
4020
|
-
declare function isIdentityServerOutput(value: unknown): value is IdentityServerOutput;
|
|
4021
|
-
/**
|
|
4022
|
-
* Validates whether a value is a valid PersonalServerOutput.
|
|
4023
|
-
*
|
|
4024
|
-
* @param value - The value to check
|
|
4025
|
-
* @returns True if the value matches the PersonalServerOutput structure
|
|
4026
|
-
* @example
|
|
4027
|
-
* ```typescript
|
|
4028
|
-
* const output = response.output;
|
|
4029
|
-
*
|
|
4030
|
-
* if (isPersonalServerOutput(output)) {
|
|
4031
|
-
* console.log('User address:', output.user_address);
|
|
4032
|
-
* console.log('Identity metadata:', output.identity.metadata);
|
|
4033
|
-
* }
|
|
4034
|
-
* ```
|
|
4035
|
-
*/
|
|
4036
|
-
declare function isPersonalServerOutput(value: unknown): value is PersonalServerOutput;
|
|
4037
4345
|
/**
|
|
4038
4346
|
* Validates whether a value is a valid APIResponse.
|
|
4039
4347
|
*
|
|
@@ -4066,7 +4374,7 @@ declare function isAPIResponse<T>(value: unknown): value is APIResponse<T>;
|
|
|
4066
4374
|
* @example
|
|
4067
4375
|
* ```typescript
|
|
4068
4376
|
* const jsonStr = '{"user_address": "0x123...", "identity": {}}';
|
|
4069
|
-
* const result = safeParseJSON(jsonStr,
|
|
4377
|
+
* const result = safeParseJSON(jsonStr, isAPIResponse);
|
|
4070
4378
|
*
|
|
4071
4379
|
* if (result) {
|
|
4072
4380
|
* console.log('Parsed server output:', result.user_address);
|
|
@@ -4085,7 +4393,7 @@ declare function safeParseJSON<T>(jsonString: string, typeGuard: (value: unknown
|
|
|
4085
4393
|
* @example
|
|
4086
4394
|
* ```typescript
|
|
4087
4395
|
* const response = await replicateClient.get(predictionId);
|
|
4088
|
-
* const output = parseReplicateOutput(response,
|
|
4396
|
+
* const output = parseReplicateOutput(response, isReplicateAPIResponse);
|
|
4089
4397
|
*
|
|
4090
4398
|
* if (output) {
|
|
4091
4399
|
* console.log('Identity server result:', output.user_address);
|
|
@@ -5095,7 +5403,7 @@ interface UserFile {
|
|
|
5095
5403
|
*/
|
|
5096
5404
|
interface GrantPermissionParams {
|
|
5097
5405
|
/** The on-chain identity of the application */
|
|
5098
|
-
|
|
5406
|
+
grantee: Address;
|
|
5099
5407
|
/** The class of computation, e.g., "llm_inference" */
|
|
5100
5408
|
operation: string;
|
|
5101
5409
|
/** Array of file IDs to grant permission for */
|
|
@@ -5158,6 +5466,9 @@ declare class DataController {
|
|
|
5158
5466
|
* - Grants permissions to specified applications
|
|
5159
5467
|
* - Registers the file on the blockchain
|
|
5160
5468
|
*
|
|
5469
|
+
* When using permissions with encryption enabled (default), you must provide the public key
|
|
5470
|
+
* for each permission recipient.
|
|
5471
|
+
*
|
|
5161
5472
|
* @param params - Upload parameters including content, filename, schema, and permissions
|
|
5162
5473
|
* @returns Promise resolving to upload results with file ID and transaction hash
|
|
5163
5474
|
* @throws {Error} When wallet is not connected or storage is not configured
|
|
@@ -5178,19 +5489,98 @@ declare class DataController {
|
|
|
5178
5489
|
* schemaId: 1
|
|
5179
5490
|
* });
|
|
5180
5491
|
*
|
|
5181
|
-
* // Upload with permissions
|
|
5492
|
+
* // Upload with permissions (encrypted - requires publicKey)
|
|
5182
5493
|
* const result = await vana.data.upload({
|
|
5183
5494
|
* content: "Data for AI analysis",
|
|
5184
5495
|
* filename: "analysis.txt",
|
|
5185
5496
|
* permissions: [{
|
|
5186
|
-
*
|
|
5497
|
+
* grantee: "0x1234...",
|
|
5187
5498
|
* operation: "llm_inference",
|
|
5188
|
-
* parameters: { model: "gpt-4" }
|
|
5499
|
+
* parameters: { model: "gpt-4" },
|
|
5500
|
+
* publicKey: "0x04..." // Required when encrypt is true (default)
|
|
5501
|
+
* }]
|
|
5502
|
+
* });
|
|
5503
|
+
*
|
|
5504
|
+
* // Upload without encryption
|
|
5505
|
+
* const result = await vana.data.upload({
|
|
5506
|
+
* content: "Public data",
|
|
5507
|
+
* filename: "public.txt",
|
|
5508
|
+
* encrypt: false,
|
|
5509
|
+
* permissions: [{
|
|
5510
|
+
* grantee: "0x1234...",
|
|
5511
|
+
* operation: "read",
|
|
5512
|
+
* parameters: {}
|
|
5513
|
+
* }]
|
|
5514
|
+
* });
|
|
5515
|
+
*
|
|
5516
|
+
* // Upload on behalf of another user (delegation)
|
|
5517
|
+
* const result = await vana.data.upload({
|
|
5518
|
+
* content: "User's data",
|
|
5519
|
+
* filename: "delegated.txt",
|
|
5520
|
+
* owner: "0x5678...", // Different from connected wallet
|
|
5521
|
+
* permissions: [{
|
|
5522
|
+
* grantee: "0x1234...",
|
|
5523
|
+
* operation: "process",
|
|
5524
|
+
* parameters: { type: "analysis" },
|
|
5525
|
+
* publicKey: "0x04..."
|
|
5189
5526
|
* }]
|
|
5190
5527
|
* });
|
|
5191
5528
|
* ```
|
|
5192
5529
|
*/
|
|
5530
|
+
upload(params: EncryptedUploadParams): Promise<UploadResult>;
|
|
5531
|
+
upload(params: UnencryptedUploadParams): Promise<UploadResult>;
|
|
5193
5532
|
upload(params: UploadParams): Promise<UploadResult>;
|
|
5533
|
+
/**
|
|
5534
|
+
* Decrypts a file owned by the user using their wallet signature.
|
|
5535
|
+
*
|
|
5536
|
+
* @remarks
|
|
5537
|
+
* This is the high-level convenience method for decrypting user files, serving as the
|
|
5538
|
+
* symmetrical counterpart to the `upload` method. It handles the complete decryption
|
|
5539
|
+
* workflow including key generation, URL protocol detection, content fetching, and
|
|
5540
|
+
* decryption.
|
|
5541
|
+
*
|
|
5542
|
+
* The method automatically:
|
|
5543
|
+
* - Generates the decryption key from the user's wallet signature
|
|
5544
|
+
* - Determines the appropriate fetch method based on the file URL protocol
|
|
5545
|
+
* - Fetches the encrypted content from IPFS or standard HTTP URLs
|
|
5546
|
+
* - Decrypts the content using the generated key
|
|
5547
|
+
*
|
|
5548
|
+
* For IPFS URLs, the method uses gateway fallback for improved reliability. For
|
|
5549
|
+
* standard HTTP URLs, it uses a simple fetch. If you need custom authentication
|
|
5550
|
+
* headers or specific gateway configurations, use the low-level primitives directly.
|
|
5551
|
+
*
|
|
5552
|
+
* @param file - The user file to decrypt (typically from getUserFiles)
|
|
5553
|
+
* @param encryptionSeed - Optional custom encryption seed (defaults to Vana standard)
|
|
5554
|
+
* @returns Promise resolving to the decrypted file content as a Blob
|
|
5555
|
+
* @throws {Error} When the wallet is not connected
|
|
5556
|
+
* @throws {Error} When fetching the encrypted content fails
|
|
5557
|
+
* @throws {Error} When decryption fails (wrong key or corrupted data)
|
|
5558
|
+
* @example
|
|
5559
|
+
* ```typescript
|
|
5560
|
+
* // Basic file decryption
|
|
5561
|
+
* const files = await vana.data.getUserFiles({ owner: userAddress });
|
|
5562
|
+
* const decryptedBlob = await vana.data.decryptFile(files[0]);
|
|
5563
|
+
*
|
|
5564
|
+
* // Convert to text
|
|
5565
|
+
* const text = await decryptedBlob.text();
|
|
5566
|
+
* console.log('Decrypted content:', text);
|
|
5567
|
+
*
|
|
5568
|
+
* // Convert to JSON
|
|
5569
|
+
* const json = JSON.parse(await decryptedBlob.text());
|
|
5570
|
+
* console.log('Decrypted data:', json);
|
|
5571
|
+
*
|
|
5572
|
+
* // With custom encryption seed
|
|
5573
|
+
* const decryptedBlob = await vana.data.decryptFile(
|
|
5574
|
+
* files[0],
|
|
5575
|
+
* "My custom encryption seed"
|
|
5576
|
+
* );
|
|
5577
|
+
*
|
|
5578
|
+
* // Save to file (in Node.js)
|
|
5579
|
+
* const buffer = await decryptedBlob.arrayBuffer();
|
|
5580
|
+
* fs.writeFileSync('decrypted-file.txt', Buffer.from(buffer));
|
|
5581
|
+
* ```
|
|
5582
|
+
*/
|
|
5583
|
+
decryptFile(file: UserFile$1, encryptionSeed?: string): Promise<Blob>;
|
|
5194
5584
|
/**
|
|
5195
5585
|
* Retrieves all data files owned by a specific user address.
|
|
5196
5586
|
*
|
|
@@ -5377,19 +5767,6 @@ declare class DataController {
|
|
|
5377
5767
|
* 3. Returning the assigned file ID and storage URL
|
|
5378
5768
|
*/
|
|
5379
5769
|
uploadEncryptedFileWithSchema(encryptedFile: Blob, schemaId: number, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
|
|
5380
|
-
/**
|
|
5381
|
-
* Decrypts a file that was encrypted using the Vana protocol.
|
|
5382
|
-
*
|
|
5383
|
-
* @param file - The UserFile object containing the file URL and metadata
|
|
5384
|
-
* @param encryptionSeed - Optional custom encryption seed (defaults to Vana standard)
|
|
5385
|
-
* @returns Promise resolving to the decrypted file as a Blob
|
|
5386
|
-
*
|
|
5387
|
-
* This method handles the complete flow of:
|
|
5388
|
-
* 1. Generating the encryption key from the user's wallet signature
|
|
5389
|
-
* 2. Fetching the encrypted file from the stored URL
|
|
5390
|
-
* 3. Decrypting the file using the canonical Vana decryption method
|
|
5391
|
-
*/
|
|
5392
|
-
decryptFile(file: UserFile$1, encryptionSeed?: string): Promise<Blob>;
|
|
5393
5770
|
/**
|
|
5394
5771
|
* Registers a file URL directly on the blockchain with a schema ID.
|
|
5395
5772
|
*
|
|
@@ -5404,13 +5781,6 @@ declare class DataController {
|
|
|
5404
5781
|
fileId: number;
|
|
5405
5782
|
transactionHash: Address;
|
|
5406
5783
|
}>;
|
|
5407
|
-
/**
|
|
5408
|
-
* Converts IPFS and Google Drive URLs to direct download URLs for fetching.
|
|
5409
|
-
*
|
|
5410
|
-
* @param url - The URL to convert to a direct download URL
|
|
5411
|
-
* @returns The converted direct download URL or the original URL if not a special URL
|
|
5412
|
-
*/
|
|
5413
|
-
private convertToDownloadUrl;
|
|
5414
5784
|
/**
|
|
5415
5785
|
* Gets the user's address from the wallet client.
|
|
5416
5786
|
*
|
|
@@ -5565,6 +5935,73 @@ declare class DataController {
|
|
|
5565
5935
|
* @returns Promise resolving to the decrypted file data
|
|
5566
5936
|
*/
|
|
5567
5937
|
decryptFileWithPermission(file: UserFile$1, privateKey: string, account?: Address): Promise<Blob>;
|
|
5938
|
+
/**
|
|
5939
|
+
* Simple network-agnostic fetch utility for retrieving file content.
|
|
5940
|
+
*
|
|
5941
|
+
* @remarks
|
|
5942
|
+
* This is a thin wrapper around the global fetch API that returns the response as a Blob.
|
|
5943
|
+
* It provides a consistent interface for fetching encrypted content before decryption.
|
|
5944
|
+
* For IPFS URLs, consider using fetchFromIPFS for better reliability.
|
|
5945
|
+
*
|
|
5946
|
+
* @param url - The URL to fetch content from
|
|
5947
|
+
* @returns Promise resolving to the fetched content as a Blob
|
|
5948
|
+
* @throws {Error} When the fetch fails or returns a non-ok response
|
|
5949
|
+
*
|
|
5950
|
+
* @example
|
|
5951
|
+
* ```typescript
|
|
5952
|
+
* // Fetch and decrypt a file
|
|
5953
|
+
* const encryptionKey = await generateEncryptionKey(walletClient);
|
|
5954
|
+
* const encryptedBlob = await vana.data.fetch(file.url);
|
|
5955
|
+
* const decryptedBlob = await decryptBlob(encryptedBlob, encryptionKey, platform);
|
|
5956
|
+
*
|
|
5957
|
+
* // With custom headers for authentication
|
|
5958
|
+
* const response = await fetch(file.url, {
|
|
5959
|
+
* headers: { 'Authorization': 'Bearer token' }
|
|
5960
|
+
* });
|
|
5961
|
+
* const encryptedBlob = await response.blob();
|
|
5962
|
+
* ```
|
|
5963
|
+
*/
|
|
5964
|
+
fetch(url: string): Promise<Blob>;
|
|
5965
|
+
/**
|
|
5966
|
+
* Specialized IPFS fetcher with gateway fallback mechanism.
|
|
5967
|
+
*
|
|
5968
|
+
* @remarks
|
|
5969
|
+
* This method provides robust IPFS content fetching by trying multiple gateways
|
|
5970
|
+
* in sequence until one succeeds. It supports both ipfs:// URLs and raw CIDs.
|
|
5971
|
+
*
|
|
5972
|
+
* The default gateway list includes public gateways, but you should provide
|
|
5973
|
+
* your own gateways for production use to ensure reliability and privacy.
|
|
5974
|
+
*
|
|
5975
|
+
* @param url - The IPFS URL (ipfs://...) or CID to fetch
|
|
5976
|
+
* @param options - Optional configuration
|
|
5977
|
+
* @param options.gateways - Array of IPFS gateway URLs to try (must end with /)
|
|
5978
|
+
* @returns Promise resolving to the fetched content as a Blob
|
|
5979
|
+
* @throws {Error} When all gateways fail to fetch the content
|
|
5980
|
+
*
|
|
5981
|
+
* @example
|
|
5982
|
+
* ```typescript
|
|
5983
|
+
* // Fetch from IPFS with custom gateways
|
|
5984
|
+
* const encryptedBlob = await vana.data.fetchFromIPFS(file.url, {
|
|
5985
|
+
* gateways: [
|
|
5986
|
+
* 'https://my-private-gateway.com/ipfs/',
|
|
5987
|
+
* 'https://dweb.link/ipfs/',
|
|
5988
|
+
* 'https://ipfs.io/ipfs/'
|
|
5989
|
+
* ]
|
|
5990
|
+
* });
|
|
5991
|
+
*
|
|
5992
|
+
* // Decrypt the fetched content
|
|
5993
|
+
* const encryptionKey = await generateEncryptionKey(walletClient);
|
|
5994
|
+
* const decryptedBlob = await decryptBlob(encryptedBlob, encryptionKey, platform);
|
|
5995
|
+
*
|
|
5996
|
+
* // With raw CID
|
|
5997
|
+
* const blob = await vana.data.fetchFromIPFS('QmXxx...', {
|
|
5998
|
+
* gateways: ['https://ipfs.io/ipfs/']
|
|
5999
|
+
* });
|
|
6000
|
+
* ```
|
|
6001
|
+
*/
|
|
6002
|
+
fetchFromIPFS(url: string, options?: {
|
|
6003
|
+
gateways?: string[];
|
|
6004
|
+
}): Promise<Blob>;
|
|
5568
6005
|
/**
|
|
5569
6006
|
* Validates a data schema against the Vana meta-schema.
|
|
5570
6007
|
*
|
|
@@ -30753,6 +31190,45 @@ declare class ProtocolController {
|
|
|
30753
31190
|
getChainName(): string;
|
|
30754
31191
|
}
|
|
30755
31192
|
|
|
31193
|
+
/**
|
|
31194
|
+
* Factory functions for creating VanaCore instances with proper type safety
|
|
31195
|
+
*/
|
|
31196
|
+
declare class VanaCoreFactory {
|
|
31197
|
+
/**
|
|
31198
|
+
* Creates a VanaCore instance that enforces storage requirements at compile time.
|
|
31199
|
+
* Use this factory when you know you'll need storage-dependent operations.
|
|
31200
|
+
*
|
|
31201
|
+
* @param platform - The platform adapter for environment-specific operations
|
|
31202
|
+
* @param config - Configuration that includes required storage providers
|
|
31203
|
+
* @returns VanaCore instance with storage validation
|
|
31204
|
+
* @example
|
|
31205
|
+
* ```typescript
|
|
31206
|
+
* const vanaCore = VanaCoreFactory.createWithStorage(platformAdapter, {
|
|
31207
|
+
* walletClient: myWalletClient,
|
|
31208
|
+
* storage: {
|
|
31209
|
+
* providers: { ipfs: new IPFSStorage() },
|
|
31210
|
+
* defaultProvider: 'ipfs'
|
|
31211
|
+
* }
|
|
31212
|
+
* });
|
|
31213
|
+
* ```
|
|
31214
|
+
*/
|
|
31215
|
+
static createWithStorage(platform: VanaPlatformAdapter, config: VanaConfigWithStorage): VanaCore & StorageRequiredMarker;
|
|
31216
|
+
/**
|
|
31217
|
+
* Creates a VanaCore instance without storage requirements.
|
|
31218
|
+
* Storage-dependent operations will fail at runtime if not configured.
|
|
31219
|
+
*
|
|
31220
|
+
* @param platform - The platform adapter for environment-specific operations
|
|
31221
|
+
* @param config - Basic configuration without required storage
|
|
31222
|
+
* @returns VanaCore instance
|
|
31223
|
+
* @example
|
|
31224
|
+
* ```typescript
|
|
31225
|
+
* const vanaCore = VanaCoreFactory.create(platformAdapter, {
|
|
31226
|
+
* walletClient: myWalletClient
|
|
31227
|
+
* });
|
|
31228
|
+
* ```
|
|
31229
|
+
*/
|
|
31230
|
+
static create(platform: VanaPlatformAdapter, config: VanaConfig): VanaCore;
|
|
31231
|
+
}
|
|
30756
31232
|
/**
|
|
30757
31233
|
* Provides the core SDK functionality for interacting with the Vana network.
|
|
30758
31234
|
*
|
|
@@ -30761,8 +31237,11 @@ declare class ProtocolController {
|
|
|
30761
31237
|
* adapter to handle environment-specific operations. It initializes all controllers
|
|
30762
31238
|
* and manages shared context between them.
|
|
30763
31239
|
*
|
|
31240
|
+
* The class uses TypeScript overloading to enforce storage requirements at compile time.
|
|
31241
|
+
* When storage is required for certain operations, the constructor will fail fast at runtime.
|
|
31242
|
+
*
|
|
30764
31243
|
* For public usage, use the platform-specific Vana classes that extend this core:
|
|
30765
|
-
* - Use `
|
|
31244
|
+
* - Use `Vana({config)` from the main package import
|
|
30766
31245
|
* @example
|
|
30767
31246
|
* ```typescript
|
|
30768
31247
|
* // Direct instantiation (typically used internally)
|
|
@@ -30787,12 +31266,18 @@ declare class VanaCore {
|
|
|
30787
31266
|
protected platform: VanaPlatformAdapter;
|
|
30788
31267
|
private readonly relayerCallbacks?;
|
|
30789
31268
|
private readonly storageManager?;
|
|
31269
|
+
private readonly hasRequiredStorage;
|
|
31270
|
+
private readonly ipfsGateways?;
|
|
30790
31271
|
/**
|
|
30791
31272
|
* Initializes a new VanaCore client instance with the provided configuration.
|
|
30792
31273
|
*
|
|
30793
31274
|
* @remarks
|
|
30794
31275
|
* The constructor validates the configuration, initializes storage providers if configured,
|
|
30795
31276
|
* creates wallet and public clients, and sets up all SDK controllers with shared context.
|
|
31277
|
+
*
|
|
31278
|
+
* IMPORTANT: This constructor will validate storage requirements at runtime to fail fast.
|
|
31279
|
+
* Methods that require storage will throw runtime errors if storage is not configured.
|
|
31280
|
+
*
|
|
30796
31281
|
* @param platform - The platform adapter for environment-specific operations
|
|
30797
31282
|
* @param config - The configuration object specifying wallet or chain settings
|
|
30798
31283
|
* @throws {InvalidConfigurationError} When the configuration is invalid or incomplete
|
|
@@ -30805,6 +31290,48 @@ declare class VanaCore {
|
|
|
30805
31290
|
* ```
|
|
30806
31291
|
*/
|
|
30807
31292
|
constructor(platform: VanaPlatformAdapter, config: VanaConfig);
|
|
31293
|
+
/**
|
|
31294
|
+
* Validates that storage is available for storage-dependent operations.
|
|
31295
|
+
* This method enforces the fail-fast principle by checking storage availability
|
|
31296
|
+
* at method call time rather than during expensive operations.
|
|
31297
|
+
*
|
|
31298
|
+
* @throws {InvalidConfigurationError} When storage is required but not configured
|
|
31299
|
+
* @example
|
|
31300
|
+
* ```typescript
|
|
31301
|
+
* // This will throw if storage is not configured
|
|
31302
|
+
* vana.validateStorageRequired();
|
|
31303
|
+
* await vana.data.uploadFile(file); // Safe to proceed
|
|
31304
|
+
* ```
|
|
31305
|
+
*/
|
|
31306
|
+
validateStorageRequired(): void;
|
|
31307
|
+
/**
|
|
31308
|
+
* Checks whether storage is configured without throwing an error.
|
|
31309
|
+
*
|
|
31310
|
+
* @returns True if storage is properly configured
|
|
31311
|
+
* @example
|
|
31312
|
+
* ```typescript
|
|
31313
|
+
* if (vana.hasStorage()) {
|
|
31314
|
+
* await vana.data.uploadFile(file);
|
|
31315
|
+
* } else {
|
|
31316
|
+
* console.warn('Storage not configured - using pre-stored URLs only');
|
|
31317
|
+
* }
|
|
31318
|
+
* ```
|
|
31319
|
+
*/
|
|
31320
|
+
hasStorage(): boolean;
|
|
31321
|
+
/**
|
|
31322
|
+
* Type guard to check if this instance has storage enabled at compile time.
|
|
31323
|
+
* Use this when you need TypeScript to understand that storage is available.
|
|
31324
|
+
*
|
|
31325
|
+
* @returns True if storage is configured, with type narrowing
|
|
31326
|
+
* @example
|
|
31327
|
+
* ```typescript
|
|
31328
|
+
* if (vana.isStorageEnabled()) {
|
|
31329
|
+
* // TypeScript knows storage is available here
|
|
31330
|
+
* await vana.data.uploadFile(file);
|
|
31331
|
+
* }
|
|
31332
|
+
* ```
|
|
31333
|
+
*/
|
|
31334
|
+
isStorageEnabled(): this is VanaCore & StorageRequiredMarker;
|
|
30808
31335
|
/**
|
|
30809
31336
|
* Validates the provided configuration object against all requirements.
|
|
30810
31337
|
*
|
|
@@ -30892,21 +31419,21 @@ declare class VanaCore {
|
|
|
30892
31419
|
*/
|
|
30893
31420
|
getPlatformAdapter(): VanaPlatformAdapter;
|
|
30894
31421
|
/**
|
|
30895
|
-
* Encrypts
|
|
31422
|
+
* Encrypts data using the Vana protocol standard encryption.
|
|
30896
31423
|
* This method automatically uses the correct platform adapter for the current environment.
|
|
30897
31424
|
*
|
|
30898
31425
|
* @param data The data to encrypt (string or Blob)
|
|
30899
|
-
* @param
|
|
31426
|
+
* @param key The key to use as encryption key
|
|
30900
31427
|
* @returns The encrypted data as Blob
|
|
30901
31428
|
* @example
|
|
30902
31429
|
* ```typescript
|
|
30903
31430
|
* const encryptionKey = await generateEncryptionKey(walletClient);
|
|
30904
|
-
* const encrypted = await vana.
|
|
31431
|
+
* const encrypted = await vana.encryptBlob("sensitive data", encryptionKey);
|
|
30905
31432
|
* ```
|
|
30906
31433
|
*/
|
|
30907
|
-
|
|
31434
|
+
encryptBlob(data: string | Blob, key: string): Promise<Blob>;
|
|
30908
31435
|
/**
|
|
30909
|
-
* Decrypts
|
|
31436
|
+
* Decrypts data that was encrypted using the Vana protocol.
|
|
30910
31437
|
* This method automatically uses the correct platform adapter for the current environment.
|
|
30911
31438
|
*
|
|
30912
31439
|
* @param encryptedData The encrypted data (string or Blob)
|
|
@@ -30915,11 +31442,11 @@ declare class VanaCore {
|
|
|
30915
31442
|
* @example
|
|
30916
31443
|
* ```typescript
|
|
30917
31444
|
* const encryptionKey = await generateEncryptionKey(walletClient);
|
|
30918
|
-
* const decrypted = await vana.
|
|
31445
|
+
* const decrypted = await vana.decryptBlob(encryptedData, encryptionKey);
|
|
30919
31446
|
* const text = await decrypted.text();
|
|
30920
31447
|
* ```
|
|
30921
31448
|
*/
|
|
30922
|
-
|
|
31449
|
+
decryptBlob(encryptedData: string | Blob, walletSignature: string): Promise<Blob>;
|
|
30923
31450
|
}
|
|
30924
31451
|
|
|
30925
31452
|
/**
|
|
@@ -31120,23 +31647,44 @@ declare function getEncryptionParameters(platformAdapter: VanaPlatformAdapter):
|
|
|
31120
31647
|
*/
|
|
31121
31648
|
declare function decryptWithPrivateKey(encryptedData: string, privateKey: string, platformAdapter: VanaPlatformAdapter): Promise<string>;
|
|
31122
31649
|
/**
|
|
31123
|
-
*
|
|
31650
|
+
* Encrypts data using a signed key generated from the user's wallet signature.
|
|
31651
|
+
*
|
|
31652
|
+
* @remarks
|
|
31653
|
+
* This is a pure cryptographic primitive that encrypts data using the Vana protocol's
|
|
31654
|
+
* standard encryption method. The key parameter must be a signature generated by the
|
|
31655
|
+
* `generateEncryptionKey` utility - this ensures deterministic key generation from the
|
|
31656
|
+
* user's wallet, enabling the same key to be regenerated for decryption.
|
|
31657
|
+
*
|
|
31658
|
+
* This function uses password-based encryption with the signature as the password,
|
|
31659
|
+
* providing symmetric encryption that can be decrypted with the same signature.
|
|
31124
31660
|
*
|
|
31125
31661
|
* @param data The data to encrypt (string or Blob)
|
|
31126
|
-
* @param
|
|
31127
|
-
* @param platformAdapter
|
|
31662
|
+
* @param key The signed key from `generateEncryptionKey` - MUST be a wallet signature
|
|
31663
|
+
* @param platformAdapter The platform adapter for crypto operations
|
|
31128
31664
|
* @returns The encrypted data as Blob
|
|
31129
|
-
|
|
31130
|
-
declare function encryptUserData(data: string | Blob, walletSignature: string, platformAdapter: VanaPlatformAdapter): Promise<Blob>;
|
|
31131
|
-
/**
|
|
31132
|
-
* Decrypt user data using PGP with platform-appropriate configuration
|
|
31665
|
+
* @throws {Error} When encryption fails
|
|
31133
31666
|
*
|
|
31134
|
-
* @
|
|
31135
|
-
*
|
|
31136
|
-
*
|
|
31137
|
-
*
|
|
31667
|
+
* @example
|
|
31668
|
+
* ```typescript
|
|
31669
|
+
* // Generate the encryption key from wallet signature
|
|
31670
|
+
* const encryptionKey = await generateEncryptionKey(walletClient);
|
|
31671
|
+
*
|
|
31672
|
+
* // Encrypt data with the signed key
|
|
31673
|
+
* const encryptedBlob = await encryptBlobWithSignedKey(
|
|
31674
|
+
* "My sensitive data",
|
|
31675
|
+
* encryptionKey,
|
|
31676
|
+
* platformAdapter
|
|
31677
|
+
* );
|
|
31678
|
+
*
|
|
31679
|
+
* // Later, decrypt with the same key
|
|
31680
|
+
* const decryptedBlob = await decryptBlobWithSignedKey(
|
|
31681
|
+
* encryptedBlob,
|
|
31682
|
+
* encryptionKey,
|
|
31683
|
+
* platformAdapter
|
|
31684
|
+
* );
|
|
31685
|
+
* ```
|
|
31138
31686
|
*/
|
|
31139
|
-
declare function
|
|
31687
|
+
declare function encryptBlobWithSignedKey(data: string | Blob, key: string, platformAdapter: VanaPlatformAdapter): Promise<Blob>;
|
|
31140
31688
|
/**
|
|
31141
31689
|
* Generate a new key pair for asymmetric encryption
|
|
31142
31690
|
*
|
|
@@ -31165,6 +31713,55 @@ declare function generatePGPKeyPair(platformAdapter: VanaPlatformAdapter, option
|
|
|
31165
31713
|
publicKey: string;
|
|
31166
31714
|
privateKey: string;
|
|
31167
31715
|
}>;
|
|
31716
|
+
/**
|
|
31717
|
+
* Decrypts data using a signed key generated from the user's wallet signature.
|
|
31718
|
+
*
|
|
31719
|
+
* @remarks
|
|
31720
|
+
* This is a pure cryptographic primitive for decrypting data that was encrypted using
|
|
31721
|
+
* `encryptBlobWithSignedKey`. It is network-agnostic and only handles decryption - it does
|
|
31722
|
+
* not fetch data from any URL or make network requests. To decrypt a file from a URL, you
|
|
31723
|
+
* must first fetch the encrypted blob using one of the fetch utilities, then pass it to
|
|
31724
|
+
* this function.
|
|
31725
|
+
*
|
|
31726
|
+
* The key parameter must be the same signature that was used for encryption, typically
|
|
31727
|
+
* generated by the `generateEncryptionKey` utility. This ensures that only the user who
|
|
31728
|
+
* encrypted the data (or someone with the same wallet signature) can decrypt it.
|
|
31729
|
+
*
|
|
31730
|
+
* @param encryptedData The encrypted data to decrypt (string or Blob)
|
|
31731
|
+
* @param key The signed key from `generateEncryptionKey` - MUST be the same wallet signature used for encryption
|
|
31732
|
+
* @param platformAdapter The platform adapter for crypto operations
|
|
31733
|
+
* @returns Promise resolving to the decrypted blob
|
|
31734
|
+
* @throws {Error} When decryption fails due to wrong key or corrupted data
|
|
31735
|
+
*
|
|
31736
|
+
* @example
|
|
31737
|
+
* ```typescript
|
|
31738
|
+
* // Generate the same encryption key used for encryption
|
|
31739
|
+
* const encryptionKey = await generateEncryptionKey(walletClient);
|
|
31740
|
+
*
|
|
31741
|
+
* // Fetch and decrypt using the high-level API
|
|
31742
|
+
* const file = await vana.data.getUserFiles({ owner: "0x..." })[0];
|
|
31743
|
+
* const decryptedBlob = await vana.data.decryptFile(file);
|
|
31744
|
+
*
|
|
31745
|
+
* // Or use the low-level primitives directly
|
|
31746
|
+
* const encryptedBlob = await vana.data.fetch(file.url);
|
|
31747
|
+
* const decryptedBlob = await decryptBlobWithSignedKey(
|
|
31748
|
+
* encryptedBlob,
|
|
31749
|
+
* encryptionKey,
|
|
31750
|
+
* platformAdapter
|
|
31751
|
+
* );
|
|
31752
|
+
*
|
|
31753
|
+
* // With IPFS gateway fallback
|
|
31754
|
+
* const encryptedBlob = await vana.data.fetchFromIPFS(file.url, {
|
|
31755
|
+
* gateways: ['https://my-gateway.com/ipfs/', 'https://ipfs.io/ipfs/']
|
|
31756
|
+
* });
|
|
31757
|
+
* const decryptedBlob = await decryptBlobWithSignedKey(
|
|
31758
|
+
* encryptedBlob,
|
|
31759
|
+
* encryptionKey,
|
|
31760
|
+
* platformAdapter
|
|
31761
|
+
* );
|
|
31762
|
+
* ```
|
|
31763
|
+
*/
|
|
31764
|
+
declare function decryptBlobWithSignedKey(encryptedData: string | Blob, key: string, platformAdapter: VanaPlatformAdapter): Promise<Blob>;
|
|
31168
31765
|
|
|
31169
31766
|
/**
|
|
31170
31767
|
* Format a bigint or BigNumber to a regular number
|
|
@@ -31214,11 +31811,42 @@ declare function createGrantFile(params: GrantPermissionParams$1): GrantFile;
|
|
|
31214
31811
|
*/
|
|
31215
31812
|
declare function storeGrantFile(grantFile: GrantFile, relayerUrl: string): Promise<string>;
|
|
31216
31813
|
/**
|
|
31217
|
-
* Retrieves
|
|
31814
|
+
* Retrieves detailed grant file data from IPFS or HTTP storage.
|
|
31815
|
+
*
|
|
31816
|
+
* @remarks
|
|
31817
|
+
* **This is Step 2 of the performant two-step permission API.**
|
|
31818
|
+
*
|
|
31819
|
+
* Use this method to resolve detailed permission data (operation, parameters, etc.)
|
|
31820
|
+
* for specific grants after first getting the fast on-chain data using
|
|
31821
|
+
* `getUserPermissionGrantsOnChain()`. This design eliminates N+1 query problems
|
|
31822
|
+
* by allowing selective lazy-loading of expensive off-chain data.
|
|
31823
|
+
*
|
|
31824
|
+
* **Performance**: Single network request per grant file (typically 100-500ms).
|
|
31825
|
+
* **Reliability**: Tries multiple IPFS gateways as fallbacks if primary URL fails.
|
|
31218
31826
|
*
|
|
31219
|
-
* @param grantUrl - The grant file URL
|
|
31220
|
-
* @param _relayerUrl - URL of the relayer service (optional)
|
|
31221
|
-
* @returns Promise resolving to the grant file
|
|
31827
|
+
* @param grantUrl - The grant file URL from OnChainPermissionGrant.grantUrl
|
|
31828
|
+
* @param _relayerUrl - URL of the relayer service (optional, unused)
|
|
31829
|
+
* @returns Promise resolving to the complete grant file with operation details
|
|
31830
|
+
* @throws {NetworkError} When all retrieval attempts fail
|
|
31831
|
+
* @throws {SerializationError} When grant file format is invalid
|
|
31832
|
+
* @example
|
|
31833
|
+
* ```typescript
|
|
31834
|
+
* // Step 1: Fast on-chain data (no N+1 queries)
|
|
31835
|
+
* const grants = await vana.permissions.getUserPermissionGrantsOnChain();
|
|
31836
|
+
*
|
|
31837
|
+
* // Step 2: Lazy-load details for specific grant when needed
|
|
31838
|
+
* const grantFile = await retrieveGrantFile(grants[0].grantUrl);
|
|
31839
|
+
*
|
|
31840
|
+
* console.log(`Operation: ${grantFile.operation}`);
|
|
31841
|
+
* console.log(`Grantee: ${grantFile.grantee}`);
|
|
31842
|
+
* console.log(`Parameters:`, grantFile.parameters);
|
|
31843
|
+
*
|
|
31844
|
+
* // Only fetch details for grants user actually wants to see
|
|
31845
|
+
* for (const grant of selectedGrants) {
|
|
31846
|
+
* const details = await retrieveGrantFile(grant.grantUrl);
|
|
31847
|
+
* displayGrantDetails(details);
|
|
31848
|
+
* }
|
|
31849
|
+
* ```
|
|
31222
31850
|
*/
|
|
31223
31851
|
declare function retrieveGrantFile(grantUrl: string, _relayerUrl?: string): Promise<GrantFile>;
|
|
31224
31852
|
/**
|
|
@@ -31773,7 +32401,7 @@ interface RelayerRequestPayload {
|
|
|
31773
32401
|
* }
|
|
31774
32402
|
* ```
|
|
31775
32403
|
*/
|
|
31776
|
-
declare function handleRelayerRequest(sdk:
|
|
32404
|
+
declare function handleRelayerRequest(sdk: VanaInstance, payload: RelayerRequestPayload): Promise<Hash>;
|
|
31777
32405
|
|
|
31778
32406
|
/**
|
|
31779
32407
|
* Node.js implementation of the Vana Platform Adapter
|
|
@@ -32051,39 +32679,48 @@ declare class ApiClient {
|
|
|
32051
32679
|
}
|
|
32052
32680
|
|
|
32053
32681
|
/**
|
|
32054
|
-
*
|
|
32055
|
-
*
|
|
32682
|
+
* Internal implementation class for Node.js environments.
|
|
32683
|
+
* This class is not exported directly - use the Vana factory function instead.
|
|
32684
|
+
*/
|
|
32685
|
+
declare class VanaNodeImpl extends VanaCore {
|
|
32686
|
+
constructor(config: VanaConfig);
|
|
32687
|
+
}
|
|
32688
|
+
/**
|
|
32689
|
+
* Creates a new Vana SDK instance configured for Node.js environments.
|
|
32056
32690
|
*
|
|
32691
|
+
* This function automatically provides the correct TypeScript types based on your configuration:
|
|
32692
|
+
* - With storage config: All methods including storage-dependent ones are available
|
|
32693
|
+
* - Without storage: Storage-dependent methods are not available at compile time
|
|
32694
|
+
*
|
|
32695
|
+
* @param config - The configuration object containing wallet client and optional storage settings
|
|
32696
|
+
* @returns A Vana SDK instance configured for Node.js use
|
|
32057
32697
|
* @example
|
|
32058
32698
|
* ```typescript
|
|
32059
|
-
*
|
|
32699
|
+
* // With storage - all methods available
|
|
32700
|
+
* const vana = Vana({
|
|
32701
|
+
* walletClient,
|
|
32702
|
+
* storage: { providers: { ipfs: new IPFSStorage() }, defaultProvider: 'ipfs' }
|
|
32703
|
+
* });
|
|
32704
|
+
* await vana.data.uploadFile(file); // ✅ Works - TypeScript knows storage is available
|
|
32060
32705
|
*
|
|
32061
|
-
* //
|
|
32062
|
-
* const
|
|
32706
|
+
* // Without storage - storage methods unavailable at compile time
|
|
32707
|
+
* const vanaNoStorage = Vana({ walletClient });
|
|
32708
|
+
* // await vanaNoStorage.data.uploadFile(file); // ❌ TypeScript error
|
|
32063
32709
|
*
|
|
32064
|
-
* //
|
|
32065
|
-
*
|
|
32066
|
-
*
|
|
32067
|
-
*
|
|
32068
|
-
*
|
|
32069
|
-
* });
|
|
32710
|
+
* // Runtime check still available
|
|
32711
|
+
* if (vanaNoStorage.isStorageEnabled()) {
|
|
32712
|
+
* // TypeScript now knows storage methods are safe to use
|
|
32713
|
+
* await vanaNoStorage.data.uploadFile(file); // ✅ Works
|
|
32714
|
+
* }
|
|
32070
32715
|
* ```
|
|
32071
32716
|
*/
|
|
32072
|
-
declare
|
|
32073
|
-
|
|
32074
|
-
|
|
32075
|
-
|
|
32076
|
-
|
|
32077
|
-
|
|
32078
|
-
|
|
32079
|
-
|
|
32080
|
-
* const vana = new Vana({ walletClient });
|
|
32081
|
-
*
|
|
32082
|
-
* // With chain configuration
|
|
32083
|
-
* const vana = new Vana({ chainId: 14800, account });
|
|
32084
|
-
* ```
|
|
32085
|
-
*/
|
|
32086
|
-
constructor(config: VanaConfig);
|
|
32087
|
-
}
|
|
32717
|
+
declare function Vana(config: VanaConfigWithStorage): VanaNodeImpl & StorageRequiredMarker;
|
|
32718
|
+
declare function Vana(config: VanaConfig): VanaNodeImpl;
|
|
32719
|
+
/**
|
|
32720
|
+
* The type of a Vana SDK instance in Node.js environments.
|
|
32721
|
+
*
|
|
32722
|
+
* @see {@link Vana}
|
|
32723
|
+
*/
|
|
32724
|
+
type VanaInstance = VanaNodeImpl;
|
|
32088
32725
|
|
|
32089
|
-
export { type $defs, type APIResponse, type AddRefinerParams, type AddRefinerResult, type AddSchemaParams, type AddSchemaResult, type AllKeys, ApiClient, type ApiClientConfig, type ApiResponse, AsyncQueue, type AsyncResult, type Awaited, type BaseConfig, BaseController, type BatchServerInfoResult, type BatchUploadParams, type BatchUploadResult, type BlockRange, BlockchainError, type Brand, BrowserPlatformAdapter, type Cache, type CacheConfig, type ChainConfig, type CheckPermissionParams, CircuitBreaker, 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 CreateOperationResponse, type CreateSchemaParams, type CreateSchemaResult, DEFAULT_ENCRYPTION_SEED, DEFAULT_IPFS_GATEWAY, DataController, type DataSchema, type DeepPartial, type DeepReadonly, type DeleteFileParams, type DeleteFileResult, type DownloadFileParams, type DownloadFileResult, type EncryptionInfo, EventEmitter, type EventFilter, type EventLog, type Factory, type FileAccessPermissions, type FileMetadata, type FileSharingConfig, type GasEstimate, type GenericRequest, type GenericResponse, type GenericTypedData, type GetFileParams, type GetOperationResponse, type GetUserFilesParams, type GetUserTrustedServersParams, type GetUserTrustedServersResult, GoogleDriveStorage, GrantExpiredError, type GrantFile, type GrantPermissionParams, GrantSchemaError, GrantValidationError, type GrantValidationOptions, type GrantValidationResult, type GrantedPermission, GranteeMismatchError, type HttpMethod, IPFS_GATEWAYS, type
|
|
32726
|
+
export { type $defs, type APIResponse, 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 EncryptedPermissionParams, type EncryptedUploadParams, type EncryptionInfo, type ErrorResponse, EventEmitter, type EventFilter, type EventLog, type Factory, type FileAccessErrorResponse, type FileAccessPermissions, type FileMetadata, type FileSharingConfig, type GasEstimate, type GenericRequest, type GenericResponse, type GenericTypedData, type GetFileParams, type GetOperationResponse, type GetUserFilesParams, type GetUserPermissionsOptions, type GetUserTrustedServersParams, type GetUserTrustedServersResult, GoogleDriveStorage, GrantExpiredError, type GrantFile, type GrantPermissionParams, GrantSchemaError, GrantValidationError, type GrantValidationErrorResponse, type GrantValidationOptions, type GrantValidationResult, type GrantedPermission, GranteeMismatchError, type HttpMethod, IPFS_GATEWAYS, type IdentityResponseModel, type InitPersonalServerParams, type InternalServerErrorResponse, InvalidConfigurationError, IpfsStorage, type MaybeArray, type MaybePromise, MemoryCache, type Middleware, MiddlewarePipeline, NetworkError, type NetworkInfo, NodePlatformAdapter, type Nominal, type NonNullable, NonceError, type NotFoundErrorResponse, type Observable, type Observer, type OmitByType, type OnChainPermissionGrant, type OperationErrorResponse, OperationNotAllowedError, type OptionalKeys, type PaginatedTrustedServers, type PaginationParams, type PaginationResult, type PartialExcept, type PermissionAnalytics, type PermissionCheckResult, PermissionError, type PermissionEvent, type PermissionGrantDomain, type PermissionGrantMessage, type PermissionGrantTypedData, type PermissionInfo, type PermissionInputMessage, type PermissionOperation, type PermissionParams, 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 RelayerCallbacks, type RelayerConfig, RelayerError, type RelayerErrorResponse, type RelayerMetrics, type RelayerQueueInfo, type RelayerRequestOptions, type RelayerRequestPayload, 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, SchemaController, SchemaValidationError, SchemaValidator, SerializationError, type Server, type components as ServerComponents, ServerController, type $defs as ServerDefs, type operations as ServerOperations, type paths as ServerPaths, type ServerTrustStatus, ServerUrlMismatchError, type webhooks as ServerWebhooks, type Service, 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 TrustedServerQueryMode, 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, 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, VanaNodeImpl, type VanaPlatformAdapter, type WalletConfig, type WalletConfigWithStorage, __contractCache, chains, checkGrantAccess, clearContractCache, type components, convertIpfsUrl, convertIpfsUrlWithFallbacks, createAndStoreGrant, createBrowserPlatformAdapter, createGrantFile, createNodePlatformAdapter, createPlatformAdapter, createPlatformAdapterFor, 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, handleRelayerRequest, 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, validateDataSchema, validateGrant, validateGrantExpiry, validateGrantFile, validateGranteeAccess, validateOperationAccess, vanaMainnet, type webhooks };
|