@opendatalabs/vana-sdk 0.1.0-alpha.fd33fc9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +33 -1
- package/dist/browser.js.map +1 -1
- package/dist/chains/index.cjs.map +1 -1
- package/dist/chains/index.d.ts +30 -1
- package/dist/chains/index.js.map +1 -1
- package/dist/client/__tests__/enhancedResponse.test.d.ts +1 -0
- package/dist/client/enhancedResponse.cjs +164 -0
- package/dist/client/enhancedResponse.cjs.map +1 -0
- package/dist/client/enhancedResponse.d.ts +120 -0
- package/dist/client/enhancedResponse.js +138 -0
- package/dist/client/enhancedResponse.js.map +1 -0
- package/dist/config/chains.cjs.map +1 -1
- package/dist/config/chains.d.ts +99 -0
- package/dist/config/chains.js.map +1 -1
- package/dist/contracts/contractController.cjs.map +1 -1
- package/dist/contracts/contractController.d.ts +66 -10
- package/dist/contracts/contractController.js.map +1 -1
- package/dist/controllers/__tests__/data-consistency-integration.test.d.ts +7 -0
- package/dist/controllers/__tests__/operations.processQueue.test.d.ts +1 -0
- package/dist/controllers/base.cjs +33 -0
- package/dist/controllers/base.cjs.map +1 -1
- package/dist/controllers/base.d.ts +10 -0
- package/dist/controllers/base.js +33 -0
- package/dist/controllers/base.js.map +1 -1
- package/dist/controllers/data.cjs +417 -276
- package/dist/controllers/data.cjs.map +1 -1
- package/dist/controllers/data.d.ts +246 -193
- package/dist/controllers/data.js +430 -279
- package/dist/controllers/data.js.map +1 -1
- package/dist/controllers/operations.cjs +430 -0
- package/dist/controllers/operations.cjs.map +1 -0
- package/dist/controllers/operations.d.ts +229 -0
- package/dist/controllers/operations.js +406 -0
- package/dist/controllers/operations.js.map +1 -0
- package/dist/controllers/permissions.cjs +690 -209
- package/dist/controllers/permissions.cjs.map +1 -1
- package/dist/controllers/permissions.d.ts +196 -68
- package/dist/controllers/permissions.js +690 -209
- package/dist/controllers/permissions.js.map +1 -1
- package/dist/controllers/protocol.cjs.map +1 -1
- package/dist/controllers/protocol.d.ts +27 -28
- package/dist/controllers/protocol.js.map +1 -1
- package/dist/controllers/schemas.cjs +104 -25
- package/dist/controllers/schemas.cjs.map +1 -1
- package/dist/controllers/schemas.d.ts +88 -40
- package/dist/controllers/schemas.js +104 -25
- package/dist/controllers/schemas.js.map +1 -1
- package/dist/controllers/server.cjs +269 -58
- package/dist/controllers/server.cjs.map +1 -1
- package/dist/controllers/server.d.ts +157 -52
- package/dist/controllers/server.js +269 -58
- package/dist/controllers/server.js.map +1 -1
- package/dist/core/__tests__/health.test.d.ts +1 -0
- package/dist/core/__tests__/inMemoryNonceManager.test.d.ts +1 -0
- package/dist/core/__tests__/nonceManager.test.d.ts +1 -0
- package/dist/core/__tests__/pollingManager.test.d.ts +4 -0
- package/dist/core/apiClient.cjs +53 -3
- package/dist/core/apiClient.cjs.map +1 -1
- package/dist/core/apiClient.d.ts +132 -7
- package/dist/core/apiClient.js +53 -3
- package/dist/core/apiClient.js.map +1 -1
- package/dist/core/generics.cjs +30 -3
- package/dist/core/generics.cjs.map +1 -1
- package/dist/core/generics.d.ts +95 -6
- package/dist/core/generics.js +30 -3
- package/dist/core/generics.js.map +1 -1
- package/dist/core/health.cjs +289 -0
- package/dist/core/health.cjs.map +1 -0
- package/dist/core/health.d.ts +143 -0
- package/dist/core/health.js +265 -0
- package/dist/core/health.js.map +1 -0
- package/dist/core/inMemoryNonceManager.cjs +138 -0
- package/dist/core/inMemoryNonceManager.cjs.map +1 -0
- package/dist/core/inMemoryNonceManager.d.ts +69 -0
- package/dist/core/inMemoryNonceManager.js +114 -0
- package/dist/core/inMemoryNonceManager.js.map +1 -0
- package/dist/core/nonceManager.cjs +304 -0
- package/dist/core/nonceManager.cjs.map +1 -0
- package/dist/core/nonceManager.d.ts +116 -0
- package/dist/core/nonceManager.js +280 -0
- package/dist/core/nonceManager.js.map +1 -0
- package/dist/core/pollingManager.cjs +292 -0
- package/dist/core/pollingManager.cjs.map +1 -0
- package/dist/core/pollingManager.d.ts +120 -0
- package/dist/core/pollingManager.js +268 -0
- package/dist/core/pollingManager.js.map +1 -0
- package/dist/core.cjs +55 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +54 -3
- package/dist/core.js +55 -1
- package/dist/core.js.map +1 -1
- package/dist/crypto/ecies/base.cjs +16 -3
- package/dist/crypto/ecies/base.cjs.map +1 -1
- package/dist/crypto/ecies/base.js +16 -3
- package/dist/crypto/ecies/base.js.map +1 -1
- package/dist/errors.cjs +29 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +64 -0
- package/dist/errors.js +28 -0
- package/dist/errors.js.map +1 -1
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs.map +1 -1
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.js.map +1 -1
- package/dist/generated/abi/DLPPerformanceImplementation.cjs +42 -0
- package/dist/generated/abi/DLPPerformanceImplementation.cjs.map +1 -1
- package/dist/generated/abi/DLPPerformanceImplementation.d.ts +32 -0
- package/dist/generated/abi/DLPPerformanceImplementation.js +42 -0
- package/dist/generated/abi/DLPPerformanceImplementation.js.map +1 -1
- package/dist/generated/abi/DLPRegistryImplementation.cjs +5 -5
- package/dist/generated/abi/DLPRegistryImplementation.cjs.map +1 -1
- package/dist/generated/abi/DLPRegistryImplementation.d.ts +4 -4
- package/dist/generated/abi/DLPRegistryImplementation.js +5 -5
- package/dist/generated/abi/DLPRegistryImplementation.js.map +1 -1
- package/dist/generated/abi/DLPRewardDeployerImplementation.cjs +166 -2
- package/dist/generated/abi/DLPRewardDeployerImplementation.cjs.map +1 -1
- package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +129 -2
- package/dist/generated/abi/DLPRewardDeployerImplementation.js +166 -2
- package/dist/generated/abi/DLPRewardDeployerImplementation.js.map +1 -1
- package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs +167 -19
- package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataPortabilityGranteesImplementation.d.ts +127 -14
- package/dist/generated/abi/DataPortabilityGranteesImplementation.js +167 -19
- package/dist/generated/abi/DataPortabilityGranteesImplementation.js.map +1 -1
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs +0 -19
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.ts +0 -14
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.js +0 -19
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.js.map +1 -1
- package/dist/generated/abi/DataPortabilityServersImplementation.cjs +0 -19
- package/dist/generated/abi/DataPortabilityServersImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataPortabilityServersImplementation.d.ts +0 -14
- package/dist/generated/abi/DataPortabilityServersImplementation.js +0 -19
- package/dist/generated/abi/DataPortabilityServersImplementation.js.map +1 -1
- package/dist/generated/abi/DataRegistryImplementation.cjs +0 -13
- package/dist/generated/abi/DataRegistryImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataRegistryImplementation.d.ts +0 -10
- package/dist/generated/abi/DataRegistryImplementation.js +0 -13
- package/dist/generated/abi/DataRegistryImplementation.js.map +1 -1
- package/dist/generated/abi/SwapHelperImplementation.cjs +0 -43
- package/dist/generated/abi/SwapHelperImplementation.cjs.map +1 -1
- package/dist/generated/abi/SwapHelperImplementation.d.ts +0 -35
- package/dist/generated/abi/SwapHelperImplementation.js +0 -43
- package/dist/generated/abi/SwapHelperImplementation.js.map +1 -1
- package/dist/generated/abi/VanaEpochImplementation.cjs +195 -0
- package/dist/generated/abi/VanaEpochImplementation.cjs.map +1 -1
- package/dist/generated/abi/VanaEpochImplementation.d.ts +151 -0
- package/dist/generated/abi/VanaEpochImplementation.js +195 -0
- package/dist/generated/abi/VanaEpochImplementation.js.map +1 -1
- package/dist/generated/abi/VanaPoolEntityImplementation.cjs +22 -65
- package/dist/generated/abi/VanaPoolEntityImplementation.cjs.map +1 -1
- package/dist/generated/abi/VanaPoolEntityImplementation.d.ts +17 -51
- package/dist/generated/abi/VanaPoolEntityImplementation.js +22 -65
- package/dist/generated/abi/VanaPoolEntityImplementation.js.map +1 -1
- package/dist/generated/abi/VanaPoolStakingImplementation.cjs +113 -1
- package/dist/generated/abi/VanaPoolStakingImplementation.cjs.map +1 -1
- package/dist/generated/abi/VanaPoolStakingImplementation.d.ts +85 -1
- package/dist/generated/abi/VanaPoolStakingImplementation.js +113 -1
- package/dist/generated/abi/VanaPoolStakingImplementation.js.map +1 -1
- package/dist/generated/abi/index.d.ts +546 -146
- package/dist/generated/event-types.cjs.map +1 -1
- package/dist/generated/event-types.d.ts +14 -8
- package/dist/generated/eventRegistry.cjs +42 -18
- package/dist/generated/eventRegistry.cjs.map +1 -1
- package/dist/generated/eventRegistry.js +42 -18
- package/dist/generated/eventRegistry.js.map +1 -1
- package/dist/generated/server/server-exports.cjs +22 -0
- package/dist/generated/server/server-exports.cjs.map +1 -1
- package/dist/generated/server/server-exports.d.ts +27 -10
- package/dist/generated/server/server-exports.js +17 -0
- package/dist/generated/server/server-exports.js.map +1 -1
- package/dist/generated/server/server.cjs.map +1 -1
- package/dist/generated/server/server.d.ts +771 -402
- package/dist/generated/subgraph.cjs +797 -32
- package/dist/generated/subgraph.cjs.map +1 -1
- package/dist/generated/subgraph.d.ts +135 -0
- package/dist/generated/subgraph.js +792 -32
- package/dist/generated/subgraph.js.map +1 -1
- package/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.js +10 -0
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.node.cjs +26 -0
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +49 -5
- package/dist/index.node.js +25 -1
- package/dist/index.node.js.map +1 -1
- package/dist/lib/__tests__/redisAtomicStore.test.d.ts +1 -0
- package/dist/lib/redisAtomicStore.cjs +201 -0
- package/dist/lib/redisAtomicStore.cjs.map +1 -0
- package/dist/lib/redisAtomicStore.d.ts +120 -0
- package/dist/lib/redisAtomicStore.js +177 -0
- package/dist/lib/redisAtomicStore.js.map +1 -0
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +39 -1
- package/dist/node.js.map +1 -1
- package/dist/platform/browser.cjs +160 -2
- package/dist/platform/browser.cjs.map +1 -1
- package/dist/platform/browser.d.ts +232 -12
- package/dist/platform/browser.js +160 -2
- package/dist/platform/browser.js.map +1 -1
- package/dist/platform/interface.cjs.map +1 -1
- package/dist/platform/interface.d.ts +283 -90
- package/dist/platform/node.cjs +163 -2
- package/dist/platform/node.cjs.map +1 -1
- package/dist/platform/node.d.ts +69 -6
- package/dist/platform/node.js +163 -2
- package/dist/platform/node.js.map +1 -1
- package/dist/server/relayerHandler.cjs +315 -81
- package/dist/server/relayerHandler.cjs.map +1 -1
- package/dist/server/relayerHandler.d.ts +35 -2
- package/dist/server/relayerHandler.js +315 -81
- package/dist/server/relayerHandler.js.map +1 -1
- package/dist/storage/index.cjs +3 -0
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/manager.cjs +108 -25
- package/dist/storage/manager.cjs.map +1 -1
- package/dist/storage/manager.d.ts +119 -25
- package/dist/storage/manager.js +108 -25
- package/dist/storage/manager.js.map +1 -1
- package/dist/storage/providers/callback-storage.cjs +86 -15
- package/dist/storage/providers/callback-storage.cjs.map +1 -1
- package/dist/storage/providers/callback-storage.d.ts +109 -20
- package/dist/storage/providers/callback-storage.js +86 -15
- package/dist/storage/providers/callback-storage.js.map +1 -1
- package/dist/storage/providers/dropbox.cjs +237 -0
- package/dist/storage/providers/dropbox.cjs.map +1 -0
- package/dist/storage/providers/dropbox.d.ts +39 -0
- package/dist/storage/providers/dropbox.js +215 -0
- package/dist/storage/providers/dropbox.js.map +1 -0
- package/dist/storage/providers/dropbox.test.d.ts +1 -0
- package/dist/storage/providers/pinata.cjs.map +1 -1
- package/dist/storage/providers/pinata.d.ts +12 -14
- package/dist/storage/providers/pinata.js.map +1 -1
- package/dist/tests/data-upload-owner-validation.test.d.ts +1 -0
- package/dist/tests/permissions-transaction-options.test.d.ts +1 -0
- package/dist/types/atomicStore.cjs +31 -0
- package/dist/types/atomicStore.cjs.map +1 -0
- package/dist/types/atomicStore.d.ts +236 -0
- package/dist/types/atomicStore.js +7 -0
- package/dist/types/atomicStore.js.map +1 -0
- package/dist/types/blockchain.cjs.map +1 -1
- package/dist/types/blockchain.d.ts +39 -11
- package/dist/types/chains.cjs.map +1 -1
- package/dist/types/chains.d.ts +74 -7
- package/dist/types/chains.js.map +1 -1
- package/dist/types/config.cjs.map +1 -1
- package/dist/types/config.d.ts +38 -4
- package/dist/types/config.js.map +1 -1
- package/dist/types/contracts.cjs.map +1 -1
- package/dist/types/contracts.d.ts +71 -7
- package/dist/types/controller-context.cjs.map +1 -1
- package/dist/types/controller-context.d.ts +4 -1
- package/dist/types/data.cjs.map +1 -1
- package/dist/types/data.d.ts +11 -10
- package/dist/types/generics.cjs.map +1 -1
- package/dist/types/generics.d.ts +81 -10
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.ts +31 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/operationStore.cjs +17 -0
- package/dist/types/operationStore.cjs.map +1 -0
- package/dist/types/operationStore.d.ts +171 -0
- package/dist/types/operationStore.js +1 -0
- package/dist/types/operationStore.js.map +1 -0
- package/dist/types/operations.cjs +3 -15
- package/dist/types/operations.cjs.map +1 -1
- package/dist/types/operations.d.ts +131 -39
- package/dist/types/operations.js +2 -13
- package/dist/types/operations.js.map +1 -1
- package/dist/types/options.cjs +17 -0
- package/dist/types/options.cjs.map +1 -0
- package/dist/types/options.d.ts +308 -0
- package/dist/types/options.js +1 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/permissions.cjs.map +1 -1
- package/dist/types/permissions.d.ts +19 -20
- package/dist/types/personal.cjs.map +1 -1
- package/dist/types/personal.d.ts +150 -14
- package/dist/types/relayer.cjs.map +1 -1
- package/dist/types/relayer.d.ts +145 -24
- package/dist/types/storage.cjs.map +1 -1
- package/dist/types/storage.d.ts +9 -21
- package/dist/types/storage.js.map +1 -1
- package/dist/types/utils.cjs.map +1 -1
- package/dist/types/utils.d.ts +0 -45
- package/dist/utils/__tests__/chainQuery.test.d.ts +1 -0
- package/dist/utils/__tests__/subgraphConsistency.test.d.ts +4 -0
- package/dist/utils/__tests__/subgraphPagination.test.d.ts +4 -0
- package/dist/utils/chainQuery.cjs +107 -0
- package/dist/utils/chainQuery.cjs.map +1 -0
- package/dist/utils/chainQuery.d.ts +31 -0
- package/dist/utils/chainQuery.js +82 -0
- package/dist/utils/chainQuery.js.map +1 -0
- package/dist/utils/grantFiles.cjs +4 -1
- package/dist/utils/grantFiles.cjs.map +1 -1
- package/dist/utils/grantFiles.d.ts +10 -20
- package/dist/utils/grantFiles.js +4 -1
- package/dist/utils/grantFiles.js.map +1 -1
- package/dist/utils/grantValidation.cjs.map +1 -1
- package/dist/utils/grantValidation.d.ts +95 -16
- package/dist/utils/grantValidation.js.map +1 -1
- package/dist/utils/grants.cjs.map +1 -1
- package/dist/utils/grants.d.ts +93 -12
- package/dist/utils/grants.js.map +1 -1
- package/dist/utils/ipfs.cjs +2 -4
- package/dist/utils/ipfs.cjs.map +1 -1
- package/dist/utils/ipfs.d.ts +1 -1
- package/dist/utils/ipfs.js +2 -4
- package/dist/utils/ipfs.js.map +1 -1
- package/dist/utils/lazy-import.cjs.map +1 -1
- package/dist/utils/lazy-import.d.ts +32 -7
- package/dist/utils/lazy-import.js.map +1 -1
- package/dist/utils/signatureCache.cjs +8 -2
- package/dist/utils/signatureCache.cjs.map +1 -1
- package/dist/utils/signatureCache.d.ts +49 -8
- package/dist/utils/signatureCache.js +8 -2
- package/dist/utils/signatureCache.js.map +1 -1
- package/dist/utils/subgraphConsistency.cjs +184 -0
- package/dist/utils/subgraphConsistency.cjs.map +1 -0
- package/dist/utils/subgraphConsistency.d.ts +65 -0
- package/dist/utils/subgraphConsistency.js +155 -0
- package/dist/utils/subgraphConsistency.js.map +1 -0
- package/dist/utils/subgraphMetaCache.cjs +101 -0
- package/dist/utils/subgraphMetaCache.cjs.map +1 -0
- package/dist/utils/subgraphMetaCache.d.ts +56 -0
- package/dist/utils/subgraphMetaCache.js +76 -0
- package/dist/utils/subgraphMetaCache.js.map +1 -0
- package/dist/utils/subgraphPagination.cjs +104 -0
- package/dist/utils/subgraphPagination.cjs.map +1 -0
- package/dist/utils/subgraphPagination.d.ts +78 -0
- package/dist/utils/subgraphPagination.js +78 -0
- package/dist/utils/subgraphPagination.js.map +1 -0
- package/dist/utils/transactionHelpers.cjs.map +1 -1
- package/dist/utils/transactionHelpers.d.ts +12 -12
- package/dist/utils/transactionHelpers.js.map +1 -1
- package/dist/utils/typedDataConverter.cjs.map +1 -1
- package/dist/utils/typedDataConverter.d.ts +39 -3
- package/dist/utils/typedDataConverter.js.map +1 -1
- package/dist/utils/urlResolver.cjs +7 -0
- package/dist/utils/urlResolver.cjs.map +1 -1
- package/dist/utils/urlResolver.d.ts +22 -4
- package/dist/utils/urlResolver.js +7 -0
- package/dist/utils/urlResolver.js.map +1 -1
- package/dist/utils/wallet.cjs.map +1 -1
- package/dist/utils/wallet.d.ts +78 -16
- package/dist/utils/wallet.js.map +1 -1
- package/package.json +3 -1
|
@@ -1,95 +1,122 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
+
import type { TransactionOptions, TransactionResult } from "../types/operations";
|
|
2
3
|
import type { StorageUploadResult } from "../types/storage";
|
|
3
4
|
import type { UserFile, UploadParams, UploadResult, UploadEncryptedFileResult, Refiner, AddRefinerParams, AddRefinerResult, UpdateSchemaIdParams, UpdateSchemaIdResult, TrustedServer, GetUserTrustedServersParams, EncryptedUploadParams, UnencryptedUploadParams, EncryptFileOptions, EncryptFileResult, DecryptFileOptions, UploadFileWithPermissionsParams, AddFilePermissionParams, DecryptFileWithPermissionOptions } from "../types/index";
|
|
4
|
-
import type { TransactionResult } from "../types/operations";
|
|
5
5
|
import type { ControllerContext } from "./permissions";
|
|
6
6
|
import { BaseController } from "./base";
|
|
7
|
+
import type { ConsistencyOptions, PaginationOptions } from "../types/options";
|
|
7
8
|
import { type DataSchema } from "../utils/schemaValidation";
|
|
8
9
|
/**
|
|
9
|
-
* Manages encrypted user data files and
|
|
10
|
+
* Manages encrypted user data files and blockchain registration on the Vana network.
|
|
10
11
|
*
|
|
11
12
|
* @remarks
|
|
12
|
-
*
|
|
13
|
-
* blockchain registration
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* encryption before any data leaves the user's device.
|
|
13
|
+
* The DataController provides comprehensive file lifecycle management from encrypted upload
|
|
14
|
+
* through blockchain registration to decryption. Client-side encryption ensures data privacy
|
|
15
|
+
* before transmission. The controller integrates with multiple storage providers (IPFS, Pinata,
|
|
16
|
+
* Google Drive) and supports both gasless transactions via relayers and direct blockchain interaction.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* **Architecture:**
|
|
19
|
+
* Files use dual storage: encrypted content on decentralized storage (IPFS/Pinata/Google Drive),
|
|
20
|
+
* metadata and permissions on blockchain. This design minimizes on-chain data while maintaining
|
|
21
|
+
* decentralization and access control.
|
|
22
22
|
*
|
|
23
23
|
* **Method Selection:**
|
|
24
|
-
* - `upload()`
|
|
25
|
-
* - `getUserFiles()`
|
|
26
|
-
* - `decryptFile()`
|
|
27
|
-
* - `getFileById()`
|
|
24
|
+
* - `upload()` - Complete workflow: encryption, storage, blockchain registration
|
|
25
|
+
* - `getUserFiles()` - Query file metadata from blockchain/subgraph
|
|
26
|
+
* - `decryptFile()` - Decrypt files you have permission to access
|
|
27
|
+
* - `getFileById()` - Retrieve specific file metadata by ID
|
|
28
28
|
*
|
|
29
29
|
* **Storage Requirements:**
|
|
30
|
-
* Methods requiring storage
|
|
31
|
-
* Methods working without storage: `getUserFiles()`, `decryptFile()`, `getFileById()`
|
|
30
|
+
* - Methods requiring storage: `upload()`, `encryptFile()`
|
|
31
|
+
* - Methods working without storage: `getUserFiles()`, `decryptFile()`, `getFileById()`
|
|
32
|
+
*
|
|
33
|
+
* **Permission Model:**
|
|
34
|
+
* - File permissions (decryption access) are handled during upload
|
|
35
|
+
* - Operation permissions (what can be done with data) use `vana.permissions.grant()`
|
|
36
|
+
*
|
|
32
37
|
* @example
|
|
33
38
|
* ```typescript
|
|
34
|
-
* // Upload
|
|
39
|
+
* // Upload encrypted file with schema validation
|
|
35
40
|
* const result = await vana.data.upload({
|
|
36
|
-
* content:
|
|
37
|
-
* filename: "
|
|
41
|
+
* content: { name: "Alice", age: 30 },
|
|
42
|
+
* filename: "profile.json",
|
|
43
|
+
* schemaId: 1
|
|
38
44
|
* });
|
|
45
|
+
* console.log(`File uploaded: ID ${result.fileId}, URL ${result.url}`);
|
|
39
46
|
*
|
|
40
|
-
* // Query files
|
|
47
|
+
* // Query user's files
|
|
41
48
|
* const files = await vana.data.getUserFiles({
|
|
42
|
-
* owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36"
|
|
49
|
+
* owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36"
|
|
43
50
|
* });
|
|
51
|
+
* files.forEach(file => console.log(`File ${file.id}: ${file.url}`));
|
|
44
52
|
*
|
|
45
|
-
* // Decrypt accessible file
|
|
53
|
+
* // Decrypt accessible file
|
|
46
54
|
* const decryptedData = await vana.data.decryptFile(files[0]);
|
|
55
|
+
* console.log("Decrypted content:", decryptedData);
|
|
47
56
|
* ```
|
|
57
|
+
*
|
|
48
58
|
* @category Data Management
|
|
49
|
-
* @see {@link https://docs.vana.
|
|
59
|
+
* @see For conceptual overview, visit {@link https://docs.vana.org/docs/data-registry}
|
|
50
60
|
*/
|
|
51
61
|
export declare class DataController extends BaseController {
|
|
52
62
|
constructor(context: ControllerContext);
|
|
53
63
|
/**
|
|
54
|
-
* Uploads
|
|
64
|
+
* Uploads data with automatic encryption and blockchain registration.
|
|
55
65
|
*
|
|
56
66
|
* @remarks
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* - Normalizes
|
|
63
|
-
* - Validates
|
|
64
|
-
* - Generates encryption keys
|
|
65
|
-
* - Uploads to
|
|
66
|
-
* - Grants
|
|
67
|
-
* - Registers
|
|
67
|
+
* Primary method for uploading data to Vana. Handles complete workflow:
|
|
68
|
+
* content normalization, schema validation, encryption, storage upload,
|
|
69
|
+
* permission granting, and blockchain registration.
|
|
70
|
+
*
|
|
71
|
+
* **Automatic Processing:**
|
|
72
|
+
* - Normalizes content to Blob format
|
|
73
|
+
* - Validates against schema if provided
|
|
74
|
+
* - Generates encryption keys
|
|
75
|
+
* - Uploads to configured storage
|
|
76
|
+
* - Grants decryption permissions
|
|
77
|
+
* - Registers on blockchain
|
|
68
78
|
*
|
|
69
79
|
* **TypeScript Overloads:**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* @param params
|
|
85
|
-
* @
|
|
86
|
-
* @
|
|
87
|
-
* @
|
|
88
|
-
*
|
|
89
|
-
* @
|
|
90
|
-
*
|
|
91
|
-
* @
|
|
92
|
-
*
|
|
80
|
+
* - `EncryptedUploadParams`: When `encrypt: true` (default), permissions require `publicKey`
|
|
81
|
+
* - `UnencryptedUploadParams`: When `encrypt: false`, permissions optional
|
|
82
|
+
* - `UploadParams`: General signature for runtime determination
|
|
83
|
+
*
|
|
84
|
+
* **Permission Separation:**
|
|
85
|
+
* - File permissions (here): Decryption access only
|
|
86
|
+
* - Operation permissions: Use `vana.permissions.grant()` separately
|
|
87
|
+
*
|
|
88
|
+
* **Owner/Encryption Constraint:**
|
|
89
|
+
* When encryption is enabled (default), the `owner` parameter must match
|
|
90
|
+
* the connected wallet address. This ensures only the wallet that performs
|
|
91
|
+
* encryption can decrypt the file. For delegation scenarios where the owner
|
|
92
|
+
* differs from the connected wallet, set `encrypt: false`.
|
|
93
|
+
*
|
|
94
|
+
* @param params - Upload configuration object
|
|
95
|
+
* @param params.content - Data to upload (string, object, or Blob)
|
|
96
|
+
* @param params.filename - Name for the uploaded file
|
|
97
|
+
* @param params.permissions - Decryption access grants.
|
|
98
|
+
* Each requires `account` and `publicKey` for encryption.
|
|
99
|
+
* @param params.schemaId - Schema for validation.
|
|
100
|
+
* Obtain via `vana.schemas.list()`.
|
|
101
|
+
* @param params.owner - Owner address for blockchain registration.
|
|
102
|
+
* Must match connected wallet when encryption is enabled.
|
|
103
|
+
* For delegation scenarios, disable encryption with `encrypt: false`.
|
|
104
|
+
* Defaults to connected wallet address.
|
|
105
|
+
* @param params.encrypt - Enable encryption (default: `true`)
|
|
106
|
+
* @param params.providerName - Storage provider override
|
|
107
|
+
*
|
|
108
|
+
* @returns Upload result with file ID, URL, and transaction hash
|
|
109
|
+
*
|
|
110
|
+
* @throws {InvalidConfigurationError} When encryption is enabled and owner differs from wallet.
|
|
111
|
+
* Set `encrypt: false` for delegation scenarios, or omit `owner` to use connected wallet.
|
|
112
|
+
* @throws {Error} Storage not configured.
|
|
113
|
+
* Configure storage providers in `VanaConfig`.
|
|
114
|
+
* @throws {Error} No wallet addresses available.
|
|
115
|
+
* Ensure wallet is connected.
|
|
116
|
+
* @throws {SchemaValidationError} Data doesn't match schema.
|
|
117
|
+
* Verify data structure matches schema from `vana.schemas.get(schemaId)`.
|
|
118
|
+
* @throws {Error} Upload failed with specific error message.
|
|
119
|
+
*
|
|
93
120
|
* @example
|
|
94
121
|
* ```typescript
|
|
95
122
|
* // Basic file upload
|
|
@@ -131,15 +158,12 @@ export declare class DataController extends BaseController {
|
|
|
131
158
|
* encrypt: false
|
|
132
159
|
* } as const); // 'as const' ensures TypeScript infers encrypt: false literally
|
|
133
160
|
*
|
|
134
|
-
* // Upload on behalf of another user (delegation)
|
|
161
|
+
* // Upload on behalf of another user (delegation without encryption)
|
|
135
162
|
* const result = await vana.data.upload({
|
|
136
163
|
* content: "User's data",
|
|
137
164
|
* filename: "delegated.txt",
|
|
138
|
-
* owner: "0x5678...",
|
|
139
|
-
*
|
|
140
|
-
* account: "0x1234...", // Address that can decrypt
|
|
141
|
-
* publicKey: "0x04..." // Their public key for encryption
|
|
142
|
-
* }]
|
|
165
|
+
* owner: "0x5678...", // Different from connected wallet
|
|
166
|
+
* encrypt: false // Required when owner differs from wallet
|
|
143
167
|
* });
|
|
144
168
|
* ```
|
|
145
169
|
*/
|
|
@@ -192,35 +216,33 @@ export declare class DataController extends BaseController {
|
|
|
192
216
|
*/
|
|
193
217
|
encryptFile(data: Blob | string | object, options?: EncryptFileOptions): Promise<EncryptFileResult>;
|
|
194
218
|
/**
|
|
195
|
-
* Decrypts a file
|
|
219
|
+
* Decrypts a file using wallet-derived decryption key.
|
|
196
220
|
*
|
|
197
221
|
* @remarks
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
222
|
+
* Counterpart to `upload()` for decrypting user files. Automatically
|
|
223
|
+
* generates decryption key from wallet, fetches encrypted content,
|
|
224
|
+
* and decrypts. Supports IPFS (with gateway fallback) and HTTP URLs.
|
|
225
|
+
*
|
|
226
|
+
* @param file - UserFile object from `getUserFiles()`
|
|
227
|
+
* @param options - Decryption options
|
|
228
|
+
* @param options.seed - Custom encryption seed.
|
|
229
|
+
* Defaults to standard Vana seed.
|
|
230
|
+
*
|
|
231
|
+
* @returns Decrypted content as Blob
|
|
232
|
+
*
|
|
233
|
+
* @throws {Error} No wallet connected.
|
|
234
|
+
* Connect wallet before decrypting.
|
|
235
|
+
* @throws {Error} Network error accessing file.
|
|
236
|
+
* Check CORS settings or server availability.
|
|
237
|
+
* @throws {Error} File not found (404).
|
|
238
|
+
* File no longer available at stored URL.
|
|
239
|
+
* @throws {Error} Access denied (403).
|
|
240
|
+
* No permission to access file.
|
|
241
|
+
* @throws {Error} Invalid file format.
|
|
242
|
+
* File not encrypted with Vana protocol.
|
|
243
|
+
* @throws {Error} Wrong encryption key.
|
|
244
|
+
* Verify seed matches upload or use default.
|
|
202
245
|
*
|
|
203
|
-
* The method automatically:
|
|
204
|
-
* - Generates the decryption key from the user's wallet signature
|
|
205
|
-
* - Determines the appropriate fetch method based on the file URL protocol
|
|
206
|
-
* - Fetches the encrypted content from IPFS or standard HTTP URLs
|
|
207
|
-
* - Decrypts the content using the generated key
|
|
208
|
-
*
|
|
209
|
-
* For IPFS URLs, the method uses gateway fallback for improved reliability. For
|
|
210
|
-
* standard HTTP URLs, it uses a simple fetch. If you need custom authentication
|
|
211
|
-
* headers or specific gateway configurations, use the low-level primitives directly.
|
|
212
|
-
*
|
|
213
|
-
* @param file - The user file to decrypt (typically from getUserFiles)
|
|
214
|
-
* @param encryptionSeed - Optional custom encryption seed (defaults to Vana standard)
|
|
215
|
-
* @returns Promise resolving to the decrypted file content as a Blob
|
|
216
|
-
* @throws {Error} "No addresses available in wallet client" - When wallet is not connected
|
|
217
|
-
* @throws {Error} "Network error: Cannot access the file URL" - When file URL is inaccessible (CORS, server down)
|
|
218
|
-
* @throws {Error} "File not found: The encrypted file is no longer available" - When file returns 404
|
|
219
|
-
* @throws {Error} "Access denied" - When file returns 403 (no permission)
|
|
220
|
-
* @throws {Error} "File is empty or could not be retrieved" - When file has no content
|
|
221
|
-
* @throws {Error} "Invalid file format: This file doesn't appear to be encrypted with the Vana protocol" - When file is not properly encrypted
|
|
222
|
-
* @throws {Error} "Wrong encryption key" - When decryption fails due to incorrect key/seed
|
|
223
|
-
* @throws {Error} "Failed to decrypt file: {error}" - General decryption failures
|
|
224
246
|
* @example
|
|
225
247
|
* ```typescript
|
|
226
248
|
* // Basic file decryption
|
|
@@ -248,42 +270,45 @@ export declare class DataController extends BaseController {
|
|
|
248
270
|
*/
|
|
249
271
|
decryptFile(file: UserFile, options?: DecryptFileOptions): Promise<Blob>;
|
|
250
272
|
/**
|
|
251
|
-
* Retrieves all
|
|
273
|
+
* Retrieves all files owned by a specific user address.
|
|
252
274
|
*
|
|
253
275
|
* @remarks
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
* @
|
|
265
|
-
*
|
|
266
|
-
* @
|
|
267
|
-
*
|
|
268
|
-
* @throws {Error}
|
|
269
|
-
*
|
|
270
|
-
* @throws {Error}
|
|
276
|
+
* Queries the Vana subgraph for files owned by the specified address.
|
|
277
|
+
* Automatically deduplicates by file ID, keeping the latest version
|
|
278
|
+
* when duplicates exist from re-indexing or chain reorganizations.
|
|
279
|
+
* Enriches results with DLP proof data when available.
|
|
280
|
+
*
|
|
281
|
+
* @param params - Query configuration
|
|
282
|
+
* @param params.owner - Wallet address of the file owner
|
|
283
|
+
* @param params.subgraphUrl - Subgraph endpoint override.
|
|
284
|
+
* Defaults to context configuration.
|
|
285
|
+
*
|
|
286
|
+
* @returns Array of UserFile objects sorted by timestamp (newest first)
|
|
287
|
+
*
|
|
288
|
+
* @throws {Error} Subgraph URL not configured.
|
|
289
|
+
* Provide `subgraphUrl` parameter or configure in Vana constructor.
|
|
290
|
+
* @throws {Error} Subgraph request failed.
|
|
291
|
+
* Check network connectivity and subgraph availability.
|
|
292
|
+
* @throws {Error} Subgraph returned errors.
|
|
293
|
+
* Review query parameters and subgraph logs.
|
|
294
|
+
*
|
|
271
295
|
* @example
|
|
272
296
|
* ```typescript
|
|
273
|
-
* // Query files for a specific user
|
|
274
297
|
* const files = await vana.data.getUserFiles({
|
|
275
|
-
* owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36"
|
|
298
|
+
* owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36"
|
|
276
299
|
* });
|
|
277
300
|
*
|
|
278
301
|
* files.forEach(file => {
|
|
279
|
-
* console.log(`File ${file.id}: ${file.url}
|
|
302
|
+
* console.log(`File ${file.id}: ${file.url}`);
|
|
303
|
+
* console.log(` Schema: ${file.schemaId}`);
|
|
304
|
+
* console.log(` DLPs: ${file.dlpIds?.join(", ") || "none"}`);
|
|
280
305
|
* });
|
|
281
306
|
* ```
|
|
282
307
|
*/
|
|
283
308
|
getUserFiles(params: {
|
|
284
309
|
owner: Address;
|
|
285
310
|
subgraphUrl?: string;
|
|
286
|
-
}): Promise<UserFile[]>;
|
|
311
|
+
}, options?: ConsistencyOptions & PaginationOptions): Promise<UserFile[]>;
|
|
287
312
|
/**
|
|
288
313
|
* Fetches proof data for multiple files from the subgraph.
|
|
289
314
|
*
|
|
@@ -324,6 +349,8 @@ export declare class DataController extends BaseController {
|
|
|
324
349
|
*/
|
|
325
350
|
getDLP(dlpId: number, options?: {
|
|
326
351
|
subgraphUrl?: string;
|
|
352
|
+
minBlock?: number;
|
|
353
|
+
waitForSync?: number;
|
|
327
354
|
}): Promise<{
|
|
328
355
|
id: number;
|
|
329
356
|
name: string;
|
|
@@ -384,7 +411,7 @@ export declare class DataController extends BaseController {
|
|
|
384
411
|
getUserPermissions(params: {
|
|
385
412
|
user: Address;
|
|
386
413
|
subgraphUrl?: string;
|
|
387
|
-
}): Promise<Array<{
|
|
414
|
+
}, options?: ConsistencyOptions & PaginationOptions): Promise<Array<{
|
|
388
415
|
id: string;
|
|
389
416
|
grant: string;
|
|
390
417
|
nonce: bigint;
|
|
@@ -447,7 +474,7 @@ export declare class DataController extends BaseController {
|
|
|
447
474
|
* });
|
|
448
475
|
* ```
|
|
449
476
|
*/
|
|
450
|
-
getUserTrustedServers(params: GetUserTrustedServersParams): Promise<TrustedServer[]>;
|
|
477
|
+
getUserTrustedServers(params: GetUserTrustedServersParams, options?: ConsistencyOptions & PaginationOptions): Promise<TrustedServer[]>;
|
|
451
478
|
/**
|
|
452
479
|
* Internal method: Query trusted servers via subgraph
|
|
453
480
|
*
|
|
@@ -468,48 +495,56 @@ export declare class DataController extends BaseController {
|
|
|
468
495
|
*/
|
|
469
496
|
private _getUserTrustedServersViaRpc;
|
|
470
497
|
/**
|
|
471
|
-
*
|
|
498
|
+
* Retrieves total file count from Data Registry.
|
|
499
|
+
*
|
|
500
|
+
* @remarks
|
|
501
|
+
* Queries blockchain for complete file count across all users.
|
|
502
|
+
* Useful for pagination and network statistics.
|
|
503
|
+
*
|
|
504
|
+
* @returns Total number of registered files
|
|
505
|
+
*
|
|
506
|
+
* @throws {Error} Chain ID not available.
|
|
507
|
+
* Ensure network connection.
|
|
508
|
+
* @throws {Error} Contract read failed.
|
|
509
|
+
* Check RPC availability.
|
|
472
510
|
*
|
|
473
|
-
* @returns Promise resolving to the total file count
|
|
474
511
|
* @example
|
|
475
512
|
* ```typescript
|
|
476
|
-
* const
|
|
477
|
-
* console.log(`Total files
|
|
513
|
+
* const total = await vana.data.getTotalFilesCount();
|
|
514
|
+
* console.log(`Total files: ${total}`);
|
|
478
515
|
*
|
|
479
|
-
* //
|
|
480
|
-
* const
|
|
481
|
-
* const totalPages = Math.ceil(totalFiles / filesPerPage);
|
|
482
|
-
* console.log(`Total pages: ${totalPages}`);
|
|
516
|
+
* // Calculate pagination
|
|
517
|
+
* const pages = Math.ceil(total / 20);
|
|
483
518
|
* ```
|
|
484
519
|
*/
|
|
485
520
|
getTotalFilesCount(): Promise<number>;
|
|
486
521
|
/**
|
|
487
|
-
* Retrieves
|
|
522
|
+
* Retrieves file metadata by ID from the blockchain.
|
|
523
|
+
*
|
|
524
|
+
* @remarks
|
|
525
|
+
* Queries DataRegistry contract directly for file details.
|
|
526
|
+
* Works for any file ID regardless of ownership, enabling
|
|
527
|
+
* cross-user file discovery and verification.
|
|
528
|
+
*
|
|
529
|
+
* @param fileId - Numeric file ID to retrieve
|
|
530
|
+
*
|
|
531
|
+
* @returns UserFile object with metadata
|
|
532
|
+
*
|
|
533
|
+
* @throws {Error} Chain ID not available.
|
|
534
|
+
* Ensure proper network connection.
|
|
535
|
+
* @throws {Error} File not found.
|
|
536
|
+
* Verify file ID exists on-chain.
|
|
537
|
+
* @throws {Error} Contract call failed.
|
|
538
|
+
* Check network and RPC availability.
|
|
488
539
|
*
|
|
489
|
-
* @param fileId - The file ID to look up
|
|
490
|
-
* @returns Promise resolving to UserFile object
|
|
491
|
-
* @throws {Error} "Chain ID not available" - When wallet chain is not configured
|
|
492
|
-
* @throws {Error} "File not found" - When file ID doesn't exist or returns empty data
|
|
493
|
-
* @throws {Error} "Failed to fetch file {fileId}: {error}" - General contract read failures
|
|
494
540
|
* @example
|
|
495
541
|
* ```typescript
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
* owner: file.ownerAddress,
|
|
502
|
-
* addedAt: file.addedAtBlock
|
|
503
|
-
* });
|
|
504
|
-
* } catch (error) {
|
|
505
|
-
* console.error('File not found or error retrieving file:', error);
|
|
506
|
-
* }
|
|
542
|
+
* const file = await vana.data.getFileById(123);
|
|
543
|
+
* console.log(`File ${file.id}:`);
|
|
544
|
+
* console.log(` URL: ${file.url}`);
|
|
545
|
+
* console.log(` Owner: ${file.ownerAddress}`);
|
|
546
|
+
* console.log(` Block: ${file.addedAtBlock}`);
|
|
507
547
|
* ```
|
|
508
|
-
*
|
|
509
|
-
* This method queries the DataRegistry contract directly
|
|
510
|
-
* to get file details for any file ID, regardless of user ownership.
|
|
511
|
-
* This is useful for file lookup functionality where users can search
|
|
512
|
-
* for specific files by ID.
|
|
513
548
|
*/
|
|
514
549
|
getFileById(fileId: number): Promise<UserFile>;
|
|
515
550
|
/**
|
|
@@ -535,7 +570,7 @@ export declare class DataController extends BaseController {
|
|
|
535
570
|
* console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
|
|
536
571
|
* ```
|
|
537
572
|
*/
|
|
538
|
-
registerFileWithSchema(url: string, schemaId: number): Promise<TransactionResult<"DataRegistry", "addFileWithSchema">>;
|
|
573
|
+
registerFileWithSchema(url: string, schemaId: number, options?: TransactionOptions): Promise<TransactionResult<"DataRegistry", "addFileWithSchema">>;
|
|
539
574
|
/**
|
|
540
575
|
* Gets the user's address from the wallet client.
|
|
541
576
|
*
|
|
@@ -561,7 +596,7 @@ export declare class DataController extends BaseController {
|
|
|
561
596
|
addFileWithPermissions(url: string, ownerAddress: Address, permissions?: Array<{
|
|
562
597
|
account: Address;
|
|
563
598
|
key: string;
|
|
564
|
-
}
|
|
599
|
+
}>, options?: TransactionOptions): Promise<TransactionResult<"DataRegistry", "addFileWithPermissions">>;
|
|
565
600
|
/**
|
|
566
601
|
* Adds a file to the registry with permissions and schema.
|
|
567
602
|
* This combines the functionality of addFileWithPermissions and schema validation.
|
|
@@ -604,7 +639,7 @@ export declare class DataController extends BaseController {
|
|
|
604
639
|
addFileWithPermissionsAndSchema(url: string, ownerAddress: Address, permissions?: Array<{
|
|
605
640
|
account: Address;
|
|
606
641
|
publicKey: string;
|
|
607
|
-
}>, schemaId?: number): Promise<TransactionResult<"DataRegistry", "addFileWithPermissionsAndSchema">>;
|
|
642
|
+
}>, schemaId?: number, options?: TransactionOptions): Promise<TransactionResult<"DataRegistry", "addFileWithPermissionsAndSchema">>;
|
|
608
643
|
/**
|
|
609
644
|
* Adds a file with pre-encrypted permissions and schema to the DataRegistry.
|
|
610
645
|
*
|
|
@@ -646,76 +681,89 @@ export declare class DataController extends BaseController {
|
|
|
646
681
|
addFileWithEncryptedPermissionsAndSchema(url: string, ownerAddress: Address, permissions?: Array<{
|
|
647
682
|
account: Address;
|
|
648
683
|
key: string;
|
|
649
|
-
}>, schemaId?: number): Promise<TransactionResult<"DataRegistry", "addFileWithPermissionsAndSchema">>;
|
|
684
|
+
}>, schemaId?: number, options?: TransactionOptions): Promise<TransactionResult<"DataRegistry", "addFileWithPermissionsAndSchema">>;
|
|
650
685
|
/**
|
|
651
|
-
*
|
|
686
|
+
* Registers a data refiner for processing templates.
|
|
652
687
|
*
|
|
653
688
|
* @remarks
|
|
654
|
-
* Refiners
|
|
655
|
-
*
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
* @param params - Refiner
|
|
660
|
-
* @param params.
|
|
661
|
-
*
|
|
662
|
-
* @param params.
|
|
663
|
-
*
|
|
664
|
-
* @returns
|
|
665
|
-
*
|
|
666
|
-
* @throws {Error}
|
|
689
|
+
* Refiners define data transformation rules for DLPs.
|
|
690
|
+
* Associates schema, instructions, and processing logic.
|
|
691
|
+
*
|
|
692
|
+
* @param params - Refiner configuration
|
|
693
|
+
* @param params.dlpId - Data Liquidity Pool ID
|
|
694
|
+
* @param params.name - Refiner display name
|
|
695
|
+
* @param params.schemaId - Output schema ID.
|
|
696
|
+
* Obtain via `vana.schemas.list()`.
|
|
697
|
+
* @param params.refinementInstructionUrl - Processing instructions URL
|
|
698
|
+
*
|
|
699
|
+
* @returns Refiner ID and transaction hash
|
|
700
|
+
*
|
|
701
|
+
* @throws {Error} Chain ID not available.
|
|
702
|
+
* Ensure network connection.
|
|
703
|
+
* @throws {Error} Transaction failed.
|
|
704
|
+
* Check wallet balance and network status.
|
|
705
|
+
*
|
|
667
706
|
* @example
|
|
668
707
|
* ```typescript
|
|
669
708
|
* const result = await vana.data.addRefiner({
|
|
670
709
|
* dlpId: 1,
|
|
671
|
-
* name: "
|
|
710
|
+
* name: "Sentiment Analyzer",
|
|
672
711
|
* schemaId: 42,
|
|
673
712
|
* refinementInstructionUrl: "ipfs://QmXxx..."
|
|
674
713
|
* });
|
|
675
|
-
* console.log(`
|
|
714
|
+
* console.log(`Refiner ${result.refinerId} created`);
|
|
676
715
|
* ```
|
|
677
716
|
*/
|
|
678
|
-
addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
|
|
717
|
+
addRefiner(params: AddRefinerParams, options?: TransactionOptions): Promise<AddRefinerResult>;
|
|
679
718
|
/**
|
|
680
|
-
* Retrieves
|
|
719
|
+
* Retrieves refiner configuration by ID.
|
|
681
720
|
*
|
|
682
721
|
* @remarks
|
|
683
|
-
* Queries
|
|
684
|
-
*
|
|
722
|
+
* Queries DataRefinerRegistry for refiner details.
|
|
723
|
+
* Returns DLP association, schema, and processing instructions.
|
|
724
|
+
*
|
|
725
|
+
* @param refinerId - Numeric refiner ID
|
|
726
|
+
*
|
|
727
|
+
* @returns Refiner configuration object
|
|
728
|
+
*
|
|
729
|
+
* @throws {Error} Chain ID not available.
|
|
730
|
+
* Ensure network connection.
|
|
731
|
+
* @throws {Error} Refiner not found.
|
|
732
|
+
* Verify refiner ID exists.
|
|
733
|
+
* @throws {Error} Contract read failed.
|
|
734
|
+
* Check network and RPC status.
|
|
685
735
|
*
|
|
686
|
-
* @param refinerId - The numeric refiner ID to retrieve
|
|
687
|
-
* @returns Promise resolving to the refiner information object
|
|
688
|
-
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
689
|
-
* @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
|
|
690
|
-
* @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
|
|
691
736
|
* @example
|
|
692
737
|
* ```typescript
|
|
693
738
|
* const refiner = await vana.data.getRefiner(1);
|
|
694
|
-
* console.log({
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
* schema: refiner.schemaId,
|
|
698
|
-
* instructions: refiner.refinementInstructionUrl
|
|
699
|
-
* });
|
|
739
|
+
* console.log(`Refiner: ${refiner.name}`);
|
|
740
|
+
* console.log(`DLP: ${refiner.dlpId}`);
|
|
741
|
+
* console.log(`Schema: ${refiner.schemaId}`);
|
|
700
742
|
* ```
|
|
701
743
|
*/
|
|
702
744
|
getRefiner(refinerId: number): Promise<Refiner>;
|
|
703
745
|
/**
|
|
704
|
-
* Validates
|
|
746
|
+
* Validates schema ID existence.
|
|
705
747
|
*
|
|
706
748
|
* @remarks
|
|
707
|
-
*
|
|
708
|
-
*
|
|
749
|
+
* Verifies schema registration in DataRegistry.
|
|
750
|
+
* Check before using schemas for uploads.
|
|
751
|
+
*
|
|
752
|
+
* @param schemaId - Numeric schema ID to validate
|
|
753
|
+
*
|
|
754
|
+
* @returns True if schema exists, false otherwise
|
|
755
|
+
*
|
|
756
|
+
* @throws {Error} Chain ID not available.
|
|
757
|
+
* Ensure network connection.
|
|
758
|
+
* @throws {Error} Contract read failed.
|
|
759
|
+
* Check RPC availability.
|
|
709
760
|
*
|
|
710
|
-
* @param schemaId - The numeric schema ID to validate
|
|
711
|
-
* @returns Promise resolving to true if schema exists, false otherwise
|
|
712
761
|
* @example
|
|
713
762
|
* ```typescript
|
|
714
|
-
* const
|
|
715
|
-
* if (
|
|
716
|
-
*
|
|
717
|
-
*
|
|
718
|
-
* console.log('Schema 42 does not exist');
|
|
763
|
+
* const valid = await vana.data.isValidSchemaId(42);
|
|
764
|
+
* if (valid) {
|
|
765
|
+
* // Safe to use schema 42
|
|
766
|
+
* await vana.data.upload({ schemaId: 42, ... });
|
|
719
767
|
* }
|
|
720
768
|
* ```
|
|
721
769
|
*/
|
|
@@ -757,7 +805,7 @@ export declare class DataController extends BaseController {
|
|
|
757
805
|
* console.log(`Schema updated in tx ${result.transactionHash}`);
|
|
758
806
|
* ```
|
|
759
807
|
*/
|
|
760
|
-
updateSchemaId(params: UpdateSchemaIdParams): Promise<UpdateSchemaIdResult>;
|
|
808
|
+
updateSchemaId(params: UpdateSchemaIdParams, options?: TransactionOptions): Promise<UpdateSchemaIdResult>;
|
|
761
809
|
/**
|
|
762
810
|
* Uploads an encrypted file and grants permission to a party with a public key.
|
|
763
811
|
*
|
|
@@ -814,7 +862,7 @@ export declare class DataController extends BaseController {
|
|
|
814
862
|
* console.log(`Transaction: ${result.transactionHash}`);
|
|
815
863
|
* ```
|
|
816
864
|
*/
|
|
817
|
-
addPermissionToFile(params: AddFilePermissionParams): Promise<TransactionResult<"DataRegistry", "addFilePermission">>;
|
|
865
|
+
addPermissionToFile(params: AddFilePermissionParams, options?: TransactionOptions): Promise<TransactionResult<"DataRegistry", "addFilePermission">>;
|
|
818
866
|
/**
|
|
819
867
|
* Submits a file permission transaction to the blockchain.
|
|
820
868
|
*
|
|
@@ -843,7 +891,7 @@ export declare class DataController extends BaseController {
|
|
|
843
891
|
* console.log(`Permission granted with ID: ${result.permissionId}`);
|
|
844
892
|
* ```
|
|
845
893
|
*/
|
|
846
|
-
submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionResult<"DataRegistry", "addFilePermission">>;
|
|
894
|
+
submitFilePermission(fileId: number, account: Address, publicKey: string, options?: TransactionOptions): Promise<TransactionResult<"DataRegistry", "addFilePermission">>;
|
|
847
895
|
/**
|
|
848
896
|
* Gets the encrypted key for a specific account's permission to access a file.
|
|
849
897
|
*
|
|
@@ -1011,4 +1059,9 @@ export declare class DataController extends BaseController {
|
|
|
1011
1059
|
* ```
|
|
1012
1060
|
*/
|
|
1013
1061
|
fetchAndValidateSchema(url: string): Promise<DataSchema>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Polls for confirmation of a relayer operation.
|
|
1064
|
+
* @internal
|
|
1065
|
+
*/
|
|
1066
|
+
private pollRelayerForConfirmation;
|
|
1014
1067
|
}
|