@opendatalabs/vana-sdk 0.1.0-alpha.f0290d0 → 0.1.0-alpha.ffe4659
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/dist/browser-DY8XDblx.d.ts +241 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +309 -0
- package/dist/browser.js.map +1 -0
- 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 +889 -286
- package/dist/index.browser.js +2187 -1246
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +2259 -1325
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.cts +923 -293
- package/dist/index.node.d.ts +923 -293
- package/dist/index.node.js +2235 -1302
- package/dist/index.node.js.map +1 -1
- package/dist/node-D9-F9uEP.d.cts +238 -0
- package/dist/node-D9-F9uEP.d.ts +238 -0
- package/dist/node.cjs +348 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +1 -0
- package/dist/node.d.ts +1 -0
- package/dist/node.js +311 -0
- package/dist/node.js.map +1 -0
- package/dist/platform.browser.d.ts +3 -236
- package/dist/platform.browser.js +31 -8
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.cjs +72 -62
- package/dist/platform.cjs.map +1 -1
- package/dist/platform.d.cts +2 -1
- package/dist/platform.d.ts +2 -1
- package/dist/platform.js +72 -62
- package/dist/platform.js.map +1 -1
- package/dist/platform.node.cjs +72 -62
- package/dist/platform.node.cjs.map +1 -1
- package/dist/platform.node.d.cts +7 -236
- package/dist/platform.node.d.ts +7 -236
- package/dist/platform.node.js +72 -62
- package/dist/platform.node.js.map +1 -1
- package/package.json +17 -12
package/dist/index.browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Chain, Address, Hash, WalletClient, Account, Abi, GetContractReturnType, PublicClient } from 'viem';
|
|
1
|
+
import { Chain, Address, Hash, WalletClient, Account, Abi, GetContractReturnType, TransactionReceipt as TransactionReceipt$1, PublicClient } from 'viem';
|
|
2
2
|
export { Abi, Account, Address, Chain, GetContractReturnType, Hash, PublicClient, WalletClient } from 'viem';
|
|
3
3
|
import { Abi as Abi$1 } from 'abitype';
|
|
4
4
|
|
|
@@ -157,6 +157,14 @@ declare class StorageError extends Error {
|
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Base interface for types that need to be compatible with Record<string, unknown>
|
|
162
|
+
*
|
|
163
|
+
* @category Permissions
|
|
164
|
+
*/
|
|
165
|
+
interface RecordCompatible {
|
|
166
|
+
[key: string]: unknown;
|
|
167
|
+
}
|
|
160
168
|
/**
|
|
161
169
|
* Represents on-chain permission grant data without expensive off-chain resolution.
|
|
162
170
|
*
|
|
@@ -355,7 +363,7 @@ interface PermissionGrantMessage {
|
|
|
355
363
|
*
|
|
356
364
|
* @category Permissions
|
|
357
365
|
*/
|
|
358
|
-
interface PermissionInputMessage {
|
|
366
|
+
interface PermissionInputMessage extends RecordCompatible {
|
|
359
367
|
/** Nonce */
|
|
360
368
|
nonce: bigint;
|
|
361
369
|
/** Grantee ID */
|
|
@@ -370,7 +378,7 @@ interface PermissionInputMessage {
|
|
|
370
378
|
*
|
|
371
379
|
* @category Permissions
|
|
372
380
|
*/
|
|
373
|
-
interface RevokePermissionInput {
|
|
381
|
+
interface RevokePermissionInput extends RecordCompatible {
|
|
374
382
|
/** Nonce */
|
|
375
383
|
nonce: bigint;
|
|
376
384
|
/** Permission ID to revoke */
|
|
@@ -451,9 +459,7 @@ interface GrantFile {
|
|
|
451
459
|
*
|
|
452
460
|
* @category Permissions
|
|
453
461
|
*/
|
|
454
|
-
interface PermissionGrantTypedData {
|
|
455
|
-
/** EIP-712 domain */
|
|
456
|
-
domain: PermissionGrantDomain;
|
|
462
|
+
interface PermissionGrantTypedData extends GenericTypedData {
|
|
457
463
|
/** EIP-712 types */
|
|
458
464
|
types: {
|
|
459
465
|
Permission: Array<{
|
|
@@ -471,7 +477,7 @@ interface PermissionGrantTypedData {
|
|
|
471
477
|
*
|
|
472
478
|
* @category Permissions
|
|
473
479
|
*/
|
|
474
|
-
interface GenericTypedData {
|
|
480
|
+
interface GenericTypedData extends RecordCompatible {
|
|
475
481
|
/** EIP-712 domain */
|
|
476
482
|
domain: PermissionGrantDomain;
|
|
477
483
|
/** EIP-712 types */
|
|
@@ -665,7 +671,7 @@ interface UntrustServerParams {
|
|
|
665
671
|
*
|
|
666
672
|
* @category Permissions
|
|
667
673
|
*/
|
|
668
|
-
interface AddAndTrustServerInput {
|
|
674
|
+
interface AddAndTrustServerInput extends RecordCompatible {
|
|
669
675
|
/** User nonce */
|
|
670
676
|
nonce: bigint;
|
|
671
677
|
/** Server address */
|
|
@@ -681,7 +687,7 @@ interface AddAndTrustServerInput {
|
|
|
681
687
|
* @category Permissions
|
|
682
688
|
* @deprecated Use AddAndTrustServerInput instead
|
|
683
689
|
*/
|
|
684
|
-
interface TrustServerInput {
|
|
690
|
+
interface TrustServerInput extends RecordCompatible {
|
|
685
691
|
/** User nonce */
|
|
686
692
|
nonce: bigint;
|
|
687
693
|
/** Server ID (numeric) */
|
|
@@ -692,7 +698,7 @@ interface TrustServerInput {
|
|
|
692
698
|
*
|
|
693
699
|
* @category Permissions
|
|
694
700
|
*/
|
|
695
|
-
interface UntrustServerInput {
|
|
701
|
+
interface UntrustServerInput extends RecordCompatible {
|
|
696
702
|
/** User nonce */
|
|
697
703
|
nonce: bigint;
|
|
698
704
|
/** Server ID (numeric) */
|
|
@@ -703,9 +709,7 @@ interface UntrustServerInput {
|
|
|
703
709
|
*
|
|
704
710
|
* @category Permissions
|
|
705
711
|
*/
|
|
706
|
-
interface AddAndTrustServerTypedData {
|
|
707
|
-
/** EIP-712 domain */
|
|
708
|
-
domain: PermissionGrantDomain;
|
|
712
|
+
interface AddAndTrustServerTypedData extends GenericTypedData {
|
|
709
713
|
/** EIP-712 types */
|
|
710
714
|
types: {
|
|
711
715
|
AddServer: Array<{
|
|
@@ -724,9 +728,7 @@ interface AddAndTrustServerTypedData {
|
|
|
724
728
|
* @category Permissions
|
|
725
729
|
* @deprecated Use AddAndTrustServerTypedData instead
|
|
726
730
|
*/
|
|
727
|
-
interface TrustServerTypedData {
|
|
728
|
-
/** EIP-712 domain */
|
|
729
|
-
domain: PermissionGrantDomain;
|
|
731
|
+
interface TrustServerTypedData extends GenericTypedData {
|
|
730
732
|
/** EIP-712 types */
|
|
731
733
|
types: {
|
|
732
734
|
TrustServer: Array<{
|
|
@@ -744,9 +746,7 @@ interface TrustServerTypedData {
|
|
|
744
746
|
*
|
|
745
747
|
* @category Permissions
|
|
746
748
|
*/
|
|
747
|
-
interface UntrustServerTypedData {
|
|
748
|
-
/** EIP-712 domain */
|
|
749
|
-
domain: PermissionGrantDomain;
|
|
749
|
+
interface UntrustServerTypedData extends GenericTypedData {
|
|
750
750
|
/** EIP-712 types */
|
|
751
751
|
types: {
|
|
752
752
|
UntrustServer: Array<{
|
|
@@ -903,7 +903,7 @@ interface RegisterGranteeParams {
|
|
|
903
903
|
*
|
|
904
904
|
* @category Permissions
|
|
905
905
|
*/
|
|
906
|
-
interface RegisterGranteeInput extends
|
|
906
|
+
interface RegisterGranteeInput extends RecordCompatible {
|
|
907
907
|
/** User nonce */
|
|
908
908
|
nonce: bigint;
|
|
909
909
|
/** Grantee owner address */
|
|
@@ -918,9 +918,7 @@ interface RegisterGranteeInput extends Record<string, unknown> {
|
|
|
918
918
|
*
|
|
919
919
|
* @category Permissions
|
|
920
920
|
*/
|
|
921
|
-
interface RegisterGranteeTypedData {
|
|
922
|
-
/** EIP-712 domain */
|
|
923
|
-
domain: PermissionGrantDomain;
|
|
921
|
+
interface RegisterGranteeTypedData extends GenericTypedData {
|
|
924
922
|
/** EIP-712 types */
|
|
925
923
|
types: {
|
|
926
924
|
RegisterGrantee: Array<{
|
|
@@ -1139,6 +1137,22 @@ interface RelayerCallbacks {
|
|
|
1139
1137
|
* @returns Promise resolving to the transaction hash
|
|
1140
1138
|
*/
|
|
1141
1139
|
submitAddAndTrustServer?: (typedData: AddAndTrustServerTypedData, signature: Hash) => Promise<Hash>;
|
|
1140
|
+
/**
|
|
1141
|
+
* Submit a signed permission addition transaction for relay
|
|
1142
|
+
*
|
|
1143
|
+
* @param typedData - The EIP-712 typed data that was signed
|
|
1144
|
+
* @param signature - The user's signature
|
|
1145
|
+
* @returns Promise resolving to the transaction hash
|
|
1146
|
+
*/
|
|
1147
|
+
submitAddPermission?: (typedData: GenericTypedData, signature: Hash) => Promise<Hash>;
|
|
1148
|
+
/**
|
|
1149
|
+
* Submit a signed server files and permissions transaction for relay
|
|
1150
|
+
*
|
|
1151
|
+
* @param typedData - The EIP-712 typed data that was signed
|
|
1152
|
+
* @param signature - The user's signature
|
|
1153
|
+
* @returns Promise resolving to the transaction hash
|
|
1154
|
+
*/
|
|
1155
|
+
submitAddServerFilesAndPermissions?: (typedData: ServerFilesAndPermissionTypedData, signature: Hash) => Promise<Hash>;
|
|
1142
1156
|
/**
|
|
1143
1157
|
* Submit a file addition for relay
|
|
1144
1158
|
*
|
|
@@ -2168,8 +2182,8 @@ interface Schema {
|
|
|
2168
2182
|
id: number;
|
|
2169
2183
|
/** Schema name */
|
|
2170
2184
|
name: string;
|
|
2171
|
-
/** Schema
|
|
2172
|
-
|
|
2185
|
+
/** Schema dialect */
|
|
2186
|
+
dialect: string;
|
|
2173
2187
|
/** URL containing the schema definition */
|
|
2174
2188
|
definitionUrl: string;
|
|
2175
2189
|
}
|
|
@@ -2200,8 +2214,8 @@ interface Refiner {
|
|
|
2200
2214
|
interface AddSchemaParams {
|
|
2201
2215
|
/** Schema name */
|
|
2202
2216
|
name: string;
|
|
2203
|
-
/** Schema
|
|
2204
|
-
|
|
2217
|
+
/** Schema dialect */
|
|
2218
|
+
dialect: string;
|
|
2205
2219
|
/** URL containing the schema definition */
|
|
2206
2220
|
definitionUrl: string;
|
|
2207
2221
|
}
|
|
@@ -2276,13 +2290,7 @@ interface UpdateSchemaIdResult {
|
|
|
2276
2290
|
transactionHash: Hash;
|
|
2277
2291
|
}
|
|
2278
2292
|
/**
|
|
2279
|
-
*
|
|
2280
|
-
*
|
|
2281
|
-
* @category Data Management
|
|
2282
|
-
*/
|
|
2283
|
-
type TrustedServerQueryMode = "subgraph" | "rpc" | "auto";
|
|
2284
|
-
/**
|
|
2285
|
-
* Trusted server data structure (unified format for both subgraph and RPC modes)
|
|
2293
|
+
* Trusted server data structure
|
|
2286
2294
|
*
|
|
2287
2295
|
* @category Data Management
|
|
2288
2296
|
*/
|
|
@@ -2301,39 +2309,20 @@ interface TrustedServer {
|
|
|
2301
2309
|
trustIndex?: number;
|
|
2302
2310
|
}
|
|
2303
2311
|
/**
|
|
2304
|
-
* Parameters for getUserTrustedServers
|
|
2312
|
+
* Parameters for getUserTrustedServers method
|
|
2305
2313
|
*
|
|
2306
2314
|
* @category Data Management
|
|
2307
2315
|
*/
|
|
2308
2316
|
interface GetUserTrustedServersParams {
|
|
2309
|
-
/** User address to query */
|
|
2317
|
+
/** User address to query trusted servers for */
|
|
2310
2318
|
user: Address;
|
|
2311
|
-
/**
|
|
2312
|
-
mode?: TrustedServerQueryMode;
|
|
2313
|
-
/** Subgraph URL (required for subgraph mode) */
|
|
2319
|
+
/** Optional subgraph URL to override default */
|
|
2314
2320
|
subgraphUrl?: string;
|
|
2315
|
-
/**
|
|
2321
|
+
/** Maximum number of results */
|
|
2316
2322
|
limit?: number;
|
|
2317
|
-
/**
|
|
2323
|
+
/** Number of results to skip */
|
|
2318
2324
|
offset?: number;
|
|
2319
2325
|
}
|
|
2320
|
-
/**
|
|
2321
|
-
* Result of getUserTrustedServers query
|
|
2322
|
-
*
|
|
2323
|
-
* @category Data Management
|
|
2324
|
-
*/
|
|
2325
|
-
interface GetUserTrustedServersResult {
|
|
2326
|
-
/** Array of trusted servers */
|
|
2327
|
-
servers: TrustedServer[];
|
|
2328
|
-
/** Query mode that was actually used */
|
|
2329
|
-
usedMode: TrustedServerQueryMode;
|
|
2330
|
-
/** Total count (only available in RPC mode) */
|
|
2331
|
-
total?: number;
|
|
2332
|
-
/** Whether there are more servers (pagination info for RPC mode) */
|
|
2333
|
-
hasMore?: boolean;
|
|
2334
|
-
/** Any warnings or fallback information */
|
|
2335
|
-
warnings?: string[];
|
|
2336
|
-
}
|
|
2337
2326
|
|
|
2338
2327
|
declare const contractAbis: {
|
|
2339
2328
|
readonly DataPortabilityPermissions: readonly [{
|
|
@@ -28721,6 +28710,95 @@ type VanaContract = keyof ContractAbis;
|
|
|
28721
28710
|
*/
|
|
28722
28711
|
declare function getAbi<T extends VanaContract>(contract: T): ContractAbis[T];
|
|
28723
28712
|
|
|
28713
|
+
/**
|
|
28714
|
+
* Comprehensive mapping of SDK transaction operations to blockchain events.
|
|
28715
|
+
* Used by the generic transaction parser to know which contract and event
|
|
28716
|
+
* to look for when parsing transaction results.
|
|
28717
|
+
*/
|
|
28718
|
+
declare const EVENT_MAPPINGS: {
|
|
28719
|
+
readonly grant: {
|
|
28720
|
+
readonly contract: "DataPortabilityPermissions";
|
|
28721
|
+
readonly event: "PermissionAdded";
|
|
28722
|
+
};
|
|
28723
|
+
readonly revoke: {
|
|
28724
|
+
readonly contract: "DataPortabilityPermissions";
|
|
28725
|
+
readonly event: "PermissionRevoked";
|
|
28726
|
+
};
|
|
28727
|
+
readonly revokePermission: {
|
|
28728
|
+
readonly contract: "DataPortabilityPermissions";
|
|
28729
|
+
readonly event: "PermissionRevoked";
|
|
28730
|
+
};
|
|
28731
|
+
readonly addServerFilesAndPermissions: {
|
|
28732
|
+
readonly contract: "DataPortabilityPermissions";
|
|
28733
|
+
readonly event: "PermissionAdded";
|
|
28734
|
+
};
|
|
28735
|
+
readonly trustServer: {
|
|
28736
|
+
readonly contract: "DataPortabilityServers";
|
|
28737
|
+
readonly event: "ServerTrusted";
|
|
28738
|
+
};
|
|
28739
|
+
readonly untrustServer: {
|
|
28740
|
+
readonly contract: "DataPortabilityServers";
|
|
28741
|
+
readonly event: "ServerUntrusted";
|
|
28742
|
+
};
|
|
28743
|
+
readonly registerServer: {
|
|
28744
|
+
readonly contract: "DataPortabilityServers";
|
|
28745
|
+
readonly event: "ServerRegistered";
|
|
28746
|
+
};
|
|
28747
|
+
readonly updateServer: {
|
|
28748
|
+
readonly contract: "DataPortabilityServers";
|
|
28749
|
+
readonly event: "ServerUpdated";
|
|
28750
|
+
};
|
|
28751
|
+
readonly addAndTrustServer: {
|
|
28752
|
+
readonly contract: "DataPortabilityServers";
|
|
28753
|
+
readonly event: "ServerTrusted";
|
|
28754
|
+
};
|
|
28755
|
+
readonly addFile: {
|
|
28756
|
+
readonly contract: "DataRegistry";
|
|
28757
|
+
readonly event: "FileAdded";
|
|
28758
|
+
};
|
|
28759
|
+
readonly addFileWithPermissionsAndSchema: {
|
|
28760
|
+
readonly contract: "DataRegistry";
|
|
28761
|
+
readonly event: "FileAdded";
|
|
28762
|
+
};
|
|
28763
|
+
readonly addFileWithSchema: {
|
|
28764
|
+
readonly contract: "DataRegistry";
|
|
28765
|
+
readonly event: "FileAdded";
|
|
28766
|
+
};
|
|
28767
|
+
readonly addFileWithPermissions: {
|
|
28768
|
+
readonly contract: "DataRegistry";
|
|
28769
|
+
readonly event: "FileAdded";
|
|
28770
|
+
};
|
|
28771
|
+
readonly addRefinement: {
|
|
28772
|
+
readonly contract: "DataRegistry";
|
|
28773
|
+
readonly event: "RefinementAdded";
|
|
28774
|
+
};
|
|
28775
|
+
readonly addRefiner: {
|
|
28776
|
+
readonly contract: "DataRefinerRegistry";
|
|
28777
|
+
readonly event: "RefinerAdded";
|
|
28778
|
+
};
|
|
28779
|
+
readonly updateSchemaId: {
|
|
28780
|
+
readonly contract: "DataRefinerRegistry";
|
|
28781
|
+
readonly event: "SchemaAdded";
|
|
28782
|
+
};
|
|
28783
|
+
readonly addSchema: {
|
|
28784
|
+
readonly contract: "DataRefinerRegistry";
|
|
28785
|
+
readonly event: "SchemaAdded";
|
|
28786
|
+
};
|
|
28787
|
+
readonly updateRefinement: {
|
|
28788
|
+
readonly contract: "DataRegistry";
|
|
28789
|
+
readonly event: "RefinementUpdated";
|
|
28790
|
+
};
|
|
28791
|
+
readonly addFilePermission: {
|
|
28792
|
+
readonly contract: "DataRegistry";
|
|
28793
|
+
readonly event: "PermissionGranted";
|
|
28794
|
+
};
|
|
28795
|
+
readonly registerGrantee: {
|
|
28796
|
+
readonly contract: "DataPortabilityGrantees";
|
|
28797
|
+
readonly event: "GranteeRegistered";
|
|
28798
|
+
};
|
|
28799
|
+
};
|
|
28800
|
+
type TransactionOperation = keyof typeof EVENT_MAPPINGS;
|
|
28801
|
+
|
|
28724
28802
|
/**
|
|
28725
28803
|
* Base interface for all transaction results.
|
|
28726
28804
|
* Contains the event data plus transaction metadata.
|
|
@@ -28758,6 +28836,50 @@ interface PermissionRevokeResult extends BaseTransactionResult {
|
|
|
28758
28836
|
/** ID of the permission that was revoked */
|
|
28759
28837
|
permissionId: bigint;
|
|
28760
28838
|
}
|
|
28839
|
+
/**
|
|
28840
|
+
* Result of a successful server trust operation.
|
|
28841
|
+
* Contains data from the ServerTrusted blockchain event.
|
|
28842
|
+
*/
|
|
28843
|
+
interface ServerTrustResult extends BaseTransactionResult {
|
|
28844
|
+
/** Address of the user who trusted the server */
|
|
28845
|
+
user: Address;
|
|
28846
|
+
/** Address/ID of the trusted server */
|
|
28847
|
+
serverId: Address;
|
|
28848
|
+
/** URL of the trusted server */
|
|
28849
|
+
serverUrl: string;
|
|
28850
|
+
}
|
|
28851
|
+
/**
|
|
28852
|
+
* Result of a successful server untrust operation.
|
|
28853
|
+
* Contains data from the ServerUntrusted blockchain event.
|
|
28854
|
+
*/
|
|
28855
|
+
interface ServerUntrustResult extends BaseTransactionResult {
|
|
28856
|
+
/** Address of the user who untrusted the server */
|
|
28857
|
+
user: Address;
|
|
28858
|
+
/** Address/ID of the untrusted server */
|
|
28859
|
+
serverId: Address;
|
|
28860
|
+
}
|
|
28861
|
+
/**
|
|
28862
|
+
* Result of a successful server update operation.
|
|
28863
|
+
* Contains data from the ServerUpdated blockchain event.
|
|
28864
|
+
*/
|
|
28865
|
+
interface ServerUpdateResult extends BaseTransactionResult {
|
|
28866
|
+
/** ID of the server that was updated */
|
|
28867
|
+
serverId: bigint;
|
|
28868
|
+
/** New URL of the server */
|
|
28869
|
+
url: string;
|
|
28870
|
+
}
|
|
28871
|
+
/**
|
|
28872
|
+
* Result of a successful grantee registration operation.
|
|
28873
|
+
* Contains data from the GranteeRegistered blockchain event.
|
|
28874
|
+
*/
|
|
28875
|
+
interface GranteeRegisterResult extends BaseTransactionResult {
|
|
28876
|
+
/** Unique grantee ID assigned by the registry */
|
|
28877
|
+
granteeId: bigint;
|
|
28878
|
+
/** Address of the registered grantee */
|
|
28879
|
+
granteeAddress: Address;
|
|
28880
|
+
/** Display name of the grantee */
|
|
28881
|
+
name: string;
|
|
28882
|
+
}
|
|
28761
28883
|
/**
|
|
28762
28884
|
* Result of a successful file permission addition operation.
|
|
28763
28885
|
* Contains data from the FilePermissionAdded blockchain event.
|
|
@@ -28771,6 +28893,80 @@ interface FilePermissionResult extends BaseTransactionResult {
|
|
|
28771
28893
|
encryptedKey: string;
|
|
28772
28894
|
}
|
|
28773
28895
|
|
|
28896
|
+
/**
|
|
28897
|
+
* Provides a unified interface for blockchain transaction results with lazy-loaded event parsing.
|
|
28898
|
+
*
|
|
28899
|
+
* @remarks
|
|
28900
|
+
* TransactionHandle enables immediate access to transaction hashes while providing optional
|
|
28901
|
+
* lazy-loaded access to receipts and parsed event data. All transaction-submitting methods
|
|
28902
|
+
* in the SDK return this handle, allowing developers to choose between immediate hash access
|
|
28903
|
+
* or waiting for event data. Results are memoized to prevent redundant network calls.
|
|
28904
|
+
*
|
|
28905
|
+
* @category Transactions
|
|
28906
|
+
* @example
|
|
28907
|
+
* ```typescript
|
|
28908
|
+
* // Immediate hash access
|
|
28909
|
+
* const tx = await sdk.permissions.submitSignedGrant(typedData, signature);
|
|
28910
|
+
* console.log(`Transaction submitted: ${tx.hash}`);
|
|
28911
|
+
*
|
|
28912
|
+
* // Wait for and parse events
|
|
28913
|
+
* const eventData = await tx.waitForEvents();
|
|
28914
|
+
* console.log(`Permission ID: ${eventData.permissionId}`);
|
|
28915
|
+
*
|
|
28916
|
+
* // Check receipt for gas usage
|
|
28917
|
+
* const receipt = await tx.waitForReceipt();
|
|
28918
|
+
* console.log(`Gas used: ${receipt.gasUsed}`);
|
|
28919
|
+
* ```
|
|
28920
|
+
*/
|
|
28921
|
+
declare class TransactionHandle<TEventData = unknown> {
|
|
28922
|
+
private readonly context;
|
|
28923
|
+
readonly hash: Hash;
|
|
28924
|
+
private readonly operation?;
|
|
28925
|
+
private _receipt?;
|
|
28926
|
+
private _eventData?;
|
|
28927
|
+
private _receiptPromise?;
|
|
28928
|
+
private _eventPromise?;
|
|
28929
|
+
constructor(context: ControllerContext$1, hash: Hash, operation?: TransactionOperation | undefined);
|
|
28930
|
+
/**
|
|
28931
|
+
* Waits for transaction confirmation and returns the receipt.
|
|
28932
|
+
* Results are memoized - multiple calls return the same promise.
|
|
28933
|
+
*
|
|
28934
|
+
* @param options Optional timeout configuration
|
|
28935
|
+
* @param options.timeout Timeout in milliseconds (default: 30000)
|
|
28936
|
+
* @returns Transaction receipt with gas usage, logs, and status
|
|
28937
|
+
*/
|
|
28938
|
+
waitForReceipt(options?: {
|
|
28939
|
+
timeout?: number;
|
|
28940
|
+
}): Promise<TransactionReceipt$1>;
|
|
28941
|
+
/**
|
|
28942
|
+
* Waits for transaction confirmation and parses emitted events.
|
|
28943
|
+
* Results are memoized - multiple calls return the same promise.
|
|
28944
|
+
*
|
|
28945
|
+
* @returns Parsed event data with transaction metadata
|
|
28946
|
+
* @throws {Error} If no operation was specified for event parsing
|
|
28947
|
+
*/
|
|
28948
|
+
waitForEvents(): Promise<TEventData>;
|
|
28949
|
+
/**
|
|
28950
|
+
* Enables string coercion for backwards compatibility.
|
|
28951
|
+
* Allows TransactionHandle to be used anywhere a Hash is expected.
|
|
28952
|
+
*
|
|
28953
|
+
* @example
|
|
28954
|
+
* ```typescript
|
|
28955
|
+
* const hash: Hash = tx; // Works via toString()
|
|
28956
|
+
* console.log(`Transaction: ${tx}`); // Prints hash
|
|
28957
|
+
* ```
|
|
28958
|
+
* @returns The transaction hash as a string
|
|
28959
|
+
*/
|
|
28960
|
+
toString(): string;
|
|
28961
|
+
/**
|
|
28962
|
+
* JSON serialization support.
|
|
28963
|
+
* Returns the hash when serialized to JSON.
|
|
28964
|
+
*
|
|
28965
|
+
* @returns The transaction hash for JSON serialization
|
|
28966
|
+
*/
|
|
28967
|
+
toJSON(): string;
|
|
28968
|
+
}
|
|
28969
|
+
|
|
28774
28970
|
/**
|
|
28775
28971
|
* Google Drive Storage Provider for Vana SDK
|
|
28776
28972
|
*
|
|
@@ -29809,30 +30005,31 @@ declare class PermissionsController {
|
|
|
29809
30005
|
*/
|
|
29810
30006
|
grant(params: GrantPermissionParams$1): Promise<PermissionGrantResult>;
|
|
29811
30007
|
/**
|
|
29812
|
-
* Submits a permission grant transaction and returns
|
|
30008
|
+
* Submits a permission grant transaction and returns a handle for flexible result access.
|
|
29813
30009
|
*
|
|
29814
|
-
*
|
|
29815
|
-
*
|
|
29816
|
-
*
|
|
30010
|
+
* @remarks
|
|
30011
|
+
* This lower-level method provides maximum control over transaction timing.
|
|
30012
|
+
* Returns a TransactionHandle that allows immediate hash access or optional event parsing.
|
|
30013
|
+
* Use this when handling multiple transactions or when you need granular control.
|
|
29817
30014
|
*
|
|
29818
30015
|
* @param params - The permission grant configuration object
|
|
29819
|
-
* @returns Promise
|
|
30016
|
+
* @returns Promise resolving to TransactionHandle with hash and event parsing capabilities
|
|
29820
30017
|
* @throws {RelayerError} When gasless transaction submission fails
|
|
29821
30018
|
* @throws {SignatureError} When user rejects the signature request
|
|
29822
30019
|
* @throws {SerializationError} When grant data cannot be serialized
|
|
29823
30020
|
* @throws {BlockchainError} When permission grant preparation fails
|
|
29824
30021
|
* @example
|
|
29825
30022
|
* ```typescript
|
|
29826
|
-
* // Submit transaction and
|
|
29827
|
-
* const
|
|
29828
|
-
* console.log(`Transaction submitted: ${
|
|
30023
|
+
* // Submit transaction and get immediate hash access
|
|
30024
|
+
* const tx = await vana.permissions.submitPermissionGrant(params);
|
|
30025
|
+
* console.log(`Transaction submitted: ${tx.hash}`);
|
|
29829
30026
|
*
|
|
29830
|
-
* //
|
|
29831
|
-
* const
|
|
29832
|
-
* console.log(`Permission ID: ${
|
|
30027
|
+
* // Optionally wait for and parse events
|
|
30028
|
+
* const eventData = await tx.waitForEvents();
|
|
30029
|
+
* console.log(`Permission ID: ${eventData.permissionId}`);
|
|
29833
30030
|
* ```
|
|
29834
30031
|
*/
|
|
29835
|
-
submitPermissionGrant(params: GrantPermissionParams$1): Promise<
|
|
30032
|
+
submitPermissionGrant(params: GrantPermissionParams$1): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
29836
30033
|
/**
|
|
29837
30034
|
* Prepares a permission grant with preview before signing.
|
|
29838
30035
|
*
|
|
@@ -29860,15 +30057,21 @@ declare class PermissionsController {
|
|
|
29860
30057
|
*/
|
|
29861
30058
|
prepareGrant(params: GrantPermissionParams$1): Promise<{
|
|
29862
30059
|
preview: GrantFile;
|
|
29863
|
-
confirm: () => Promise<
|
|
30060
|
+
confirm: () => Promise<TransactionHandle<PermissionGrantResult>>;
|
|
29864
30061
|
}>;
|
|
29865
30062
|
/**
|
|
29866
|
-
*
|
|
29867
|
-
*
|
|
30063
|
+
* Completes the grant process after user confirmation.
|
|
30064
|
+
*
|
|
30065
|
+
* @remarks
|
|
30066
|
+
* This internal method is called by the confirm() function returned from prepareGrant().
|
|
30067
|
+
* It handles IPFS upload, signature creation, and transaction submission.
|
|
29868
30068
|
*
|
|
29869
30069
|
* @param params - The permission grant parameters containing user and operation details
|
|
29870
30070
|
* @param grantFile - The prepared grant file with permissions and metadata
|
|
29871
|
-
* @returns Promise resolving to
|
|
30071
|
+
* @returns Promise resolving to TransactionHandle for flexible result access
|
|
30072
|
+
* @throws {BlockchainError} When permission grant confirmation fails
|
|
30073
|
+
* @throws {NetworkError} When IPFS upload fails
|
|
30074
|
+
* @throws {SignatureError} When user rejects the signature
|
|
29872
30075
|
*/
|
|
29873
30076
|
private confirmGrantInternal;
|
|
29874
30077
|
/**
|
|
@@ -29924,49 +30127,106 @@ declare class PermissionsController {
|
|
|
29924
30127
|
* );
|
|
29925
30128
|
* ```
|
|
29926
30129
|
*/
|
|
29927
|
-
submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<
|
|
30130
|
+
submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
29928
30131
|
/**
|
|
29929
30132
|
* Submits an already-signed trust server transaction to the blockchain.
|
|
30133
|
+
*
|
|
30134
|
+
* @remarks
|
|
29930
30135
|
* This method extracts the trust server input from typed data and submits it directly.
|
|
30136
|
+
* Used internally by trust server methods after signature collection.
|
|
29931
30137
|
*
|
|
29932
30138
|
* @param typedData - The EIP-712 typed data for TrustServer
|
|
29933
|
-
* @param signature - The user's signature
|
|
29934
|
-
* @returns Promise resolving to
|
|
30139
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
30140
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30141
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30142
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
30143
|
+
* @example
|
|
30144
|
+
* ```typescript
|
|
30145
|
+
* const txHandle = await vana.permissions.submitSignedTrustServer(
|
|
30146
|
+
* typedData,
|
|
30147
|
+
* "0x1234..."
|
|
30148
|
+
* );
|
|
30149
|
+
* const result = await txHandle.waitForEvents();
|
|
30150
|
+
* ```
|
|
29935
30151
|
*/
|
|
29936
|
-
submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<
|
|
30152
|
+
submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
|
|
29937
30153
|
/**
|
|
29938
30154
|
* Submits an already-signed add and trust server transaction to the blockchain.
|
|
30155
|
+
*
|
|
30156
|
+
* @remarks
|
|
29939
30157
|
* This method extracts the add and trust server input from typed data and submits it directly.
|
|
30158
|
+
* Combines server registration and trust operations in a single transaction.
|
|
29940
30159
|
*
|
|
29941
30160
|
* @param typedData - The EIP-712 typed data for AddAndTrustServer
|
|
29942
|
-
* @param signature - The user's signature
|
|
29943
|
-
* @returns Promise resolving to
|
|
30161
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
30162
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30163
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30164
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
30165
|
+
* @example
|
|
30166
|
+
* ```typescript
|
|
30167
|
+
* const txHandle = await vana.permissions.submitSignedAddAndTrustServer(
|
|
30168
|
+
* typedData,
|
|
30169
|
+
* "0x1234..."
|
|
30170
|
+
* );
|
|
30171
|
+
* const result = await txHandle.waitForEvents();
|
|
30172
|
+
* ```
|
|
29944
30173
|
*/
|
|
29945
|
-
submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<
|
|
30174
|
+
submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash): Promise<TransactionHandle<ServerTrustResult>>;
|
|
29946
30175
|
/**
|
|
29947
30176
|
* Submits an already-signed permission revoke transaction to the blockchain.
|
|
30177
|
+
*
|
|
30178
|
+
* @remarks
|
|
29948
30179
|
* This method handles the revocation of previously granted permissions.
|
|
30180
|
+
* Used internally by revocation methods after signature collection.
|
|
29949
30181
|
*
|
|
29950
30182
|
* @param typedData - The EIP-712 typed data for PermissionRevoke
|
|
29951
|
-
* @param signature - The user's signature
|
|
29952
|
-
* @returns Promise resolving to
|
|
30183
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
30184
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30185
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30186
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
30187
|
+
* @example
|
|
30188
|
+
* ```typescript
|
|
30189
|
+
* const txHandle = await vana.permissions.submitSignedRevoke(
|
|
30190
|
+
* typedData,
|
|
30191
|
+
* "0x1234..."
|
|
30192
|
+
* );
|
|
30193
|
+
* const result = await txHandle.waitForEvents();
|
|
30194
|
+
* ```
|
|
29953
30195
|
*/
|
|
29954
|
-
submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<
|
|
30196
|
+
submitSignedRevoke(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionRevokeResult>>;
|
|
29955
30197
|
/**
|
|
29956
30198
|
* Submits an already-signed untrust server transaction to the blockchain.
|
|
30199
|
+
*
|
|
30200
|
+
* @remarks
|
|
29957
30201
|
* This method handles the removal of trusted servers.
|
|
30202
|
+
* Used internally by untrust server methods after signature collection.
|
|
29958
30203
|
*
|
|
29959
30204
|
* @param typedData - The EIP-712 typed data for UntrustServer
|
|
29960
|
-
* @param signature - The user's signature
|
|
29961
|
-
* @returns Promise resolving to
|
|
30205
|
+
* @param signature - The user's signature obtained via `signTypedData()`
|
|
30206
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30207
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30208
|
+
* @throws {NetworkError} When blockchain communication fails
|
|
30209
|
+
* @example
|
|
30210
|
+
* ```typescript
|
|
30211
|
+
* const txHandle = await vana.permissions.submitSignedUntrustServer(
|
|
30212
|
+
* typedData,
|
|
30213
|
+
* "0x1234..."
|
|
30214
|
+
* );
|
|
30215
|
+
* const result = await txHandle.waitForEvents();
|
|
30216
|
+
* ```
|
|
29962
30217
|
*/
|
|
29963
|
-
submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<
|
|
30218
|
+
submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<ServerUntrustResult>>;
|
|
29964
30219
|
/**
|
|
29965
30220
|
* Submits a signed transaction directly to the blockchain.
|
|
29966
30221
|
*
|
|
30222
|
+
* @remarks
|
|
30223
|
+
* Internal method used when relayer callbacks are not available. Formats the signature
|
|
30224
|
+
* and submits the permission grant directly to the smart contract.
|
|
30225
|
+
*
|
|
29967
30226
|
* @param typedData - The typed data structure for the permission grant
|
|
29968
30227
|
* @param signature - The cryptographic signature authorizing the transaction
|
|
29969
30228
|
* @returns Promise resolving to the transaction hash
|
|
30229
|
+
* @throws {BlockchainError} When contract submission fails
|
|
29970
30230
|
*/
|
|
29971
30231
|
private submitDirectTransaction;
|
|
29972
30232
|
/**
|
|
@@ -30013,19 +30273,33 @@ declare class PermissionsController {
|
|
|
30013
30273
|
* console.log(`Revocation submitted: ${txHash}`);
|
|
30014
30274
|
* ```
|
|
30015
30275
|
*/
|
|
30016
|
-
submitPermissionRevoke(params: RevokePermissionParams): Promise<
|
|
30276
|
+
submitPermissionRevoke(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
|
|
30017
30277
|
/**
|
|
30018
|
-
* Revokes a permission with a signature
|
|
30278
|
+
* Revokes a permission with a signature for gasless transactions.
|
|
30279
|
+
*
|
|
30280
|
+
* @remarks
|
|
30281
|
+
* This method creates an EIP-712 signature for permission revocation and submits
|
|
30282
|
+
* it either through relayer callbacks or directly to the blockchain. Provides
|
|
30283
|
+
* gasless revocation when relayer is configured.
|
|
30019
30284
|
*
|
|
30020
30285
|
* @param params - Parameters for revoking the permission
|
|
30021
|
-
* @
|
|
30286
|
+
* @param params.permissionId - Permission identifier to revoke (accepts bigint, number, or string)
|
|
30287
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30022
30288
|
* @throws {BlockchainError} When chain ID is not available
|
|
30023
30289
|
* @throws {NonceError} When retrieving user nonce fails
|
|
30024
30290
|
* @throws {SignatureError} When user rejects the signature request
|
|
30025
30291
|
* @throws {RelayerError} When gasless submission fails
|
|
30026
30292
|
* @throws {PermissionError} When revocation fails for any other reason
|
|
30293
|
+
* @example
|
|
30294
|
+
* ```typescript
|
|
30295
|
+
* const txHandle = await vana.permissions.submitRevokeWithSignature({
|
|
30296
|
+
* permissionId: 123n
|
|
30297
|
+
* });
|
|
30298
|
+
* const result = await txHandle.waitForEvents();
|
|
30299
|
+
* console.log(`Permission ${result.permissionId} revoked`);
|
|
30300
|
+
* ```
|
|
30027
30301
|
*/
|
|
30028
|
-
submitRevokeWithSignature(params: RevokePermissionParams): Promise<
|
|
30302
|
+
submitRevokeWithSignature(params: RevokePermissionParams): Promise<TransactionHandle<PermissionRevokeResult>>;
|
|
30029
30303
|
/**
|
|
30030
30304
|
* @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
|
|
30031
30305
|
*
|
|
@@ -30050,6 +30324,18 @@ declare class PermissionsController {
|
|
|
30050
30324
|
* const serversNonce = await this.getServersUserNonce();
|
|
30051
30325
|
* ```
|
|
30052
30326
|
*/
|
|
30327
|
+
/**
|
|
30328
|
+
* @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
|
|
30329
|
+
*
|
|
30330
|
+
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
30331
|
+
*
|
|
30332
|
+
* @remarks
|
|
30333
|
+
* This method is deprecated in favor of more specific nonce methods that target
|
|
30334
|
+
* the appropriate contract for the operation being performed.
|
|
30335
|
+
*
|
|
30336
|
+
* @returns Promise resolving to the user's current nonce as a bigint
|
|
30337
|
+
* @throws {NonceError} When retrieving the nonce fails
|
|
30338
|
+
*/
|
|
30053
30339
|
private getUserNonce;
|
|
30054
30340
|
/**
|
|
30055
30341
|
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
@@ -30065,6 +30351,16 @@ declare class PermissionsController {
|
|
|
30065
30351
|
* console.log(`Current servers nonce: ${nonce}`);
|
|
30066
30352
|
* ```
|
|
30067
30353
|
*/
|
|
30354
|
+
/**
|
|
30355
|
+
* Retrieves the user's current nonce from the DataPortabilityServers contract.
|
|
30356
|
+
*
|
|
30357
|
+
* @remarks
|
|
30358
|
+
* Used for server-related operations (trust/untrust) to prevent replay attacks.
|
|
30359
|
+
* The nonce must be incremented with each server operation.
|
|
30360
|
+
*
|
|
30361
|
+
* @returns Promise resolving to the user's current nonce as a bigint
|
|
30362
|
+
* @throws {NonceError} When retrieving the nonce fails
|
|
30363
|
+
*/
|
|
30068
30364
|
private getServersUserNonce;
|
|
30069
30365
|
/**
|
|
30070
30366
|
* Retrieves the user's current nonce from the DataPortabilityPermissions contract.
|
|
@@ -30080,6 +30376,16 @@ declare class PermissionsController {
|
|
|
30080
30376
|
* console.log(`Current permissions nonce: ${nonce}`);
|
|
30081
30377
|
* ```
|
|
30082
30378
|
*/
|
|
30379
|
+
/**
|
|
30380
|
+
* Retrieves the user's current nonce from the DataPortabilityPermissions contract.
|
|
30381
|
+
*
|
|
30382
|
+
* @remarks
|
|
30383
|
+
* Used for permission-related operations (grant/revoke) to prevent replay attacks.
|
|
30384
|
+
* The nonce must be incremented with each permission operation.
|
|
30385
|
+
*
|
|
30386
|
+
* @returns Promise resolving to the user's current nonce as a bigint
|
|
30387
|
+
* @throws {NonceError} When retrieving the nonce fails
|
|
30388
|
+
*/
|
|
30083
30389
|
private getPermissionsUserNonce;
|
|
30084
30390
|
/**
|
|
30085
30391
|
* Composes the EIP-712 typed data for PermissionGrant (new simplified format).
|
|
@@ -30206,7 +30512,7 @@ declare class PermissionsController {
|
|
|
30206
30512
|
* console.log('Now trusting servers:', trustedServers);
|
|
30207
30513
|
* ```
|
|
30208
30514
|
*/
|
|
30209
|
-
addAndTrustServer(params: AddAndTrustServerParams): Promise<
|
|
30515
|
+
addAndTrustServer(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
|
|
30210
30516
|
/**
|
|
30211
30517
|
* Trusts a server for data processing (legacy method).
|
|
30212
30518
|
*
|
|
@@ -30214,14 +30520,14 @@ declare class PermissionsController {
|
|
|
30214
30520
|
* @returns Promise resolving to transaction hash
|
|
30215
30521
|
* @deprecated Use addAndTrustServer instead
|
|
30216
30522
|
*/
|
|
30217
|
-
submitTrustServer(params: TrustServerParams): Promise<
|
|
30523
|
+
submitTrustServer(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
|
|
30218
30524
|
/**
|
|
30219
30525
|
* Adds and trusts a server using a signature (gasless transaction).
|
|
30220
30526
|
*
|
|
30221
30527
|
* @param params - Parameters for adding and trusting the server
|
|
30222
|
-
* @returns Promise resolving to
|
|
30528
|
+
* @returns Promise resolving to TransactionHandle with ServerTrustResult event data
|
|
30223
30529
|
*/
|
|
30224
|
-
submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<
|
|
30530
|
+
submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
|
|
30225
30531
|
/**
|
|
30226
30532
|
* Trusts a server using a signature (gasless transaction - legacy method).
|
|
30227
30533
|
*
|
|
@@ -30235,13 +30541,24 @@ declare class PermissionsController {
|
|
|
30235
30541
|
* @throws {ServerUrlMismatchError} When server URL doesn't match existing registration
|
|
30236
30542
|
* @throws {BlockchainError} When trust operation fails for any other reason
|
|
30237
30543
|
*/
|
|
30238
|
-
submitTrustServerWithSignature(params: TrustServerParams): Promise<
|
|
30544
|
+
submitTrustServerWithSignature(params: TrustServerParams): Promise<TransactionHandle<ServerTrustResult>>;
|
|
30239
30545
|
/**
|
|
30240
30546
|
* Submits a direct untrust server transaction (without signature).
|
|
30241
30547
|
*
|
|
30242
30548
|
* @param params - The untrust server parameters containing server details
|
|
30243
30549
|
* @returns Promise resolving to the transaction hash
|
|
30244
30550
|
*/
|
|
30551
|
+
/**
|
|
30552
|
+
* Submits an untrust server transaction directly to the blockchain.
|
|
30553
|
+
*
|
|
30554
|
+
* @remarks
|
|
30555
|
+
* Internal method used for direct blockchain submission of untrust server operations
|
|
30556
|
+
* when relayer callbacks are not available.
|
|
30557
|
+
*
|
|
30558
|
+
* @param params - The untrust server parameters
|
|
30559
|
+
* @returns Promise resolving to TransactionHandle for transaction tracking
|
|
30560
|
+
* @throws {BlockchainError} When contract submission fails
|
|
30561
|
+
*/
|
|
30245
30562
|
private submitDirectUntrustTransaction;
|
|
30246
30563
|
/**
|
|
30247
30564
|
* Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
|
|
@@ -30271,7 +30588,7 @@ declare class PermissionsController {
|
|
|
30271
30588
|
* console.log('Still trusting servers:', trustedServers);
|
|
30272
30589
|
* ```
|
|
30273
30590
|
*/
|
|
30274
|
-
submitUntrustServer(params: UntrustServerParams): Promise<
|
|
30591
|
+
submitUntrustServer(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
|
|
30275
30592
|
/**
|
|
30276
30593
|
* Untrusts a server using a signature (gasless transaction).
|
|
30277
30594
|
*
|
|
@@ -30284,7 +30601,7 @@ declare class PermissionsController {
|
|
|
30284
30601
|
* @throws {RelayerError} When gasless submission fails
|
|
30285
30602
|
* @throws {BlockchainError} When untrust transaction fails
|
|
30286
30603
|
*/
|
|
30287
|
-
submitUntrustServerWithSignature(params: UntrustServerParams): Promise<
|
|
30604
|
+
submitUntrustServerWithSignature(params: UntrustServerParams): Promise<TransactionHandle<ServerUntrustResult>>;
|
|
30288
30605
|
/**
|
|
30289
30606
|
* Retrieves all servers trusted by a user from the DataPortabilityServers contract.
|
|
30290
30607
|
*
|
|
@@ -30335,22 +30652,60 @@ declare class PermissionsController {
|
|
|
30335
30652
|
/**
|
|
30336
30653
|
* Gets server information for multiple servers efficiently.
|
|
30337
30654
|
*
|
|
30338
|
-
* @
|
|
30339
|
-
*
|
|
30655
|
+
* @remarks
|
|
30656
|
+
* This method uses multicall to fetch information for multiple servers in a single
|
|
30657
|
+
* blockchain call, improving performance when querying many servers. Failed lookups
|
|
30658
|
+
* are returned separately for error handling.
|
|
30659
|
+
*
|
|
30660
|
+
* @param serverIds - Array of numeric server IDs to query
|
|
30661
|
+
* @returns Promise resolving to batch result containing successful lookups and failed IDs
|
|
30340
30662
|
* @throws {BlockchainError} When reading from contract fails or chain is unavailable
|
|
30663
|
+
* @example
|
|
30664
|
+
* ```typescript
|
|
30665
|
+
* const result = await vana.permissions.getServerInfoBatch([1, 2, 3, 999]);
|
|
30666
|
+
*
|
|
30667
|
+
* // Process successful lookups
|
|
30668
|
+
* result.servers.forEach((server, id) => {
|
|
30669
|
+
* console.log(`Server ${id}: ${server.url}`);
|
|
30670
|
+
* });
|
|
30671
|
+
*
|
|
30672
|
+
* // Handle failed lookups
|
|
30673
|
+
* if (result.failed.length > 0) {
|
|
30674
|
+
* console.log(`Failed to fetch: ${result.failed.join(', ')}`);
|
|
30675
|
+
* }
|
|
30676
|
+
* ```
|
|
30341
30677
|
*/
|
|
30342
30678
|
getServerInfoBatch(serverIds: number[]): Promise<BatchServerInfoResult>;
|
|
30343
30679
|
/**
|
|
30344
30680
|
* Checks whether a specific server is trusted by a user.
|
|
30345
30681
|
*
|
|
30346
|
-
* @
|
|
30682
|
+
* @remarks
|
|
30683
|
+
* This method queries the user's trusted server list and checks if the specified
|
|
30684
|
+
* server is present. Returns both the trust status and the index in the trust list
|
|
30685
|
+
* if trusted.
|
|
30686
|
+
*
|
|
30687
|
+
* @param serverId - Numeric server ID to check
|
|
30347
30688
|
* @param userAddress - Optional user address (defaults to current user)
|
|
30348
|
-
* @returns Promise resolving to server trust status
|
|
30689
|
+
* @returns Promise resolving to server trust status with trust index if applicable
|
|
30690
|
+
* @throws {BlockchainError} When reading from contract fails
|
|
30691
|
+
* @example
|
|
30692
|
+
* ```typescript
|
|
30693
|
+
* const status = await vana.permissions.checkServerTrustStatus(1);
|
|
30694
|
+
* if (status.isTrusted) {
|
|
30695
|
+
* console.log(`Server is trusted at index ${status.trustIndex}`);
|
|
30696
|
+
* } else {
|
|
30697
|
+
* console.log('Server is not trusted');
|
|
30698
|
+
* }
|
|
30699
|
+
* ```
|
|
30349
30700
|
*/
|
|
30350
30701
|
checkServerTrustStatus(serverId: number, userAddress?: Address): Promise<ServerTrustStatus>;
|
|
30351
30702
|
/**
|
|
30352
30703
|
* Composes EIP-712 typed data for AddAndTrustServer.
|
|
30353
30704
|
*
|
|
30705
|
+
* @remarks
|
|
30706
|
+
* Creates the complete typed data structure required for EIP-712 signature generation
|
|
30707
|
+
* when adding and trusting a new server in a single transaction.
|
|
30708
|
+
*
|
|
30354
30709
|
* @param input - The add and trust server input data containing server details
|
|
30355
30710
|
* @returns Promise resolving to the typed data structure for server add and trust
|
|
30356
30711
|
*/
|
|
@@ -30432,7 +30787,7 @@ declare class PermissionsController {
|
|
|
30432
30787
|
* console.log(`Grantee registered in transaction: ${txHash}`);
|
|
30433
30788
|
* ```
|
|
30434
30789
|
*/
|
|
30435
|
-
submitRegisterGrantee(params: RegisterGranteeParams): Promise<
|
|
30790
|
+
submitRegisterGrantee(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
|
|
30436
30791
|
/**
|
|
30437
30792
|
* Registers a grantee with a signature (gasless transaction)
|
|
30438
30793
|
*
|
|
@@ -30448,7 +30803,7 @@ declare class PermissionsController {
|
|
|
30448
30803
|
* });
|
|
30449
30804
|
* ```
|
|
30450
30805
|
*/
|
|
30451
|
-
submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<
|
|
30806
|
+
submitRegisterGranteeWithSignature(params: RegisterGranteeParams): Promise<TransactionHandle<GranteeRegisterResult>>;
|
|
30452
30807
|
/**
|
|
30453
30808
|
* Submits a signed register grantee transaction via relayer
|
|
30454
30809
|
*
|
|
@@ -30461,7 +30816,7 @@ declare class PermissionsController {
|
|
|
30461
30816
|
* const result = await vana.permissions.submitSignedRegisterGrantee(typedData, signature);
|
|
30462
30817
|
* ```
|
|
30463
30818
|
*/
|
|
30464
|
-
submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<
|
|
30819
|
+
submitSignedRegisterGrantee(typedData: RegisterGranteeTypedData, signature: Hash): Promise<TransactionHandle<GranteeRegisterResult>>;
|
|
30465
30820
|
/**
|
|
30466
30821
|
* Retrieves all registered grantees from the DataPortabilityGrantees contract.
|
|
30467
30822
|
*
|
|
@@ -30748,7 +31103,7 @@ declare class PermissionsController {
|
|
|
30748
31103
|
* @param url - New URL for the server
|
|
30749
31104
|
* @returns Promise resolving to transaction hash
|
|
30750
31105
|
*/
|
|
30751
|
-
submitUpdateServer(serverId: bigint, url: string): Promise<
|
|
31106
|
+
submitUpdateServer(serverId: bigint, url: string): Promise<TransactionHandle<ServerUpdateResult>>;
|
|
30752
31107
|
/**
|
|
30753
31108
|
* Get all permission IDs for a user
|
|
30754
31109
|
*
|
|
@@ -30779,26 +31134,91 @@ declare class PermissionsController {
|
|
|
30779
31134
|
*/
|
|
30780
31135
|
getPermissions(permissionId: bigint): Promise<PermissionInfo>;
|
|
30781
31136
|
/**
|
|
30782
|
-
* Submit permission with signature to the blockchain
|
|
31137
|
+
* Submit permission with signature to the blockchain (supports gasless transactions)
|
|
30783
31138
|
*
|
|
30784
31139
|
* @param params - Parameters for adding permission
|
|
30785
31140
|
* @returns Promise resolving to transaction hash
|
|
31141
|
+
* @throws {RelayerError} When gasless transaction submission fails
|
|
31142
|
+
* @throws {SignatureError} When user rejects the signature request
|
|
31143
|
+
* @throws {BlockchainError} When permission addition fails
|
|
31144
|
+
* @throws {NetworkError} When network communication fails
|
|
31145
|
+
*/
|
|
31146
|
+
submitAddPermission(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
31147
|
+
/**
|
|
31148
|
+
* Submits an already-signed add permission transaction to the blockchain.
|
|
31149
|
+
* This method supports both relayer-based gasless transactions and direct transactions.
|
|
31150
|
+
*
|
|
31151
|
+
* @param typedData - The EIP-712 typed data for AddPermission
|
|
31152
|
+
* @param signature - The user's signature
|
|
31153
|
+
* @returns Promise resolving to TransactionHandle with PermissionGrantResult event data
|
|
31154
|
+
* @throws {RelayerError} When gasless transaction submission fails
|
|
31155
|
+
* @throws {BlockchainError} When permission addition fails
|
|
31156
|
+
* @throws {NetworkError} When network communication fails
|
|
30786
31157
|
*/
|
|
30787
|
-
|
|
31158
|
+
submitSignedAddPermission(typedData: GenericTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
30788
31159
|
/**
|
|
30789
|
-
* Submit server files and permissions with signature to the blockchain
|
|
31160
|
+
* Submit server files and permissions with signature to the blockchain (supports gasless transactions)
|
|
30790
31161
|
*
|
|
30791
31162
|
* @param params - Parameters for adding server files and permissions
|
|
30792
31163
|
* @returns Promise resolving to transaction hash
|
|
31164
|
+
* @throws {RelayerError} When gasless transaction submission fails
|
|
31165
|
+
* @throws {SignatureError} When user rejects the signature request
|
|
31166
|
+
* @throws {BlockchainError} When server files and permissions addition fails
|
|
31167
|
+
* @throws {NetworkError} When network communication fails
|
|
31168
|
+
*/
|
|
31169
|
+
submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
31170
|
+
/**
|
|
31171
|
+
* Submits an already-signed add server files and permissions transaction to the blockchain.
|
|
31172
|
+
*
|
|
31173
|
+
* @remarks
|
|
31174
|
+
* This method returns a TransactionHandle that provides immediate access to the transaction hash
|
|
31175
|
+
* while allowing lazy-loaded access to parsed event data. Use `waitForEvents()` to retrieve
|
|
31176
|
+
* the permission ID and other event details after transaction confirmation.
|
|
31177
|
+
*
|
|
31178
|
+
* @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
|
|
31179
|
+
* @param signature - The user's signature
|
|
31180
|
+
* @returns TransactionHandle with immediate hash access and optional event parsing
|
|
31181
|
+
* @throws {RelayerError} When gasless transaction submission fails
|
|
31182
|
+
* @throws {BlockchainError} When server files and permissions addition fails
|
|
31183
|
+
* @throws {NetworkError} When network communication fails
|
|
31184
|
+
*
|
|
31185
|
+
* @example
|
|
31186
|
+
* ```typescript
|
|
31187
|
+
* const tx = await vana.permissions.submitSignedAddServerFilesAndPermissions(
|
|
31188
|
+
* typedData,
|
|
31189
|
+
* signature
|
|
31190
|
+
* );
|
|
31191
|
+
* console.log(`Transaction submitted: ${tx.hash}`);
|
|
31192
|
+
*
|
|
31193
|
+
* // Wait for confirmation and get the permission ID
|
|
31194
|
+
* const { permissionId } = await tx.waitForEvents();
|
|
31195
|
+
* console.log(`Permission created with ID: ${permissionId}`);
|
|
31196
|
+
* ```
|
|
30793
31197
|
*/
|
|
30794
|
-
|
|
31198
|
+
submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash): Promise<TransactionHandle<PermissionGrantResult>>;
|
|
30795
31199
|
/**
|
|
30796
31200
|
* Submit permission revocation with signature to the blockchain
|
|
30797
31201
|
*
|
|
30798
31202
|
* @param permissionId - Permission ID to revoke
|
|
30799
31203
|
* @returns Promise resolving to transaction hash
|
|
30800
31204
|
*/
|
|
30801
|
-
submitRevokePermission(permissionId: bigint): Promise<
|
|
31205
|
+
submitRevokePermission(permissionId: bigint): Promise<TransactionHandle<PermissionRevokeResult>>;
|
|
31206
|
+
/**
|
|
31207
|
+
* Submits a signed add permission transaction directly to the blockchain.
|
|
31208
|
+
*
|
|
31209
|
+
* @param typedData - The typed data structure for the permission addition
|
|
31210
|
+
* @param signature - The cryptographic signature authorizing the transaction
|
|
31211
|
+
* @returns Promise resolving to the transaction hash
|
|
31212
|
+
*/
|
|
31213
|
+
private submitDirectAddPermissionTransaction;
|
|
31214
|
+
/**
|
|
31215
|
+
* Submits a signed add server files and permissions transaction directly to the blockchain.
|
|
31216
|
+
*
|
|
31217
|
+
* @param typedData - The typed data structure for the server files and permissions addition
|
|
31218
|
+
* @param signature - The cryptographic signature authorizing the transaction
|
|
31219
|
+
* @returns Promise resolving to the transaction hash
|
|
31220
|
+
*/
|
|
31221
|
+
private submitDirectAddServerFilesAndPermissionsTransaction;
|
|
30802
31222
|
}
|
|
30803
31223
|
|
|
30804
31224
|
/**
|
|
@@ -30924,33 +31344,52 @@ declare class SchemaController {
|
|
|
30924
31344
|
* Retrieves a schema by its ID.
|
|
30925
31345
|
*
|
|
30926
31346
|
* @param schemaId - The ID of the schema to retrieve
|
|
31347
|
+
* @param options - Optional parameters
|
|
31348
|
+
* @param options.subgraphUrl - Custom subgraph URL to use instead of default
|
|
30927
31349
|
* @returns Promise resolving to the schema object
|
|
30928
31350
|
* @throws {Error} When the schema is not found or chain is unavailable
|
|
30929
31351
|
* @example
|
|
30930
31352
|
* ```typescript
|
|
30931
31353
|
* const schema = await vana.schemas.get(1);
|
|
30932
31354
|
* console.log(`Schema: ${schema.name} (${schema.type})`);
|
|
31355
|
+
*
|
|
31356
|
+
* // With custom subgraph
|
|
31357
|
+
* const schema = await vana.schemas.get(1, {
|
|
31358
|
+
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
31359
|
+
* });
|
|
30933
31360
|
* ```
|
|
30934
31361
|
*/
|
|
30935
|
-
get(schemaId: number
|
|
31362
|
+
get(schemaId: number, options?: {
|
|
31363
|
+
subgraphUrl?: string;
|
|
31364
|
+
}): Promise<Schema>;
|
|
30936
31365
|
/**
|
|
30937
31366
|
* Gets the total number of schemas registered on the network.
|
|
30938
31367
|
*
|
|
31368
|
+
* @param options - Optional parameters
|
|
31369
|
+
* @param options.subgraphUrl - Custom subgraph URL to use instead of default
|
|
30939
31370
|
* @returns Promise resolving to the total schema count
|
|
30940
31371
|
* @throws {Error} When the count cannot be retrieved
|
|
30941
31372
|
* @example
|
|
30942
31373
|
* ```typescript
|
|
30943
31374
|
* const count = await vana.schemas.count();
|
|
30944
31375
|
* console.log(`Total schemas: ${count}`);
|
|
31376
|
+
*
|
|
31377
|
+
* // With custom subgraph
|
|
31378
|
+
* const count = await vana.schemas.count({
|
|
31379
|
+
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
31380
|
+
* });
|
|
30945
31381
|
* ```
|
|
30946
31382
|
*/
|
|
30947
|
-
count(
|
|
31383
|
+
count(options?: {
|
|
31384
|
+
subgraphUrl?: string;
|
|
31385
|
+
}): Promise<number>;
|
|
30948
31386
|
/**
|
|
30949
31387
|
* Lists all schemas with pagination.
|
|
30950
31388
|
*
|
|
30951
31389
|
* @param options - Optional parameters for listing schemas
|
|
30952
31390
|
* @param options.limit - Maximum number of schemas to return
|
|
30953
31391
|
* @param options.offset - Number of schemas to skip
|
|
31392
|
+
* @param options.subgraphUrl - Custom subgraph URL to use instead of default
|
|
30954
31393
|
* @returns Promise resolving to an array of schemas
|
|
30955
31394
|
* @example
|
|
30956
31395
|
* ```typescript
|
|
@@ -30959,11 +31398,19 @@ declare class SchemaController {
|
|
|
30959
31398
|
*
|
|
30960
31399
|
* // Get schemas with pagination
|
|
30961
31400
|
* const schemas = await vana.schemas.list({ limit: 10, offset: 0 });
|
|
31401
|
+
*
|
|
31402
|
+
* // With custom subgraph
|
|
31403
|
+
* const schemas = await vana.schemas.list({
|
|
31404
|
+
* limit: 10,
|
|
31405
|
+
* offset: 0,
|
|
31406
|
+
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
31407
|
+
* });
|
|
30962
31408
|
* ```
|
|
30963
31409
|
*/
|
|
30964
31410
|
list(options?: {
|
|
30965
31411
|
limit?: number;
|
|
30966
31412
|
offset?: number;
|
|
31413
|
+
subgraphUrl?: string;
|
|
30967
31414
|
}): Promise<Schema[]>;
|
|
30968
31415
|
/**
|
|
30969
31416
|
* Adds a schema using the legacy method (low-level API).
|
|
@@ -30973,6 +31420,36 @@ declare class SchemaController {
|
|
|
30973
31420
|
* @returns Promise resolving to the add schema result
|
|
30974
31421
|
*/
|
|
30975
31422
|
addSchema(params: AddSchemaParams): Promise<AddSchemaResult>;
|
|
31423
|
+
/**
|
|
31424
|
+
* Internal method: Query schema via subgraph
|
|
31425
|
+
*
|
|
31426
|
+
* @param params - Query parameters
|
|
31427
|
+
* @param params.schemaId - The ID of the schema to retrieve
|
|
31428
|
+
* @param params.subgraphUrl - The subgraph URL to query
|
|
31429
|
+
* @returns Promise resolving to the schema object
|
|
31430
|
+
* @private
|
|
31431
|
+
*/
|
|
31432
|
+
private _getSchemaViaSubgraph;
|
|
31433
|
+
/**
|
|
31434
|
+
* Internal method: List schemas via subgraph
|
|
31435
|
+
*
|
|
31436
|
+
* @param params - Query parameters
|
|
31437
|
+
* @param params.limit - Maximum number of schemas to return
|
|
31438
|
+
* @param params.offset - Number of schemas to skip
|
|
31439
|
+
* @param params.subgraphUrl - The subgraph URL to query
|
|
31440
|
+
* @returns Promise resolving to an array of schemas
|
|
31441
|
+
* @private
|
|
31442
|
+
*/
|
|
31443
|
+
private _listSchemasViaSubgraph;
|
|
31444
|
+
/**
|
|
31445
|
+
* Internal method: Count schemas via subgraph
|
|
31446
|
+
*
|
|
31447
|
+
* @param params - Query parameters
|
|
31448
|
+
* @param params.subgraphUrl - The subgraph URL to query
|
|
31449
|
+
* @returns Promise resolving to the total schema count
|
|
31450
|
+
* @private
|
|
31451
|
+
*/
|
|
31452
|
+
private _countSchemasViaSubgraph;
|
|
30976
31453
|
/**
|
|
30977
31454
|
* Gets the user's wallet address.
|
|
30978
31455
|
*
|
|
@@ -33621,19 +34098,18 @@ declare class DataController {
|
|
|
33621
34098
|
subgraphUrl?: string;
|
|
33622
34099
|
}): Promise<UserFile$1[]>;
|
|
33623
34100
|
/**
|
|
33624
|
-
* Retrieves a list of permissions granted by a user
|
|
34101
|
+
* Retrieves a list of permissions granted by a user.
|
|
33625
34102
|
*
|
|
33626
|
-
* This method
|
|
33627
|
-
*
|
|
33628
|
-
*
|
|
33629
|
-
*
|
|
33630
|
-
* 3. No need for additional contract calls as all data comes from subgraph
|
|
34103
|
+
* This method supports automatic fallback between subgraph and RPC modes:
|
|
34104
|
+
* - If subgraph URL is available, tries subgraph query first
|
|
34105
|
+
* - Falls back to direct contract queries via RPC if subgraph fails
|
|
34106
|
+
* - RPC mode uses gasAwareMulticall for efficient batch queries
|
|
33631
34107
|
*
|
|
33632
34108
|
* @param params - Object containing the user address and optional subgraph URL
|
|
33633
34109
|
* @param params.user - The wallet address of the user to query permissions for
|
|
33634
34110
|
* @param params.subgraphUrl - Optional subgraph URL to override the default
|
|
33635
34111
|
* @returns Promise resolving to an array of permission objects
|
|
33636
|
-
* @throws Error if subgraph
|
|
34112
|
+
* @throws Error if both subgraph and RPC queries fail
|
|
33637
34113
|
*/
|
|
33638
34114
|
getUserPermissions(params: {
|
|
33639
34115
|
user: Address;
|
|
@@ -33649,43 +34125,59 @@ declare class DataController {
|
|
|
33649
34125
|
user: Address;
|
|
33650
34126
|
}>>;
|
|
33651
34127
|
/**
|
|
33652
|
-
*
|
|
34128
|
+
* Internal method: Query user permissions via subgraph
|
|
33653
34129
|
*
|
|
33654
|
-
*
|
|
33655
|
-
*
|
|
34130
|
+
* @param params - Query parameters object
|
|
34131
|
+
* @param params.user - The user address to query permissions for
|
|
34132
|
+
* @param params.subgraphUrl - The subgraph URL endpoint to query
|
|
34133
|
+
* @returns Promise resolving to an array of permission objects
|
|
34134
|
+
*/
|
|
34135
|
+
private _getUserPermissionsViaSubgraph;
|
|
34136
|
+
/**
|
|
34137
|
+
* Internal method: Query user permissions via direct RPC
|
|
33656
34138
|
*
|
|
33657
|
-
*
|
|
33658
|
-
* -
|
|
33659
|
-
*
|
|
33660
|
-
|
|
34139
|
+
* @param params - Query parameters object
|
|
34140
|
+
* @param params.user - The user address to query permissions for
|
|
34141
|
+
* @returns Promise resolving to an array of permission objects
|
|
34142
|
+
*/
|
|
34143
|
+
private _getUserPermissionsViaRpc;
|
|
34144
|
+
/**
|
|
34145
|
+
* Retrieves a list of trusted servers for a user.
|
|
34146
|
+
*
|
|
34147
|
+
* This method supports automatic fallback between subgraph and RPC modes:
|
|
34148
|
+
* - If subgraph URL is available, tries subgraph query first for fast results
|
|
34149
|
+
* - Falls back to direct contract queries via RPC if subgraph fails
|
|
34150
|
+
* - RPC mode uses gasAwareMulticall for efficient batch queries
|
|
33661
34151
|
*
|
|
33662
|
-
* @param params - Query parameters including user address and
|
|
33663
|
-
* @
|
|
33664
|
-
* @
|
|
34152
|
+
* @param params - Query parameters including user address and optional pagination
|
|
34153
|
+
* @param params.user - The wallet address of the user to query trusted servers for
|
|
34154
|
+
* @param params.subgraphUrl - Optional subgraph URL to override the default
|
|
34155
|
+
* @param params.limit - Maximum number of results to return (default: 50)
|
|
34156
|
+
* @param params.offset - Number of results to skip for pagination (default: 0)
|
|
34157
|
+
* @returns Promise resolving to an array of trusted server objects
|
|
34158
|
+
* @throws Error if both subgraph and RPC queries fail
|
|
33665
34159
|
* @example
|
|
33666
34160
|
* ```typescript
|
|
33667
|
-
* //
|
|
33668
|
-
* const
|
|
33669
|
-
* user: '0x...'
|
|
33670
|
-
* mode: 'subgraph',
|
|
33671
|
-
* subgraphUrl: 'https://...'
|
|
34161
|
+
* // Basic usage with automatic fallback
|
|
34162
|
+
* const servers = await vana.data.getUserTrustedServers({
|
|
34163
|
+
* user: '0x...'
|
|
33672
34164
|
* });
|
|
33673
34165
|
*
|
|
33674
|
-
* //
|
|
33675
|
-
* const
|
|
34166
|
+
* // With pagination
|
|
34167
|
+
* const servers = await vana.data.getUserTrustedServers({
|
|
33676
34168
|
* user: '0x...',
|
|
33677
|
-
*
|
|
33678
|
-
*
|
|
34169
|
+
* limit: 10,
|
|
34170
|
+
* offset: 20
|
|
33679
34171
|
* });
|
|
33680
34172
|
*
|
|
33681
|
-
* //
|
|
33682
|
-
* const
|
|
34173
|
+
* // With custom subgraph URL
|
|
34174
|
+
* const servers = await vana.data.getUserTrustedServers({
|
|
33683
34175
|
* user: '0x...',
|
|
33684
|
-
*
|
|
34176
|
+
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
33685
34177
|
* });
|
|
33686
34178
|
* ```
|
|
33687
34179
|
*/
|
|
33688
|
-
getUserTrustedServers(params: GetUserTrustedServersParams): Promise<
|
|
34180
|
+
getUserTrustedServers(params: GetUserTrustedServersParams): Promise<TrustedServer[]>;
|
|
33689
34181
|
/**
|
|
33690
34182
|
* Internal method: Query trusted servers via subgraph
|
|
33691
34183
|
*
|
|
@@ -33750,75 +34242,28 @@ declare class DataController {
|
|
|
33750
34242
|
* for specific files by ID.
|
|
33751
34243
|
*/
|
|
33752
34244
|
getFileById(fileId: number): Promise<UserFile$1>;
|
|
33753
|
-
/**
|
|
33754
|
-
* Uploads an encrypted file to storage and registers it on the blockchain.
|
|
33755
|
-
*
|
|
33756
|
-
* @deprecated Since v2.0.0 - Use vana.data.upload() instead for the high-level API with automatic encryption
|
|
33757
|
-
*
|
|
33758
|
-
* Migration guide:
|
|
33759
|
-
* ```typescript
|
|
33760
|
-
* // Old way (deprecated):
|
|
33761
|
-
* const encrypted = await encryptBlob(data, key);
|
|
33762
|
-
* const result = await vana.data.uploadEncryptedFile(encrypted, filename);
|
|
33763
|
-
*
|
|
33764
|
-
* // New way:
|
|
33765
|
-
* const result = await vana.data.upload({
|
|
33766
|
-
* content: data,
|
|
33767
|
-
* filename: filename,
|
|
33768
|
-
* encrypt: true // Handles encryption automatically
|
|
33769
|
-
* });
|
|
33770
|
-
* ```
|
|
33771
|
-
* @param encryptedFile - The encrypted file blob to upload
|
|
33772
|
-
* @param filename - Optional filename for the upload
|
|
33773
|
-
* @param providerName - Optional storage provider to use
|
|
33774
|
-
* @returns Promise resolving to upload result with file ID and storage URL
|
|
33775
|
-
*
|
|
33776
|
-
* This method handles the complete flow of:
|
|
33777
|
-
* 1. Uploading the encrypted file to the specified storage provider
|
|
33778
|
-
* 2. Registering the file URL on the DataRegistry contract via relayer
|
|
33779
|
-
* 3. Returning the assigned file ID and storage URL
|
|
33780
|
-
*/
|
|
33781
|
-
uploadEncryptedFile(encryptedFile: Blob, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
|
|
33782
|
-
/**
|
|
33783
|
-
* Uploads an encrypted file to storage and registers it on the blockchain with a schema.
|
|
33784
|
-
*
|
|
33785
|
-
* @deprecated Since v2.0.0 - Use vana.data.upload() instead for the high-level API with automatic encryption and schema validation
|
|
33786
|
-
*
|
|
33787
|
-
* Migration guide:
|
|
33788
|
-
* ```typescript
|
|
33789
|
-
* // Old way (deprecated):
|
|
33790
|
-
* const encrypted = await encryptBlob(data, key);
|
|
33791
|
-
* const result = await vana.data.uploadEncryptedFileWithSchema(encrypted, schemaId, filename);
|
|
33792
|
-
*
|
|
33793
|
-
* // New way:
|
|
33794
|
-
* const result = await vana.data.upload({
|
|
33795
|
-
* content: data,
|
|
33796
|
-
* filename: filename,
|
|
33797
|
-
* schemaId: schemaId, // Automatic validation
|
|
33798
|
-
* encrypt: true
|
|
33799
|
-
* });
|
|
33800
|
-
* ```
|
|
33801
|
-
* @param encryptedFile - The encrypted file blob to upload
|
|
33802
|
-
* @param schemaId - The schema ID to associate with the file
|
|
33803
|
-
* @param filename - Optional filename for the upload
|
|
33804
|
-
* @param providerName - Optional storage provider to use
|
|
33805
|
-
* @returns Promise resolving to upload result with file ID and storage URL
|
|
33806
|
-
*
|
|
33807
|
-
* This method handles the complete flow of:
|
|
33808
|
-
* 1. Uploading the encrypted file to the specified storage provider
|
|
33809
|
-
* 2. Registering the file URL on the DataRegistry contract with a schema ID
|
|
33810
|
-
* 3. Returning the assigned file ID and storage URL
|
|
33811
|
-
*/
|
|
33812
|
-
uploadEncryptedFileWithSchema(encryptedFile: Blob, schemaId: number, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
|
|
33813
34245
|
/**
|
|
33814
34246
|
* Registers a file URL directly on the blockchain with a schema ID.
|
|
33815
34247
|
*
|
|
33816
|
-
* @
|
|
34248
|
+
* @remarks
|
|
34249
|
+
* This method registers an existing file URL on the DataRegistry contract
|
|
34250
|
+
* with a schema ID, without uploading any data. Useful when you have already
|
|
34251
|
+
* uploaded content to storage and just need to register it on-chain.
|
|
34252
|
+
*
|
|
34253
|
+
* @param url - The URL of the file to register (IPFS or HTTP/HTTPS)
|
|
33817
34254
|
* @param schemaId - The schema ID to associate with the file
|
|
33818
34255
|
* @returns Promise resolving to the file ID and transaction hash
|
|
33819
|
-
*
|
|
33820
|
-
*
|
|
33821
|
-
*
|
|
34256
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
34257
|
+
* @throws {Error} When wallet address is unavailable - "No addresses available"
|
|
34258
|
+
* @throws {Error} When transaction fails - "Failed to register file with schema"
|
|
34259
|
+
* @example
|
|
34260
|
+
* ```typescript
|
|
34261
|
+
* const { fileId, transactionHash } = await vana.data.registerFileWithSchema(
|
|
34262
|
+
* "ipfs://QmXxx...",
|
|
34263
|
+
* 1
|
|
34264
|
+
* );
|
|
34265
|
+
* console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
|
|
34266
|
+
* ```
|
|
33822
34267
|
*/
|
|
33823
34268
|
registerFileWithSchema(url: string, schemaId: number): Promise<{
|
|
33824
34269
|
fileId: number;
|
|
@@ -33876,95 +34321,114 @@ declare class DataController {
|
|
|
33876
34321
|
transactionHash: string;
|
|
33877
34322
|
}>;
|
|
33878
34323
|
/**
|
|
33879
|
-
* Adds a new
|
|
33880
|
-
*
|
|
33881
|
-
* @deprecated Since v2.0.0 - Use vana.schemas.create() instead for the high-level API with automatic IPFS upload
|
|
34324
|
+
* Adds a new refiner to the DataRefinerRegistry.
|
|
33882
34325
|
*
|
|
33883
|
-
*
|
|
34326
|
+
* @remarks
|
|
34327
|
+
* Refiners are data processing templates that define how raw data should be
|
|
34328
|
+
* transformed into structured formats. Each refiner is associated with a DLP
|
|
34329
|
+
* (Data Liquidity Pool), has a specific schema for output, and includes
|
|
34330
|
+
* instructions for the refinement process.
|
|
34331
|
+
*
|
|
34332
|
+
* @param params - Refiner configuration parameters
|
|
34333
|
+
* @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
|
|
34334
|
+
* @param params.name - Human-readable name for the refiner
|
|
34335
|
+
* @param params.schemaId - Schema ID that defines the output format
|
|
34336
|
+
* @param params.refinementInstructionUrl - URL containing processing instructions
|
|
34337
|
+
* @returns Promise resolving to the new refiner ID and transaction hash
|
|
34338
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
34339
|
+
* @throws {Error} When transaction fails - "Failed to add refiner: {error}"
|
|
34340
|
+
* @example
|
|
33884
34341
|
* ```typescript
|
|
33885
|
-
*
|
|
33886
|
-
*
|
|
33887
|
-
* name: "
|
|
33888
|
-
*
|
|
33889
|
-
*
|
|
33890
|
-
* });
|
|
33891
|
-
*
|
|
33892
|
-
* // New way:
|
|
33893
|
-
* const result = await vana.schemas.create({
|
|
33894
|
-
* name: "UserProfile",
|
|
33895
|
-
* type: "JSON",
|
|
33896
|
-
* definition: schemaObject // Automatically uploads to IPFS
|
|
34342
|
+
* const result = await vana.data.addRefiner({
|
|
34343
|
+
* dlpId: 1,
|
|
34344
|
+
* name: "Social Media Sentiment Analyzer",
|
|
34345
|
+
* schemaId: 42,
|
|
34346
|
+
* refinementInstructionUrl: "ipfs://QmXxx..."
|
|
33897
34347
|
* });
|
|
34348
|
+
* console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
|
|
33898
34349
|
* ```
|
|
33899
|
-
* @param params - Schema parameters including name, type, and definition URL
|
|
33900
|
-
* @returns Promise resolving to the new schema ID and transaction hash
|
|
33901
34350
|
*/
|
|
33902
|
-
|
|
34351
|
+
addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
|
|
33903
34352
|
/**
|
|
33904
|
-
* Retrieves a
|
|
34353
|
+
* Retrieves a refiner by its ID.
|
|
33905
34354
|
*
|
|
33906
|
-
* @
|
|
34355
|
+
* @remarks
|
|
34356
|
+
* Queries the DataRefinerRegistry contract to get complete information about
|
|
34357
|
+
* a specific refiner including its DLP association, schema, and instructions.
|
|
33907
34358
|
*
|
|
33908
|
-
*
|
|
34359
|
+
* @param refinerId - The numeric refiner ID to retrieve
|
|
34360
|
+
* @returns Promise resolving to the refiner information object
|
|
34361
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
34362
|
+
* @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
|
|
34363
|
+
* @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
|
|
34364
|
+
* @example
|
|
33909
34365
|
* ```typescript
|
|
33910
|
-
*
|
|
33911
|
-
*
|
|
33912
|
-
*
|
|
33913
|
-
*
|
|
33914
|
-
*
|
|
34366
|
+
* const refiner = await vana.data.getRefiner(1);
|
|
34367
|
+
* console.log({
|
|
34368
|
+
* name: refiner.name,
|
|
34369
|
+
* dlp: refiner.dlpId,
|
|
34370
|
+
* schema: refiner.schemaId,
|
|
34371
|
+
* instructions: refiner.refinementInstructionUrl
|
|
34372
|
+
* });
|
|
33915
34373
|
* ```
|
|
33916
|
-
* @param schemaId - The schema ID to retrieve
|
|
33917
|
-
* @returns Promise resolving to the schema information
|
|
33918
34374
|
*/
|
|
33919
|
-
|
|
34375
|
+
getRefiner(refinerId: number): Promise<Refiner>;
|
|
33920
34376
|
/**
|
|
33921
|
-
*
|
|
34377
|
+
* Validates if a schema ID exists in the registry.
|
|
33922
34378
|
*
|
|
33923
|
-
* @
|
|
34379
|
+
* @remarks
|
|
34380
|
+
* Checks the DataRefinerRegistry contract to determine if a given schema ID
|
|
34381
|
+
* has been registered and is available for use.
|
|
33924
34382
|
*
|
|
33925
|
-
*
|
|
34383
|
+
* @param schemaId - The numeric schema ID to validate
|
|
34384
|
+
* @returns Promise resolving to true if schema exists, false otherwise
|
|
34385
|
+
* @example
|
|
33926
34386
|
* ```typescript
|
|
33927
|
-
*
|
|
33928
|
-
*
|
|
33929
|
-
*
|
|
33930
|
-
*
|
|
33931
|
-
*
|
|
34387
|
+
* const isValid = await vana.data.isValidSchemaId(42);
|
|
34388
|
+
* if (isValid) {
|
|
34389
|
+
* console.log('Schema 42 is available for use');
|
|
34390
|
+
* } else {
|
|
34391
|
+
* console.log('Schema 42 does not exist');
|
|
34392
|
+
* }
|
|
33932
34393
|
* ```
|
|
33933
|
-
* @returns Promise resolving to the total schema count
|
|
33934
|
-
*/
|
|
33935
|
-
getSchemasCount(): Promise<number>;
|
|
33936
|
-
/**
|
|
33937
|
-
* Adds a new refiner to the DataRefinerRegistry.
|
|
33938
|
-
*
|
|
33939
|
-
* @param params - Refiner parameters including DLP ID, name, schema ID, and instruction URL
|
|
33940
|
-
* @returns Promise resolving to the new refiner ID and transaction hash
|
|
33941
|
-
*/
|
|
33942
|
-
addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
|
|
33943
|
-
/**
|
|
33944
|
-
* Retrieves a refiner by its ID.
|
|
33945
|
-
*
|
|
33946
|
-
* @param refinerId - The refiner ID to retrieve
|
|
33947
|
-
* @returns Promise resolving to the refiner information
|
|
33948
|
-
*/
|
|
33949
|
-
getRefiner(refinerId: number): Promise<Refiner>;
|
|
33950
|
-
/**
|
|
33951
|
-
* Validates if a schema ID exists in the registry.
|
|
33952
|
-
*
|
|
33953
|
-
* @param schemaId - The schema ID to validate
|
|
33954
|
-
* @returns Promise resolving to boolean indicating if the schema ID is valid
|
|
33955
34394
|
*/
|
|
33956
34395
|
isValidSchemaId(schemaId: number): Promise<boolean>;
|
|
33957
34396
|
/**
|
|
33958
34397
|
* Gets the total number of refiners in the registry.
|
|
33959
34398
|
*
|
|
34399
|
+
* @remarks
|
|
34400
|
+
* Queries the DataRefinerRegistry contract to get the total count of all
|
|
34401
|
+
* registered refiners across all DLPs.
|
|
34402
|
+
*
|
|
33960
34403
|
* @returns Promise resolving to the total refiner count
|
|
34404
|
+
* @example
|
|
34405
|
+
* ```typescript
|
|
34406
|
+
* const count = await vana.data.getRefinersCount();
|
|
34407
|
+
* console.log(`Total refiners registered: ${count}`);
|
|
34408
|
+
* ```
|
|
33961
34409
|
*/
|
|
33962
34410
|
getRefinersCount(): Promise<number>;
|
|
33963
34411
|
/**
|
|
33964
34412
|
* Updates the schema ID for an existing refiner.
|
|
33965
34413
|
*
|
|
33966
|
-
* @
|
|
34414
|
+
* @remarks
|
|
34415
|
+
* Allows the owner of a refiner to update its associated schema ID.
|
|
34416
|
+
* This is useful when refiner output format needs to change.
|
|
34417
|
+
*
|
|
34418
|
+
* @param params - Update parameters
|
|
34419
|
+
* @param params.refinerId - The refiner ID to update
|
|
34420
|
+
* @param params.newSchemaId - The new schema ID to set
|
|
33967
34421
|
* @returns Promise resolving to the transaction hash
|
|
34422
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
34423
|
+
* @throws {Error} When transaction fails - "Failed to update schema ID: {error}"
|
|
34424
|
+
* @example
|
|
34425
|
+
* ```typescript
|
|
34426
|
+
* const result = await vana.data.updateSchemaId({
|
|
34427
|
+
* refinerId: 1,
|
|
34428
|
+
* newSchemaId: 55
|
|
34429
|
+
* });
|
|
34430
|
+
* console.log(`Schema updated in tx ${result.transactionHash}`);
|
|
34431
|
+
* ```
|
|
33968
34432
|
*/
|
|
33969
34433
|
updateSchemaId(params: UpdateSchemaIdParams): Promise<UpdateSchemaIdResult>;
|
|
33970
34434
|
/**
|
|
@@ -33986,6 +34450,17 @@ declare class DataController {
|
|
|
33986
34450
|
account: Address;
|
|
33987
34451
|
publicKey: string;
|
|
33988
34452
|
}>, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
|
|
34453
|
+
/**
|
|
34454
|
+
* Uploads content to storage without registering it on the blockchain.
|
|
34455
|
+
* This method only handles the storage upload and returns the file URL.
|
|
34456
|
+
*
|
|
34457
|
+
* @param content - The content to upload (string, Blob, Buffer, or object - objects will be JSON stringified)
|
|
34458
|
+
* @param filename - Optional filename for the uploaded file (defaults to timestamp-based name)
|
|
34459
|
+
* @param encrypt - Optional flag to encrypt the content before upload
|
|
34460
|
+
* @param providerName - Optional specific storage provider to use
|
|
34461
|
+
* @returns Promise resolving to the storage upload result with url, size, and contentType
|
|
34462
|
+
*/
|
|
34463
|
+
uploadToStorage(content: string | Blob | Buffer | object, filename?: string, encrypt?: boolean, providerName?: string): Promise<StorageUploadResult>;
|
|
33989
34464
|
/**
|
|
33990
34465
|
* Adds a permission for a party to access an existing file.
|
|
33991
34466
|
*
|
|
@@ -34012,7 +34487,7 @@ declare class DataController {
|
|
|
34012
34487
|
* console.log(`Transaction: ${result.transactionHash}`);
|
|
34013
34488
|
* ```
|
|
34014
34489
|
*/
|
|
34015
|
-
addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<FilePermissionResult
|
|
34490
|
+
addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
|
|
34016
34491
|
/**
|
|
34017
34492
|
* Submits a file permission transaction and returns the transaction hash immediately.
|
|
34018
34493
|
*
|
|
@@ -34029,7 +34504,7 @@ declare class DataController {
|
|
|
34029
34504
|
* console.log(`Transaction submitted: ${txHash}`);
|
|
34030
34505
|
* ```
|
|
34031
34506
|
*/
|
|
34032
|
-
submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<
|
|
34507
|
+
submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionHandle<FilePermissionResult>>;
|
|
34033
34508
|
/**
|
|
34034
34509
|
* Gets the encrypted key for a specific account's permission to access a file.
|
|
34035
34510
|
*
|
|
@@ -35134,51 +35609,157 @@ declare class SerializationError extends VanaError {
|
|
|
35134
35609
|
constructor(message: string);
|
|
35135
35610
|
}
|
|
35136
35611
|
/**
|
|
35137
|
-
*
|
|
35612
|
+
* Thrown when a signature operation fails or cannot be completed.
|
|
35138
35613
|
*
|
|
35139
35614
|
* @remarks
|
|
35140
|
-
*
|
|
35141
|
-
*
|
|
35142
|
-
*
|
|
35615
|
+
* This error occurs when wallet signature operations fail due to disconnection,
|
|
35616
|
+
* locked accounts, or other wallet-related issues. It preserves the original
|
|
35617
|
+
* error for debugging while providing consistent error handling across the SDK.
|
|
35618
|
+
*
|
|
35619
|
+
* Recovery strategies:
|
|
35620
|
+
* - Check wallet connection and account unlock status
|
|
35621
|
+
* - Retry operation with explicit user interaction
|
|
35622
|
+
* - For gasless operations, consider switching to direct transactions
|
|
35623
|
+
*
|
|
35624
|
+
* @example
|
|
35625
|
+
* ```typescript
|
|
35626
|
+
* try {
|
|
35627
|
+
* await vana.permissions.grant({ grantee: '0x...' });
|
|
35628
|
+
* } catch (error) {
|
|
35629
|
+
* if (error instanceof SignatureError) {
|
|
35630
|
+
* // Prompt user to unlock wallet
|
|
35631
|
+
* await promptWalletUnlock();
|
|
35632
|
+
* // Retry operation
|
|
35633
|
+
* }
|
|
35634
|
+
* }
|
|
35635
|
+
* ```
|
|
35636
|
+
* @category Error Handling
|
|
35143
35637
|
*/
|
|
35144
35638
|
declare class SignatureError extends VanaError {
|
|
35145
35639
|
readonly originalError?: Error | undefined;
|
|
35146
35640
|
constructor(message: string, originalError?: Error | undefined);
|
|
35147
35641
|
}
|
|
35148
35642
|
/**
|
|
35149
|
-
*
|
|
35643
|
+
* Thrown when network communication fails during API calls or blockchain interactions.
|
|
35150
35644
|
*
|
|
35151
35645
|
* @remarks
|
|
35152
|
-
*
|
|
35153
|
-
*
|
|
35646
|
+
* This error encompasses network connectivity issues, API unavailability,
|
|
35647
|
+
* timeout errors, and CORS restrictions. It's commonly encountered during
|
|
35648
|
+
* IPFS operations, subgraph queries, or RPC calls.
|
|
35649
|
+
*
|
|
35650
|
+
* Recovery strategies:
|
|
35651
|
+
* - Check network connectivity
|
|
35652
|
+
* - Retry with exponential backoff
|
|
35653
|
+
* - Verify API endpoints are accessible
|
|
35654
|
+
* - Switch to alternative network providers or gateways
|
|
35655
|
+
*
|
|
35656
|
+
* @example
|
|
35657
|
+
* ```typescript
|
|
35658
|
+
* try {
|
|
35659
|
+
* const files = await vana.data.getUserFiles({ owner: '0x...' });
|
|
35660
|
+
* } catch (error) {
|
|
35661
|
+
* if (error instanceof NetworkError) {
|
|
35662
|
+
* // Implement retry with exponential backoff
|
|
35663
|
+
* await retryWithBackoff(() => vana.data.getUserFiles({ owner: '0x...' }));
|
|
35664
|
+
* }
|
|
35665
|
+
* }
|
|
35666
|
+
* ```
|
|
35667
|
+
* @category Error Handling
|
|
35154
35668
|
*/
|
|
35155
35669
|
declare class NetworkError extends VanaError {
|
|
35156
35670
|
readonly originalError?: Error | undefined;
|
|
35157
35671
|
constructor(message: string, originalError?: Error | undefined);
|
|
35158
35672
|
}
|
|
35159
35673
|
/**
|
|
35160
|
-
*
|
|
35674
|
+
* Thrown when transaction nonce retrieval fails during gasless operations.
|
|
35161
35675
|
*
|
|
35162
35676
|
* @remarks
|
|
35163
|
-
*
|
|
35164
|
-
*
|
|
35677
|
+
* This error occurs when the SDK cannot retrieve the user's current nonce from
|
|
35678
|
+
* smart contracts, preventing gasless transaction submission. Nonces are critical
|
|
35679
|
+
* for preventing replay attacks in signed transactions.
|
|
35680
|
+
*
|
|
35681
|
+
* Recovery strategies:
|
|
35682
|
+
* - Retry nonce retrieval after brief delay
|
|
35683
|
+
* - Check wallet connection and account status
|
|
35684
|
+
* - Use manual nonce specification if supported by the operation
|
|
35685
|
+
* - Switch to direct transactions as fallback
|
|
35686
|
+
*
|
|
35687
|
+
* @example
|
|
35688
|
+
* ```typescript
|
|
35689
|
+
* try {
|
|
35690
|
+
* await vana.permissions.grant({ grantee: '0x...' });
|
|
35691
|
+
* } catch (error) {
|
|
35692
|
+
* if (error instanceof NonceError) {
|
|
35693
|
+
* // Wait and retry
|
|
35694
|
+
* await delay(1000);
|
|
35695
|
+
* await vana.permissions.grant({ grantee: '0x...' });
|
|
35696
|
+
* }
|
|
35697
|
+
* }
|
|
35698
|
+
* ```
|
|
35699
|
+
* @category Error Handling
|
|
35165
35700
|
*/
|
|
35166
35701
|
declare class NonceError extends VanaError {
|
|
35167
35702
|
constructor(message: string);
|
|
35168
35703
|
}
|
|
35169
35704
|
/**
|
|
35170
|
-
*
|
|
35705
|
+
* Thrown when personal server operations fail or cannot be completed.
|
|
35171
35706
|
*
|
|
35172
35707
|
* @remarks
|
|
35173
|
-
*
|
|
35174
|
-
*
|
|
35708
|
+
* This error occurs during interactions with personal servers for computation
|
|
35709
|
+
* requests, identity retrieval, or operation status checks. Common causes include
|
|
35710
|
+
* server unavailability, untrusted server status, or invalid permission grants.
|
|
35711
|
+
*
|
|
35712
|
+
* Recovery strategies:
|
|
35713
|
+
* - Verify server URL accessibility
|
|
35714
|
+
* - Check server trust status via `vana.permissions.getTrustedServers()`
|
|
35715
|
+
* - Ensure valid permissions exist for the operation
|
|
35716
|
+
* - Retry after server becomes available
|
|
35717
|
+
*
|
|
35718
|
+
* @example
|
|
35719
|
+
* ```typescript
|
|
35720
|
+
* try {
|
|
35721
|
+
* const result = await vana.server.createOperation({ permissionId: 123 });
|
|
35722
|
+
* } catch (error) {
|
|
35723
|
+
* if (error instanceof PersonalServerError) {
|
|
35724
|
+
* // Check if server is trusted
|
|
35725
|
+
* const trustedServers = await vana.permissions.getTrustedServers();
|
|
35726
|
+
* if (!trustedServers.includes(serverId)) {
|
|
35727
|
+
* await vana.permissions.trustServer({ serverId });
|
|
35728
|
+
* }
|
|
35729
|
+
* }
|
|
35730
|
+
* }
|
|
35731
|
+
* ```
|
|
35732
|
+
* @category Error Handling
|
|
35175
35733
|
*/
|
|
35176
35734
|
declare class PersonalServerError extends VanaError {
|
|
35177
35735
|
readonly originalError?: Error | undefined;
|
|
35178
35736
|
constructor(message: string, originalError?: Error | undefined);
|
|
35179
35737
|
}
|
|
35180
35738
|
/**
|
|
35181
|
-
*
|
|
35739
|
+
* Thrown when attempting to register a server with a URL different from its existing registration.
|
|
35740
|
+
*
|
|
35741
|
+
* @remarks
|
|
35742
|
+
* This error occurs when trying to add or trust a server that's already registered
|
|
35743
|
+
* on-chain with a different URL. Server URLs are immutable once registered to
|
|
35744
|
+
* maintain consistency and security. Applications should use the existing URL
|
|
35745
|
+
* or register a new server with a different ID.
|
|
35746
|
+
*
|
|
35747
|
+
* @example
|
|
35748
|
+
* ```typescript
|
|
35749
|
+
* try {
|
|
35750
|
+
* await vana.permissions.addAndTrustServer({
|
|
35751
|
+
* serverId: 1,
|
|
35752
|
+
* serverUrl: 'https://new-url.com',
|
|
35753
|
+
* publicKey: '0x...'
|
|
35754
|
+
* });
|
|
35755
|
+
* } catch (error) {
|
|
35756
|
+
* if (error instanceof ServerUrlMismatchError) {
|
|
35757
|
+
* console.log(`Server already registered with: ${error.existingUrl}`);
|
|
35758
|
+
* // Use existing URL or register new server
|
|
35759
|
+
* }
|
|
35760
|
+
* }
|
|
35761
|
+
* ```
|
|
35762
|
+
* @category Error Handling
|
|
35182
35763
|
*/
|
|
35183
35764
|
declare class ServerUrlMismatchError extends VanaError {
|
|
35184
35765
|
constructor(existingUrl: string, providedUrl: string, serverId: string);
|
|
@@ -35187,7 +35768,25 @@ declare class ServerUrlMismatchError extends VanaError {
|
|
|
35187
35768
|
readonly serverId: string;
|
|
35188
35769
|
}
|
|
35189
35770
|
/**
|
|
35190
|
-
*
|
|
35771
|
+
* Thrown when permission grant, revoke, or validation operations fail.
|
|
35772
|
+
*
|
|
35773
|
+
* @remarks
|
|
35774
|
+
* This error occurs during permission management operations including grants,
|
|
35775
|
+
* revocations, and permission validation checks. Common causes include invalid
|
|
35776
|
+
* grantee addresses, expired permissions, or insufficient privileges.
|
|
35777
|
+
*
|
|
35778
|
+
* @example
|
|
35779
|
+
* ```typescript
|
|
35780
|
+
* try {
|
|
35781
|
+
* await vana.permissions.revoke({ permissionId: 999999 });
|
|
35782
|
+
* } catch (error) {
|
|
35783
|
+
* if (error instanceof PermissionError) {
|
|
35784
|
+
* console.error('Permission operation failed:', error.message);
|
|
35785
|
+
* // Permission may not exist or user may not be owner
|
|
35786
|
+
* }
|
|
35787
|
+
* }
|
|
35788
|
+
* ```
|
|
35789
|
+
* @category Error Handling
|
|
35191
35790
|
*/
|
|
35192
35791
|
declare class PermissionError extends VanaError {
|
|
35193
35792
|
readonly originalError?: Error | undefined;
|
|
@@ -36384,6 +36983,10 @@ declare class CircuitBreaker {
|
|
|
36384
36983
|
*
|
|
36385
36984
|
* This implementation uses browser-compatible libraries and configurations
|
|
36386
36985
|
* to provide crypto, PGP, and HTTP functionality without Node.js dependencies.
|
|
36986
|
+
*
|
|
36987
|
+
* WARNING: Dependencies that access globals during init
|
|
36988
|
+
* MUST be dynamically imported to support Turbopack.
|
|
36989
|
+
* See: https://github.com/vercel/next.js/issues/82632
|
|
36387
36990
|
*/
|
|
36388
36991
|
|
|
36389
36992
|
/**
|
|
@@ -36723,4 +37326,4 @@ declare function Vana(config: VanaConfig): VanaBrowserImpl;
|
|
|
36723
37326
|
*/
|
|
36724
37327
|
type VanaInstance = VanaBrowserImpl;
|
|
36725
37328
|
|
|
36726
|
-
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,
|
|
37329
|
+
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, 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, validateDataSchema, validateGrant, validateGrantExpiry, validateGrantFile, validateGranteeAccess, validateOperationAccess, vanaMainnet, type webhooks, withSignatureCache };
|