@opendatalabs/vana-sdk 0.1.0-alpha.eebb656 → 0.1.0-alpha.ef15099
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 +67 -351
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +33 -1
- package/dist/browser.js.map +1 -1
- package/dist/chains/definitions.cjs +9 -6
- package/dist/chains/definitions.cjs.map +1 -1
- package/dist/chains/definitions.d.ts +2 -0
- package/dist/chains/definitions.js +9 -6
- package/dist/chains/definitions.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/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/config/contracts.config.cjs +400 -0
- package/dist/config/contracts.config.cjs.map +1 -0
- package/dist/config/contracts.config.d.ts +84 -0
- package/dist/config/contracts.config.js +375 -0
- package/dist/config/contracts.config.js.map +1 -0
- package/dist/config/default-services.cjs +60 -0
- package/dist/config/default-services.cjs.map +1 -0
- package/dist/config/default-services.d.ts +46 -0
- package/dist/config/default-services.js +33 -0
- package/dist/config/default-services.js.map +1 -0
- package/dist/config/default-services.test.d.ts +1 -0
- package/dist/contracts/contractController.cjs +1 -1
- package/dist/contracts/contractController.cjs.map +1 -1
- package/dist/contracts/contractController.d.ts +66 -10
- package/dist/contracts/contractController.js +1 -1
- 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/accessSettlement.cjs +289 -0
- package/dist/controllers/accessSettlement.cjs.map +1 -0
- package/dist/controllers/accessSettlement.d.ts +157 -0
- package/dist/controllers/accessSettlement.js +265 -0
- package/dist/controllers/accessSettlement.js.map +1 -0
- package/dist/controllers/accessSettlement.test.d.ts +1 -0
- package/dist/controllers/base.cjs +116 -0
- package/dist/controllers/base.cjs.map +1 -0
- package/dist/controllers/base.d.ts +94 -0
- package/dist/controllers/base.js +92 -0
- package/dist/controllers/base.js.map +1 -0
- package/dist/controllers/data.cjs +634 -352
- package/dist/controllers/data.cjs.map +1 -1
- package/dist/controllers/data.d.ts +348 -213
- package/dist/controllers/data.js +647 -355
- 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 +943 -443
- package/dist/controllers/permissions.cjs.map +1 -1
- package/dist/controllers/permissions.d.ts +201 -120
- package/dist/controllers/permissions.js +943 -443
- package/dist/controllers/permissions.js.map +1 -1
- package/dist/controllers/protocol.cjs +14 -10
- package/dist/controllers/protocol.cjs.map +1 -1
- package/dist/controllers/protocol.d.ts +30 -31
- package/dist/controllers/protocol.js +14 -10
- package/dist/controllers/protocol.js.map +1 -1
- package/dist/controllers/runtimePermissions.cjs +272 -0
- package/dist/controllers/runtimePermissions.cjs.map +1 -0
- package/dist/controllers/runtimePermissions.d.ts +152 -0
- package/dist/controllers/runtimePermissions.js +251 -0
- package/dist/controllers/runtimePermissions.js.map +1 -0
- package/dist/controllers/runtimePermissions.test.d.ts +1 -0
- package/dist/controllers/schemas.cjs +113 -43
- package/dist/controllers/schemas.cjs.map +1 -1
- package/dist/controllers/schemas.d.ts +90 -43
- package/dist/controllers/schemas.js +113 -43
- package/dist/controllers/schemas.js.map +1 -1
- package/dist/controllers/server.cjs +276 -60
- package/dist/controllers/server.cjs.map +1 -1
- package/dist/controllers/server.d.ts +159 -54
- package/dist/controllers/server.js +276 -60
- 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 +164 -36
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +69 -10
- package/dist/core.js +167 -37
- package/dist/core.js.map +1 -1
- package/dist/crypto/ecies/__tests__/constants.test.d.ts +1 -1
- package/dist/crypto/ecies/__tests__/interface.test.d.ts +1 -0
- package/dist/crypto/ecies/__tests__/serialization.test.d.ts +8 -0
- package/dist/crypto/ecies/__tests__/utils.test.d.ts +1 -0
- package/dist/crypto/ecies/base.cjs +59 -23
- package/dist/crypto/ecies/base.cjs.map +1 -1
- package/dist/crypto/ecies/base.js +59 -23
- package/dist/crypto/ecies/base.js.map +1 -1
- package/dist/crypto/ecies/constants.cjs +2 -10
- package/dist/crypto/ecies/constants.cjs.map +1 -1
- package/dist/crypto/ecies/constants.d.ts +0 -9
- package/dist/crypto/ecies/constants.js +1 -8
- package/dist/crypto/ecies/constants.js.map +1 -1
- package/dist/crypto/ecies/interface.cjs +19 -2
- package/dist/crypto/ecies/interface.cjs.map +1 -1
- package/dist/crypto/ecies/interface.js +19 -2
- package/dist/crypto/ecies/interface.js.map +1 -1
- package/dist/errors.cjs +45 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +104 -0
- package/dist/errors.js +43 -0
- package/dist/errors.js.map +1 -1
- package/dist/generated/abi/AccessSettlementImplementation.cjs +635 -0
- package/dist/generated/abi/AccessSettlementImplementation.cjs.map +1 -0
- package/dist/generated/abi/AccessSettlementImplementation.d.ts +468 -0
- package/dist/generated/abi/AccessSettlementImplementation.js +611 -0
- package/dist/generated/abi/AccessSettlementImplementation.js.map +1 -0
- package/dist/generated/abi/AttestationPolicyImplementation.cjs +614 -0
- package/dist/generated/abi/AttestationPolicyImplementation.cjs.map +1 -0
- package/dist/generated/abi/AttestationPolicyImplementation.d.ts +449 -0
- package/dist/generated/abi/AttestationPolicyImplementation.js +590 -0
- package/dist/generated/abi/AttestationPolicyImplementation.js.map +1 -0
- package/dist/generated/abi/ComputeEngineImplementation.cjs.map +1 -1
- package/dist/generated/abi/ComputeEngineImplementation.js.map +1 -1
- package/dist/generated/abi/{DLPTreasuryImplementation.cjs → ComputeEngineTreasuryImplementation.cjs} +16 -92
- package/dist/generated/abi/ComputeEngineTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/{DLPTreasuryImplementation.d.ts → ComputeEngineTreasuryImplementation.d.ts} +9 -67
- package/dist/generated/abi/{DLPTreasuryImplementation.js → ComputeEngineTreasuryImplementation.js} +12 -88
- package/dist/generated/abi/ComputeEngineTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs.map +1 -1
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.js.map +1 -1
- package/dist/generated/abi/DATFactoryImplementation.cjs.map +1 -1
- package/dist/generated/abi/DATFactoryImplementation.js.map +1 -1
- package/dist/generated/abi/DATImplementation.cjs.map +1 -1
- package/dist/generated/abi/DATImplementation.js.map +1 -1
- package/dist/generated/abi/DATPausableImplementation.cjs.map +1 -1
- package/dist/generated/abi/DATPausableImplementation.js.map +1 -1
- package/dist/generated/abi/DATVotesImplementation.cjs.map +1 -1
- package/dist/generated/abi/DATVotesImplementation.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/DLPRegistryTreasuryImplementation.cjs.map +1 -1
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.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/DLPRewardSwapImplementation.cjs.map +1 -1
- package/dist/generated/abi/DLPRewardSwapImplementation.js.map +1 -1
- package/dist/generated/abi/DataLiquidityPoolImplementation.cjs +282 -100
- package/dist/generated/abi/DataLiquidityPoolImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +218 -79
- package/dist/generated/abi/DataLiquidityPoolImplementation.js +281 -99
- package/dist/generated/abi/DataLiquidityPoolImplementation.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/DataRefinerRegistryImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataRefinerRegistryImplementation.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/DatasetRegistryImplementation.cjs +751 -0
- package/dist/generated/abi/DatasetRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DatasetRegistryImplementation.d.ts +557 -0
- package/dist/generated/abi/DatasetRegistryImplementation.js +727 -0
- package/dist/generated/abi/DatasetRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/ProtocolConfigImplementation.cjs +578 -0
- package/dist/generated/abi/ProtocolConfigImplementation.cjs.map +1 -0
- package/dist/generated/abi/ProtocolConfigImplementation.d.ts +423 -0
- package/dist/generated/abi/ProtocolConfigImplementation.js +554 -0
- package/dist/generated/abi/ProtocolConfigImplementation.js.map +1 -0
- package/dist/generated/abi/QueryEngineImplementation.cjs.map +1 -1
- package/dist/generated/abi/QueryEngineImplementation.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/TeePoolDedicatedGpuImplementation.cjs.map +1 -1
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.js.map +1 -1
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.cjs.map +1 -1
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.js.map +1 -1
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.cjs.map +1 -1
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.js.map +1 -1
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.cjs.map +1 -1
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.js.map +1 -1
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.cjs.map +1 -1
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.js.map +1 -1
- package/dist/generated/abi/TeePoolPhalaImplementation.cjs.map +1 -1
- package/dist/generated/abi/TeePoolPhalaImplementation.js.map +1 -1
- package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.cjs +1251 -0
- package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.cjs.map +1 -0
- package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.d.ts +948 -0
- package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.js +1227 -0
- package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.js.map +1 -0
- package/dist/generated/abi/UniswapV3QuoterV2Implementation.cjs +297 -0
- package/dist/generated/abi/UniswapV3QuoterV2Implementation.cjs.map +1 -0
- package/dist/generated/abi/UniswapV3QuoterV2Implementation.d.ts +206 -0
- package/dist/generated/abi/UniswapV3QuoterV2Implementation.js +273 -0
- package/dist/generated/abi/UniswapV3QuoterV2Implementation.js.map +1 -0
- 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/VanaPoolTreasuryImplementation.cjs.map +1 -1
- package/dist/generated/abi/VanaPoolTreasuryImplementation.js.map +1 -1
- package/dist/generated/abi/VanaRuntimePermissionsImplementation.cjs +759 -0
- package/dist/generated/abi/VanaRuntimePermissionsImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaRuntimePermissionsImplementation.d.ts +563 -0
- package/dist/generated/abi/VanaRuntimePermissionsImplementation.js +735 -0
- package/dist/generated/abi/VanaRuntimePermissionsImplementation.js.map +1 -0
- package/dist/generated/abi/VanaRuntimeServersImplementation.cjs +820 -0
- package/dist/generated/abi/VanaRuntimeServersImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaRuntimeServersImplementation.d.ts +609 -0
- package/dist/generated/abi/VanaRuntimeServersImplementation.js +796 -0
- package/dist/generated/abi/VanaRuntimeServersImplementation.js.map +1 -0
- package/dist/generated/abi/VanaTreasuryImplementation.cjs +536 -0
- package/dist/generated/abi/VanaTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaTreasuryImplementation.d.ts +393 -0
- package/dist/generated/abi/VanaTreasuryImplementation.js +512 -0
- package/dist/generated/abi/VanaTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/WVANAImplementation.cjs +339 -0
- package/dist/generated/abi/WVANAImplementation.cjs.map +1 -0
- package/dist/generated/abi/WVANAImplementation.d.ts +244 -0
- package/dist/generated/abi/WVANAImplementation.js +315 -0
- package/dist/generated/abi/WVANAImplementation.js.map +1 -0
- package/dist/generated/abi/index.cjs +79 -47
- package/dist/generated/abi/index.cjs.map +1 -1
- package/dist/generated/abi/index.d.ts +15783 -10449
- package/dist/generated/abi/index.js +65 -43
- package/dist/generated/abi/index.js.map +1 -1
- package/dist/{config → generated}/addresses.cjs +174 -75
- package/dist/generated/addresses.cjs.map +1 -0
- package/dist/{config → generated}/addresses.d.ts +174 -165
- package/dist/{config → generated}/addresses.js +174 -75
- package/dist/generated/addresses.js.map +1 -0
- package/dist/generated/event-types.cjs.map +1 -1
- package/dist/generated/event-types.d.ts +482 -399
- package/dist/generated/eventRegistry.cjs +2601 -724
- package/dist/generated/eventRegistry.cjs.map +1 -1
- package/dist/generated/eventRegistry.d.ts +2 -2
- package/dist/generated/eventRegistry.js +2601 -724
- 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 +31 -11
- 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 +6 -1
- package/dist/index.browser.js +26 -1
- 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 +47 -4
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +60 -14
- package/dist/index.node.js +42 -3
- 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 +452 -0
- package/dist/server/relayerHandler.cjs.map +1 -0
- package/dist/server/relayerHandler.d.ts +69 -0
- package/dist/server/relayerHandler.js +428 -0
- package/dist/server/relayerHandler.js.map +1 -0
- 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/factories/mockFactory.d.ts +6 -6
- package/dist/tests/fakes/FakeWaitForTransactionEvents.d.ts +2 -2
- package/dist/tests/permissions-revoke-relayer.test.d.ts +1 -0
- package/dist/tests/permissions-transaction-options.test.d.ts +1 -0
- package/dist/tests/read-only-mode.test.d.ts +1 -0
- package/dist/tests/relayer-integration.test.d.ts +1 -0
- package/dist/tests/relayer-unified.test.d.ts +1 -0
- package/dist/tests/server-relayer-handler.test.d.ts +1 -0
- package/dist/types/accessSettlement.cjs +17 -0
- package/dist/types/accessSettlement.cjs.map +1 -0
- package/dist/types/accessSettlement.d.ts +66 -0
- package/dist/types/accessSettlement.js +1 -0
- package/dist/types/accessSettlement.js.map +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 +10 -0
- package/dist/types/config.cjs.map +1 -1
- package/dist/types/config.d.ts +217 -220
- package/dist/types/config.js +8 -0
- 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 +12 -6
- package/dist/types/data.cjs.map +1 -1
- package/dist/types/data.d.ts +82 -10
- package/dist/types/generics.cjs.map +1 -1
- package/dist/types/generics.d.ts +81 -10
- package/dist/types/index.cjs +4 -0
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.ts +36 -6
- package/dist/types/index.js +9 -1
- 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 +307 -35
- package/dist/types/runtimePermissions.cjs +17 -0
- package/dist/types/runtimePermissions.cjs.map +1 -0
- package/dist/types/runtimePermissions.d.ts +122 -0
- package/dist/types/runtimePermissions.js +1 -0
- package/dist/types/runtimePermissions.js.map +1 -0
- 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/blockchain/registry.cjs +3 -3
- package/dist/utils/blockchain/registry.cjs.map +1 -1
- package/dist/utils/blockchain/registry.d.ts +1 -1
- package/dist/utils/blockchain/registry.js +3 -3
- package/dist/utils/blockchain/registry.js.map +1 -1
- 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/multicall.cjs +1 -1
- package/dist/utils/multicall.cjs.map +1 -1
- package/dist/utils/multicall.js +1 -1
- package/dist/utils/multicall.js.map +1 -1
- package/dist/utils/runtimeGrantFiles.cjs +84 -0
- package/dist/utils/runtimeGrantFiles.cjs.map +1 -0
- package/dist/utils/runtimeGrantFiles.d.ts +66 -0
- package/dist/utils/runtimeGrantFiles.js +58 -0
- package/dist/utils/runtimeGrantFiles.js.map +1 -0
- 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 +63 -0
- package/dist/utils/wallet.cjs.map +1 -0
- package/dist/utils/wallet.d.ts +94 -0
- package/dist/utils/wallet.js +37 -0
- package/dist/utils/wallet.js.map +1 -0
- package/package.json +7 -2
- package/dist/config/addresses.cjs.map +0 -1
- package/dist/config/addresses.js.map +0 -1
- package/dist/generated/abi/DLPTreasuryImplementation.cjs.map +0 -1
- package/dist/generated/abi/DLPTreasuryImplementation.js.map +0 -1
- package/dist/server/handler.cjs +0 -101
- package/dist/server/handler.cjs.map +0 -1
- package/dist/server/handler.d.ts +0 -87
- package/dist/server/handler.js +0 -77
- package/dist/server/handler.js.map +0 -1
- /package/dist/{tests/server-handler.test.d.ts → client/__tests__/enhancedResponse.test.d.ts} +0 -0
|
@@ -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
|
-
import type { UserFile, UploadParams, UploadResult, UploadEncryptedFileResult, Refiner, AddRefinerParams, AddRefinerResult, UpdateSchemaIdParams, UpdateSchemaIdResult, TrustedServer, GetUserTrustedServersParams, EncryptedUploadParams, UnencryptedUploadParams } from "../types/index";
|
|
4
|
-
import type { TransactionResult } from "../types/operations";
|
|
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";
|
|
5
5
|
import type { ControllerContext } from "./permissions";
|
|
6
|
+
import { BaseController } from "./base";
|
|
7
|
+
import type { ConsistencyOptions, PaginationOptions } from "../types/options";
|
|
6
8
|
import { type DataSchema } from "../utils/schemaValidation";
|
|
7
9
|
/**
|
|
8
|
-
* Manages encrypted user data files and
|
|
10
|
+
* Manages encrypted user data files and blockchain registration on the Vana network.
|
|
9
11
|
*
|
|
10
12
|
* @remarks
|
|
11
|
-
*
|
|
12
|
-
* blockchain registration
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* 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.
|
|
16
17
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
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.
|
|
21
22
|
*
|
|
22
23
|
* **Method Selection:**
|
|
23
|
-
* - `upload()`
|
|
24
|
-
* - `getUserFiles()`
|
|
25
|
-
* - `decryptFile()`
|
|
26
|
-
* - `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
|
|
27
28
|
*
|
|
28
29
|
* **Storage Requirements:**
|
|
29
|
-
* Methods requiring storage
|
|
30
|
-
* 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
|
+
*
|
|
31
37
|
* @example
|
|
32
38
|
* ```typescript
|
|
33
|
-
* // Upload
|
|
39
|
+
* // Upload encrypted file with schema validation
|
|
34
40
|
* const result = await vana.data.upload({
|
|
35
|
-
* content:
|
|
36
|
-
* filename: "
|
|
41
|
+
* content: { name: "Alice", age: 30 },
|
|
42
|
+
* filename: "profile.json",
|
|
43
|
+
* schemaId: 1
|
|
37
44
|
* });
|
|
45
|
+
* console.log(`File uploaded: ID ${result.fileId}, URL ${result.url}`);
|
|
38
46
|
*
|
|
39
|
-
* // Query files
|
|
47
|
+
* // Query user's files
|
|
40
48
|
* const files = await vana.data.getUserFiles({
|
|
41
|
-
* owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36"
|
|
49
|
+
* owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36"
|
|
42
50
|
* });
|
|
51
|
+
* files.forEach(file => console.log(`File ${file.id}: ${file.url}`));
|
|
43
52
|
*
|
|
44
|
-
* // Decrypt accessible file
|
|
53
|
+
* // Decrypt accessible file
|
|
45
54
|
* const decryptedData = await vana.data.decryptFile(files[0]);
|
|
55
|
+
* console.log("Decrypted content:", decryptedData);
|
|
46
56
|
* ```
|
|
57
|
+
*
|
|
47
58
|
* @category Data Management
|
|
48
|
-
* @see {@link https://docs.vana.
|
|
59
|
+
* @see For conceptual overview, visit {@link https://docs.vana.org/docs/data-registry}
|
|
49
60
|
*/
|
|
50
|
-
export declare class DataController {
|
|
51
|
-
private readonly context;
|
|
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 {
|
|
|
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
|
*/
|
|
@@ -147,35 +171,78 @@ export declare class DataController {
|
|
|
147
171
|
upload(params: UnencryptedUploadParams): Promise<UploadResult>;
|
|
148
172
|
upload(params: UploadParams): Promise<UploadResult>;
|
|
149
173
|
/**
|
|
150
|
-
*
|
|
174
|
+
* Encrypts data using wallet-derived encryption.
|
|
151
175
|
*
|
|
152
176
|
* @remarks
|
|
153
|
-
* This
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* decryption.
|
|
177
|
+
* This method provides secure, wallet-based encryption for data before uploading
|
|
178
|
+
* to the Vana network. It's the counterpart to decryptFile for preparing data
|
|
179
|
+
* for secure storage.
|
|
157
180
|
*
|
|
158
181
|
* The method automatically:
|
|
159
|
-
* - Generates
|
|
160
|
-
* -
|
|
161
|
-
* -
|
|
162
|
-
* -
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* @param
|
|
169
|
-
* @
|
|
170
|
-
* @
|
|
171
|
-
* @
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
182
|
+
* - Generates an encryption key from the user's wallet signature
|
|
183
|
+
* - Converts the input data to a Blob if necessary
|
|
184
|
+
* - Encrypts the data using the generated key
|
|
185
|
+
* - Returns both the encrypted data and the encryption key
|
|
186
|
+
*
|
|
187
|
+
* The encryption key returned can be stored and later used for decryption,
|
|
188
|
+
* or shared with others to grant them decryption access.
|
|
189
|
+
*
|
|
190
|
+
* @param data - The data to encrypt (Blob, string, or object)
|
|
191
|
+
* @param options - Optional encryption configuration
|
|
192
|
+
* @returns Promise resolving to encrypted data and the encryption key used
|
|
193
|
+
* @throws {Error} When wallet is not connected or encryption fails
|
|
194
|
+
* @example
|
|
195
|
+
* ```typescript
|
|
196
|
+
* // Encrypt a string
|
|
197
|
+
* const { encryptedData, encryptionKey } = await vana.data.encryptFile(
|
|
198
|
+
* "My secret data"
|
|
199
|
+
* );
|
|
200
|
+
*
|
|
201
|
+
* // Encrypt JSON with custom MIME type
|
|
202
|
+
* const { encryptedData, encryptionKey } = await vana.data.encryptFile(
|
|
203
|
+
* { name: "Alice", age: 30 },
|
|
204
|
+
* { mimeType: "application/json" }
|
|
205
|
+
* );
|
|
206
|
+
*
|
|
207
|
+
* // With custom encryption seed
|
|
208
|
+
* const { encryptedData, encryptionKey } = await vana.data.encryptFile(
|
|
209
|
+
* "Secret message",
|
|
210
|
+
* { seed: "My custom encryption seed" }
|
|
211
|
+
* );
|
|
212
|
+
*
|
|
213
|
+
* // Upload the encrypted data
|
|
214
|
+
* const result = await vana.data.uploadToStorage(encryptedData);
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
encryptFile(data: Blob | string | object, options?: EncryptFileOptions): Promise<EncryptFileResult>;
|
|
218
|
+
/**
|
|
219
|
+
* Decrypts a file using wallet-derived decryption key.
|
|
220
|
+
*
|
|
221
|
+
* @remarks
|
|
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.
|
|
245
|
+
*
|
|
179
246
|
* @example
|
|
180
247
|
* ```typescript
|
|
181
248
|
* // Basic file decryption
|
|
@@ -201,44 +268,47 @@ export declare class DataController {
|
|
|
201
268
|
* fs.writeFileSync('decrypted-file.txt', Buffer.from(buffer));
|
|
202
269
|
* ```
|
|
203
270
|
*/
|
|
204
|
-
decryptFile(file: UserFile,
|
|
271
|
+
decryptFile(file: UserFile, options?: DecryptFileOptions): Promise<Blob>;
|
|
205
272
|
/**
|
|
206
|
-
* Retrieves all
|
|
273
|
+
* Retrieves all files owned by a specific user address.
|
|
207
274
|
*
|
|
208
275
|
* @remarks
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
* @
|
|
220
|
-
*
|
|
221
|
-
* @
|
|
222
|
-
*
|
|
223
|
-
* @throws {Error}
|
|
224
|
-
*
|
|
225
|
-
* @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
|
+
*
|
|
226
295
|
* @example
|
|
227
296
|
* ```typescript
|
|
228
|
-
* // Query files for a specific user
|
|
229
297
|
* const files = await vana.data.getUserFiles({
|
|
230
|
-
* owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36"
|
|
298
|
+
* owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36"
|
|
231
299
|
* });
|
|
232
300
|
*
|
|
233
301
|
* files.forEach(file => {
|
|
234
|
-
* 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"}`);
|
|
235
305
|
* });
|
|
236
306
|
* ```
|
|
237
307
|
*/
|
|
238
308
|
getUserFiles(params: {
|
|
239
309
|
owner: Address;
|
|
240
310
|
subgraphUrl?: string;
|
|
241
|
-
}): Promise<UserFile[]>;
|
|
311
|
+
}, options?: ConsistencyOptions & PaginationOptions): Promise<UserFile[]>;
|
|
242
312
|
/**
|
|
243
313
|
* Fetches proof data for multiple files from the subgraph.
|
|
244
314
|
*
|
|
@@ -279,6 +349,8 @@ export declare class DataController {
|
|
|
279
349
|
*/
|
|
280
350
|
getDLP(dlpId: number, options?: {
|
|
281
351
|
subgraphUrl?: string;
|
|
352
|
+
minBlock?: number;
|
|
353
|
+
waitForSync?: number;
|
|
282
354
|
}): Promise<{
|
|
283
355
|
id: number;
|
|
284
356
|
name: string;
|
|
@@ -339,7 +411,7 @@ export declare class DataController {
|
|
|
339
411
|
getUserPermissions(params: {
|
|
340
412
|
user: Address;
|
|
341
413
|
subgraphUrl?: string;
|
|
342
|
-
}): Promise<Array<{
|
|
414
|
+
}, options?: ConsistencyOptions & PaginationOptions): Promise<Array<{
|
|
343
415
|
id: string;
|
|
344
416
|
grant: string;
|
|
345
417
|
nonce: bigint;
|
|
@@ -402,7 +474,7 @@ export declare class DataController {
|
|
|
402
474
|
* });
|
|
403
475
|
* ```
|
|
404
476
|
*/
|
|
405
|
-
getUserTrustedServers(params: GetUserTrustedServersParams): Promise<TrustedServer[]>;
|
|
477
|
+
getUserTrustedServers(params: GetUserTrustedServersParams, options?: ConsistencyOptions & PaginationOptions): Promise<TrustedServer[]>;
|
|
406
478
|
/**
|
|
407
479
|
* Internal method: Query trusted servers via subgraph
|
|
408
480
|
*
|
|
@@ -423,48 +495,56 @@ export declare class DataController {
|
|
|
423
495
|
*/
|
|
424
496
|
private _getUserTrustedServersViaRpc;
|
|
425
497
|
/**
|
|
426
|
-
*
|
|
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.
|
|
427
510
|
*
|
|
428
|
-
* @returns Promise resolving to the total file count
|
|
429
511
|
* @example
|
|
430
512
|
* ```typescript
|
|
431
|
-
* const
|
|
432
|
-
* console.log(`Total files
|
|
513
|
+
* const total = await vana.data.getTotalFilesCount();
|
|
514
|
+
* console.log(`Total files: ${total}`);
|
|
433
515
|
*
|
|
434
|
-
* //
|
|
435
|
-
* const
|
|
436
|
-
* const totalPages = Math.ceil(totalFiles / filesPerPage);
|
|
437
|
-
* console.log(`Total pages: ${totalPages}`);
|
|
516
|
+
* // Calculate pagination
|
|
517
|
+
* const pages = Math.ceil(total / 20);
|
|
438
518
|
* ```
|
|
439
519
|
*/
|
|
440
520
|
getTotalFilesCount(): Promise<number>;
|
|
441
521
|
/**
|
|
442
|
-
* 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.
|
|
443
539
|
*
|
|
444
|
-
* @param fileId - The file ID to look up
|
|
445
|
-
* @returns Promise resolving to UserFile object
|
|
446
|
-
* @throws {Error} "Chain ID not available" - When wallet chain is not configured
|
|
447
|
-
* @throws {Error} "File not found" - When file ID doesn't exist or returns empty data
|
|
448
|
-
* @throws {Error} "Failed to fetch file {fileId}: {error}" - General contract read failures
|
|
449
540
|
* @example
|
|
450
541
|
* ```typescript
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
* owner: file.ownerAddress,
|
|
457
|
-
* addedAt: file.addedAtBlock
|
|
458
|
-
* });
|
|
459
|
-
* } catch (error) {
|
|
460
|
-
* console.error('File not found or error retrieving file:', error);
|
|
461
|
-
* }
|
|
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}`);
|
|
462
547
|
* ```
|
|
463
|
-
*
|
|
464
|
-
* This method queries the DataRegistry contract directly
|
|
465
|
-
* to get file details for any file ID, regardless of user ownership.
|
|
466
|
-
* This is useful for file lookup functionality where users can search
|
|
467
|
-
* for specific files by ID.
|
|
468
548
|
*/
|
|
469
549
|
getFileById(fileId: number): Promise<UserFile>;
|
|
470
550
|
/**
|
|
@@ -490,14 +570,13 @@ export declare class DataController {
|
|
|
490
570
|
* console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
|
|
491
571
|
* ```
|
|
492
572
|
*/
|
|
493
|
-
registerFileWithSchema(url: string, schemaId: number): Promise<TransactionResult<"DataRegistry", "addFileWithSchema">>;
|
|
573
|
+
registerFileWithSchema(url: string, schemaId: number, options?: TransactionOptions): Promise<TransactionResult<"DataRegistry", "addFileWithSchema">>;
|
|
494
574
|
/**
|
|
495
575
|
* Gets the user's address from the wallet client.
|
|
496
576
|
*
|
|
497
577
|
* @returns Promise resolving to the user's wallet address
|
|
498
578
|
* @throws {Error} When no addresses are available in wallet client
|
|
499
579
|
*/
|
|
500
|
-
private getUserAddress;
|
|
501
580
|
/**
|
|
502
581
|
* Adds a file with permissions to the DataRegistry contract.
|
|
503
582
|
*
|
|
@@ -517,7 +596,7 @@ export declare class DataController {
|
|
|
517
596
|
addFileWithPermissions(url: string, ownerAddress: Address, permissions?: Array<{
|
|
518
597
|
account: Address;
|
|
519
598
|
key: string;
|
|
520
|
-
}
|
|
599
|
+
}>, options?: TransactionOptions): Promise<TransactionResult<"DataRegistry", "addFileWithPermissions">>;
|
|
521
600
|
/**
|
|
522
601
|
* Adds a file to the registry with permissions and schema.
|
|
523
602
|
* This combines the functionality of addFileWithPermissions and schema validation.
|
|
@@ -560,81 +639,131 @@ export declare class DataController {
|
|
|
560
639
|
addFileWithPermissionsAndSchema(url: string, ownerAddress: Address, permissions?: Array<{
|
|
561
640
|
account: Address;
|
|
562
641
|
publicKey: string;
|
|
563
|
-
}>, schemaId?: number): Promise<TransactionResult<"DataRegistry", "addFileWithPermissionsAndSchema">>;
|
|
642
|
+
}>, schemaId?: number, options?: TransactionOptions): Promise<TransactionResult<"DataRegistry", "addFileWithPermissionsAndSchema">>;
|
|
564
643
|
/**
|
|
565
|
-
*
|
|
566
|
-
*
|
|
644
|
+
* Adds a file with pre-encrypted permissions and schema to the DataRegistry.
|
|
645
|
+
*
|
|
646
|
+
* @remarks
|
|
647
|
+
* This method is designed for relay services and advanced use cases where permissions
|
|
648
|
+
* have already been encrypted client-side. Unlike `addFileWithPermissionsAndSchema()`,
|
|
649
|
+
* this method expects permissions in the encrypted format with a 'key' field instead
|
|
650
|
+
* of 'publicKey'.
|
|
651
|
+
*
|
|
652
|
+
* This is typically used by relay endpoints that receive pre-encrypted data from
|
|
653
|
+
* the client SDK's `upload()` method, avoiding double encryption.
|
|
654
|
+
*
|
|
655
|
+
* @param url - The storage URL of the file (e.g., IPFS URL)
|
|
656
|
+
* @param ownerAddress - The address that will own this file
|
|
657
|
+
* @param permissions - Array of pre-encrypted permissions with 'account' and 'key' fields
|
|
658
|
+
* @param schemaId - Optional schema ID for data validation (defaults to 0)
|
|
659
|
+
* @returns Promise resolving to transaction result with hash and contract details
|
|
660
|
+
* @throws {Error} When chain ID is not available
|
|
661
|
+
* @throws {Error} When wallet is not connected
|
|
662
|
+
* @throws {Error} When transaction fails
|
|
663
|
+
* @example
|
|
664
|
+
* ```typescript
|
|
665
|
+
* // In a relay endpoint that receives pre-encrypted permissions
|
|
666
|
+
* const result = await vana.data.addFileWithEncryptedPermissionsAndSchema(
|
|
667
|
+
* "ipfs://QmXxx...",
|
|
668
|
+
* ownerAddress,
|
|
669
|
+
* [
|
|
670
|
+
* {
|
|
671
|
+
* account: "0xServerAddress...",
|
|
672
|
+
* key: "encrypted_key_string" // Already encrypted by client
|
|
673
|
+
* }
|
|
674
|
+
* ],
|
|
675
|
+
* schemaId
|
|
676
|
+
* );
|
|
677
|
+
*
|
|
678
|
+
* console.log(`File registered in tx ${result.hash}`);
|
|
679
|
+
* ```
|
|
567
680
|
*/
|
|
568
|
-
|
|
681
|
+
addFileWithEncryptedPermissionsAndSchema(url: string, ownerAddress: Address, permissions?: Array<{
|
|
682
|
+
account: Address;
|
|
683
|
+
key: string;
|
|
684
|
+
}>, schemaId?: number, options?: TransactionOptions): Promise<TransactionResult<"DataRegistry", "addFileWithPermissionsAndSchema">>;
|
|
569
685
|
/**
|
|
570
|
-
*
|
|
686
|
+
* Registers a data refiner for processing templates.
|
|
571
687
|
*
|
|
572
688
|
* @remarks
|
|
573
|
-
* Refiners
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
* @param params - Refiner
|
|
579
|
-
* @param params.
|
|
580
|
-
*
|
|
581
|
-
* @param params.
|
|
582
|
-
*
|
|
583
|
-
* @returns
|
|
584
|
-
*
|
|
585
|
-
* @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
|
+
*
|
|
586
706
|
* @example
|
|
587
707
|
* ```typescript
|
|
588
708
|
* const result = await vana.data.addRefiner({
|
|
589
709
|
* dlpId: 1,
|
|
590
|
-
* name: "
|
|
710
|
+
* name: "Sentiment Analyzer",
|
|
591
711
|
* schemaId: 42,
|
|
592
712
|
* refinementInstructionUrl: "ipfs://QmXxx..."
|
|
593
713
|
* });
|
|
594
|
-
* console.log(`
|
|
714
|
+
* console.log(`Refiner ${result.refinerId} created`);
|
|
595
715
|
* ```
|
|
596
716
|
*/
|
|
597
|
-
addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
|
|
717
|
+
addRefiner(params: AddRefinerParams, options?: TransactionOptions): Promise<AddRefinerResult>;
|
|
598
718
|
/**
|
|
599
|
-
* Retrieves
|
|
719
|
+
* Retrieves refiner configuration by ID.
|
|
600
720
|
*
|
|
601
721
|
* @remarks
|
|
602
|
-
* Queries
|
|
603
|
-
*
|
|
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.
|
|
604
735
|
*
|
|
605
|
-
* @param refinerId - The numeric refiner ID to retrieve
|
|
606
|
-
* @returns Promise resolving to the refiner information object
|
|
607
|
-
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
608
|
-
* @throws {Error} When refiner doesn't exist - "Refiner with ID {refinerId} does not exist"
|
|
609
|
-
* @throws {Error} When contract read fails - "Failed to fetch refiner: {error}"
|
|
610
736
|
* @example
|
|
611
737
|
* ```typescript
|
|
612
738
|
* const refiner = await vana.data.getRefiner(1);
|
|
613
|
-
* console.log({
|
|
614
|
-
*
|
|
615
|
-
*
|
|
616
|
-
* schema: refiner.schemaId,
|
|
617
|
-
* instructions: refiner.refinementInstructionUrl
|
|
618
|
-
* });
|
|
739
|
+
* console.log(`Refiner: ${refiner.name}`);
|
|
740
|
+
* console.log(`DLP: ${refiner.dlpId}`);
|
|
741
|
+
* console.log(`Schema: ${refiner.schemaId}`);
|
|
619
742
|
* ```
|
|
620
743
|
*/
|
|
621
744
|
getRefiner(refinerId: number): Promise<Refiner>;
|
|
622
745
|
/**
|
|
623
|
-
* Validates
|
|
746
|
+
* Validates schema ID existence.
|
|
624
747
|
*
|
|
625
748
|
* @remarks
|
|
626
|
-
*
|
|
627
|
-
*
|
|
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.
|
|
628
760
|
*
|
|
629
|
-
* @param schemaId - The numeric schema ID to validate
|
|
630
|
-
* @returns Promise resolving to true if schema exists, false otherwise
|
|
631
761
|
* @example
|
|
632
762
|
* ```typescript
|
|
633
|
-
* const
|
|
634
|
-
* if (
|
|
635
|
-
*
|
|
636
|
-
*
|
|
637
|
-
* 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, ... });
|
|
638
767
|
* }
|
|
639
768
|
* ```
|
|
640
769
|
*/
|
|
@@ -676,7 +805,7 @@ export declare class DataController {
|
|
|
676
805
|
* console.log(`Schema updated in tx ${result.transactionHash}`);
|
|
677
806
|
* ```
|
|
678
807
|
*/
|
|
679
|
-
updateSchemaId(params: UpdateSchemaIdParams): Promise<UpdateSchemaIdResult>;
|
|
808
|
+
updateSchemaId(params: UpdateSchemaIdParams, options?: TransactionOptions): Promise<UpdateSchemaIdResult>;
|
|
680
809
|
/**
|
|
681
810
|
* Uploads an encrypted file and grants permission to a party with a public key.
|
|
682
811
|
*
|
|
@@ -686,16 +815,10 @@ export declare class DataController {
|
|
|
686
815
|
* 3. Encrypts the user's encryption key with the provided public key
|
|
687
816
|
* 4. Registers the file with permissions
|
|
688
817
|
*
|
|
689
|
-
* @param
|
|
690
|
-
* @param permissions - Array of permissions to grant, each with account address and public key
|
|
691
|
-
* @param filename - Optional filename for the upload
|
|
692
|
-
* @param providerName - Optional storage provider to use
|
|
818
|
+
* @param params - Upload parameters including data, permissions, and options
|
|
693
819
|
* @returns Promise resolving to upload result with file ID and storage URL
|
|
694
820
|
*/
|
|
695
|
-
uploadFileWithPermissions(
|
|
696
|
-
account: Address;
|
|
697
|
-
publicKey: string;
|
|
698
|
-
}>, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
|
|
821
|
+
uploadFileWithPermissions(params: UploadFileWithPermissionsParams): Promise<UploadEncryptedFileResult>;
|
|
699
822
|
/**
|
|
700
823
|
* Uploads content to storage without registering it on the blockchain.
|
|
701
824
|
* This method only handles the storage upload and returns the file URL.
|
|
@@ -719,21 +842,27 @@ export declare class DataController {
|
|
|
719
842
|
* For advanced users who need more control over transaction timing,
|
|
720
843
|
* use `submitFilePermission()` instead.
|
|
721
844
|
*
|
|
722
|
-
* @param
|
|
723
|
-
* @param
|
|
724
|
-
* @param
|
|
845
|
+
* @param params - Parameters for adding file permission
|
|
846
|
+
* @param params.fileId - The ID of the file to grant permission for
|
|
847
|
+
* @param params.account - The recipient's wallet address that will access the file
|
|
848
|
+
* @param params.publicKey - The recipient's public key for encryption.
|
|
849
|
+
* Obtain via `vana.server.getIdentity(account).publicKey`
|
|
725
850
|
* @returns Promise resolving to permission data from PermissionGranted event
|
|
726
851
|
* @throws {Error} "No addresses available in wallet client" - When wallet is not connected
|
|
727
852
|
* @throws {Error} "Chain ID not available" - When wallet chain is not configured
|
|
728
853
|
* @throws {Error} "Failed to add permission to file: {error}" - When transaction fails or user doesn't own file
|
|
729
854
|
* @example
|
|
730
855
|
* ```typescript
|
|
731
|
-
* const result = await vana.data.addPermissionToFile(
|
|
856
|
+
* const result = await vana.data.addPermissionToFile({
|
|
857
|
+
* fileId: 123,
|
|
858
|
+
* account: "0xRecipientAddress...",
|
|
859
|
+
* publicKey: "0xRecipientPublicKey..."
|
|
860
|
+
* });
|
|
732
861
|
* console.log(`Permission granted to ${result.account} for file ${result.fileId}`);
|
|
733
862
|
* console.log(`Transaction: ${result.transactionHash}`);
|
|
734
863
|
* ```
|
|
735
864
|
*/
|
|
736
|
-
addPermissionToFile(
|
|
865
|
+
addPermissionToFile(params: AddFilePermissionParams, options?: TransactionOptions): Promise<TransactionResult<"DataRegistry", "addFilePermission">>;
|
|
737
866
|
/**
|
|
738
867
|
* Submits a file permission transaction to the blockchain.
|
|
739
868
|
*
|
|
@@ -762,7 +891,7 @@ export declare class DataController {
|
|
|
762
891
|
* console.log(`Permission granted with ID: ${result.permissionId}`);
|
|
763
892
|
* ```
|
|
764
893
|
*/
|
|
765
|
-
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">>;
|
|
766
895
|
/**
|
|
767
896
|
* Gets the encrypted key for a specific account's permission to access a file.
|
|
768
897
|
*
|
|
@@ -781,10 +910,11 @@ export declare class DataController {
|
|
|
781
910
|
*
|
|
782
911
|
* @param file - The file to decrypt
|
|
783
912
|
* @param privateKey - The private key to decrypt the user's encryption key
|
|
784
|
-
* @param
|
|
913
|
+
* @param options - Optional decryption configuration
|
|
914
|
+
* @param options.account - The account address that has permission (defaults to current wallet account)
|
|
785
915
|
* @returns Promise resolving to the decrypted file data
|
|
786
916
|
*/
|
|
787
|
-
decryptFileWithPermission(file: UserFile, privateKey: string,
|
|
917
|
+
decryptFileWithPermission(file: UserFile, privateKey: string, options?: DecryptFileWithPermissionOptions): Promise<Blob>;
|
|
788
918
|
/**
|
|
789
919
|
* Simple network-agnostic fetch utility for retrieving file content.
|
|
790
920
|
*
|
|
@@ -929,4 +1059,9 @@ export declare class DataController {
|
|
|
929
1059
|
* ```
|
|
930
1060
|
*/
|
|
931
1061
|
fetchAndValidateSchema(url: string): Promise<DataSchema>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Polls for confirmation of a relayer operation.
|
|
1064
|
+
* @internal
|
|
1065
|
+
*/
|
|
1066
|
+
private pollRelayerForConfirmation;
|
|
932
1067
|
}
|