@opendatalabs/vana-sdk 0.1.0-alpha.e9cead7 → 0.1.0-alpha.eebb656
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 +13 -4
- package/dist/__tests__/waitForTransactionEvents.test.d.ts +1 -0
- package/dist/browser.cjs +29 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.ts +4 -1
- package/dist/browser.js +1 -305
- package/dist/browser.js.map +1 -1
- package/dist/{chains.browser.cjs → chains/definitions.cjs} +9 -13
- package/dist/chains/definitions.cjs.map +1 -0
- package/dist/{chains.browser.d.cts → chains/definitions.d.ts} +7 -11
- package/dist/chains/definitions.js +64 -0
- package/dist/chains/definitions.js.map +1 -0
- package/dist/chains/index.cjs +37 -0
- package/dist/chains/index.cjs.map +1 -0
- package/dist/chains/index.d.ts +5 -0
- package/dist/chains/index.js +15 -0
- package/dist/chains/index.js.map +1 -0
- package/dist/chains.browser.d.ts +5 -50
- package/dist/chains.browser.js +7 -57
- package/dist/chains.browser.js.map +1 -1
- package/dist/chains.cjs +6 -65
- package/dist/chains.cjs.map +1 -1
- package/dist/chains.d.ts +8 -2
- package/dist/chains.js +7 -57
- package/dist/chains.js.map +1 -1
- package/dist/chains.node.cjs +6 -65
- package/dist/chains.node.cjs.map +1 -1
- package/dist/chains.node.d.ts +8 -2
- package/dist/chains.node.js +7 -57
- package/dist/chains.node.js.map +1 -1
- package/dist/config/addresses.cjs +325 -0
- package/dist/config/addresses.cjs.map +1 -0
- package/dist/config/addresses.d.ts +364 -0
- package/dist/config/addresses.js +295 -0
- package/dist/config/addresses.js.map +1 -0
- package/dist/config/chains.cjs +93 -0
- package/dist/config/chains.cjs.map +1 -0
- package/dist/config/chains.d.ts +81 -0
- package/dist/config/chains.js +67 -0
- package/dist/config/chains.js.map +1 -0
- package/dist/config/features.cjs +52 -0
- package/dist/config/features.cjs.map +1 -0
- package/dist/config/features.d.ts +62 -0
- package/dist/config/features.js +28 -0
- package/dist/config/features.js.map +1 -0
- package/dist/config/tests/addresses.test.d.ts +1 -0
- package/dist/contracts/contractController.cjs +126 -0
- package/dist/contracts/contractController.cjs.map +1 -0
- package/dist/contracts/contractController.d.ts +79 -0
- package/dist/contracts/contractController.js +100 -0
- package/dist/contracts/contractController.js.map +1 -0
- package/dist/contracts/tests/contractController.test.d.ts +1 -0
- package/dist/controllers/__tests__/schemas-edge-cases.test.d.ts +1 -0
- package/dist/controllers/data-error-handling.test.d.ts +1 -0
- package/dist/controllers/data.cjs +2351 -0
- package/dist/controllers/data.cjs.map +1 -0
- package/dist/controllers/data.d.ts +932 -0
- package/dist/controllers/data.js +2334 -0
- package/dist/controllers/data.js.map +1 -0
- package/dist/controllers/permissions.cjs +3863 -0
- package/dist/controllers/permissions.cjs.map +1 -0
- package/dist/controllers/permissions.d.ts +1330 -0
- package/dist/controllers/permissions.js +3839 -0
- package/dist/controllers/permissions.js.map +1 -0
- package/dist/controllers/protocol.cjs +179 -0
- package/dist/controllers/protocol.cjs.map +1 -0
- package/dist/controllers/protocol.d.ts +139 -0
- package/dist/controllers/protocol.js +159 -0
- package/dist/controllers/protocol.js.map +1 -0
- package/dist/controllers/schemas.cjs +608 -0
- package/dist/controllers/schemas.cjs.map +1 -0
- package/dist/controllers/schemas.d.ts +246 -0
- package/dist/controllers/schemas.js +584 -0
- package/dist/controllers/schemas.js.map +1 -0
- package/dist/controllers/server-additional.test.d.ts +1 -0
- package/dist/controllers/server.cjs +427 -0
- package/dist/controllers/server.cjs.map +1 -0
- package/dist/controllers/server.d.ts +217 -0
- package/dist/controllers/server.js +408 -0
- package/dist/controllers/server.js.map +1 -0
- package/dist/core/apiClient.cjs +328 -0
- package/dist/core/apiClient.cjs.map +1 -0
- package/dist/core/apiClient.d.ts +161 -0
- package/dist/core/apiClient.js +309 -0
- package/dist/core/apiClient.js.map +1 -0
- package/dist/core/client.cjs +70 -0
- package/dist/core/client.cjs.map +1 -0
- package/dist/core/client.d.ts +89 -0
- package/dist/core/client.js +47 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/core.test.d.ts +1 -0
- package/dist/core/generics.cjs +390 -0
- package/dist/core/generics.cjs.map +1 -0
- package/dist/core/generics.d.ts +116 -0
- package/dist/core/generics.js +359 -0
- package/dist/core/generics.js.map +1 -0
- package/dist/core/tests/apiClient.test.d.ts +1 -0
- package/dist/core/tests/client.test.d.ts +1 -0
- package/dist/core/tests/generics.test.d.ts +1 -0
- package/dist/core.cjs +657 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.ts +440 -0
- package/dist/core.js +630 -0
- package/dist/core.js.map +1 -0
- package/dist/crypto/ecies/__tests__/base.test.d.ts +4 -0
- package/dist/crypto/ecies/__tests__/compatibility.test.d.ts +8 -0
- package/dist/crypto/ecies/__tests__/constants.test.d.ts +4 -0
- package/dist/crypto/ecies/__tests__/native-parity.test.d.ts +7 -0
- package/dist/crypto/ecies/__tests__/normalization.test.d.ts +1 -0
- package/dist/crypto/ecies/__tests__/test-vectors.cjs +102 -0
- package/dist/crypto/ecies/__tests__/test-vectors.cjs.map +1 -0
- package/dist/crypto/ecies/__tests__/test-vectors.d.ts +38 -0
- package/dist/crypto/ecies/__tests__/test-vectors.js +77 -0
- package/dist/crypto/ecies/__tests__/test-vectors.js.map +1 -0
- package/dist/crypto/ecies/base.cjs +232 -0
- package/dist/crypto/ecies/base.cjs.map +1 -0
- package/dist/crypto/ecies/base.d.ts +140 -0
- package/dist/crypto/ecies/base.js +208 -0
- package/dist/crypto/ecies/base.js.map +1 -0
- package/dist/crypto/ecies/browser.cjs +165 -0
- package/dist/crypto/ecies/browser.cjs.map +1 -0
- package/dist/crypto/ecies/browser.d.ts +43 -0
- package/dist/crypto/ecies/browser.js +131 -0
- package/dist/crypto/ecies/browser.js.map +1 -0
- package/dist/crypto/ecies/constants.cjs +131 -0
- package/dist/crypto/ecies/constants.cjs.map +1 -0
- package/dist/crypto/ecies/constants.d.ts +120 -0
- package/dist/crypto/ecies/constants.js +101 -0
- package/dist/crypto/ecies/constants.js.map +1 -0
- package/dist/crypto/ecies/index.cjs +35 -0
- package/dist/crypto/ecies/index.cjs.map +1 -0
- package/dist/crypto/ecies/index.d.ts +8 -0
- package/dist/crypto/ecies/index.js +13 -0
- package/dist/crypto/ecies/index.js.map +1 -0
- package/dist/crypto/ecies/interface.cjs +87 -0
- package/dist/crypto/ecies/interface.cjs.map +1 -0
- package/dist/crypto/ecies/interface.d.ts +174 -0
- package/dist/crypto/ecies/interface.js +60 -0
- package/dist/crypto/ecies/interface.js.map +1 -0
- package/dist/crypto/ecies/node.cjs +167 -0
- package/dist/crypto/ecies/node.cjs.map +1 -0
- package/dist/crypto/ecies/node.d.ts +45 -0
- package/dist/crypto/ecies/node.js +139 -0
- package/dist/crypto/ecies/node.js.map +1 -0
- package/dist/crypto/ecies/test-vectors/eccrypto-vectors.json +72 -0
- package/dist/crypto/ecies/utils.cjs +52 -0
- package/dist/crypto/ecies/utils.cjs.map +1 -0
- package/dist/crypto/ecies/utils.d.ts +30 -0
- package/dist/crypto/ecies/utils.js +26 -0
- package/dist/crypto/ecies/utils.js.map +1 -0
- package/dist/crypto/services/WalletKeyEncryptionService.cjs +128 -0
- package/dist/crypto/services/WalletKeyEncryptionService.cjs.map +1 -0
- package/dist/crypto/services/WalletKeyEncryptionService.d.ts +88 -0
- package/dist/crypto/services/WalletKeyEncryptionService.js +108 -0
- package/dist/crypto/services/WalletKeyEncryptionService.js.map +1 -0
- package/dist/crypto/services/WalletKeyEncryptionService.test.d.ts +1 -0
- package/dist/diagnostics.cjs +37 -0
- package/dist/diagnostics.cjs.map +1 -0
- package/dist/diagnostics.d.ts +24 -0
- package/dist/diagnostics.js +13 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/diagnostics.test.d.ts +1 -0
- package/dist/errors.cjs +141 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.ts +348 -0
- package/dist/errors.js +105 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/abi/ComputeEngineImplementation.cjs +1313 -0
- package/dist/generated/abi/ComputeEngineImplementation.cjs.map +1 -0
- package/dist/generated/abi/ComputeEngineImplementation.d.ts +995 -0
- package/dist/generated/abi/ComputeEngineImplementation.js +1289 -0
- package/dist/generated/abi/ComputeEngineImplementation.js.map +1 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs +734 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.d.ts +544 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.js +710 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/DATFactoryImplementation.cjs +882 -0
- package/dist/generated/abi/DATFactoryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DATFactoryImplementation.d.ts +660 -0
- package/dist/generated/abi/DATFactoryImplementation.js +858 -0
- package/dist/generated/abi/DATFactoryImplementation.js.map +1 -0
- package/dist/generated/abi/DATImplementation.cjs +934 -0
- package/dist/generated/abi/DATImplementation.cjs.map +1 -0
- package/dist/generated/abi/DATImplementation.d.ts +692 -0
- package/dist/generated/abi/DATImplementation.js +910 -0
- package/dist/generated/abi/DATImplementation.js.map +1 -0
- package/dist/generated/abi/DATPausableImplementation.cjs +1523 -0
- package/dist/generated/abi/DATPausableImplementation.cjs.map +1 -0
- package/dist/generated/abi/DATPausableImplementation.d.ts +1144 -0
- package/dist/generated/abi/DATPausableImplementation.js +1499 -0
- package/dist/generated/abi/DATPausableImplementation.js.map +1 -0
- package/dist/generated/abi/DATVotesImplementation.cjs +1460 -0
- package/dist/generated/abi/DATVotesImplementation.cjs.map +1 -0
- package/dist/generated/abi/DATVotesImplementation.d.ts +1094 -0
- package/dist/generated/abi/DATVotesImplementation.js +1436 -0
- package/dist/generated/abi/DATVotesImplementation.js.map +1 -0
- package/dist/generated/abi/DLPPerformanceImplementation.cjs +1160 -0
- package/dist/generated/abi/DLPPerformanceImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPPerformanceImplementation.d.ts +882 -0
- package/dist/generated/abi/DLPPerformanceImplementation.js +1136 -0
- package/dist/generated/abi/DLPPerformanceImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRegistryImplementation.cjs +1469 -0
- package/dist/generated/abi/DLPRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRegistryImplementation.d.ts +1122 -0
- package/dist/generated/abi/DLPRegistryImplementation.js +1445 -0
- package/dist/generated/abi/DLPRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.cjs +612 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.d.ts +451 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.js +588 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.cjs +948 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +713 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.js +924 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.cjs +612 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.d.ts +451 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.js +588 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.cjs +939 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.d.ts +705 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.js +915 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRootImplementation.cjs +1644 -0
- package/dist/generated/abi/DLPRootImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRootImplementation.d.ts +1246 -0
- package/dist/generated/abi/DLPRootImplementation.js +1620 -0
- package/dist/generated/abi/DLPRootImplementation.js.map +1 -0
- package/dist/generated/abi/DLPTreasuryImplementation.cjs +612 -0
- package/dist/generated/abi/DLPTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPTreasuryImplementation.d.ts +451 -0
- package/dist/generated/abi/DLPTreasuryImplementation.js +588 -0
- package/dist/generated/abi/DLPTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.cjs +985 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +735 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.js +961 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.js.map +1 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs +888 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.d.ts +660 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.js +864 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.js.map +1 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs +1317 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.ts +988 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.js +1293 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.js.map +1 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.cjs +1438 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.d.ts +1085 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.js +1414 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.js.map +1 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.cjs +984 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.d.ts +736 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.js +960 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/DataRegistryImplementation.cjs +1341 -0
- package/dist/generated/abi/DataRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataRegistryImplementation.d.ts +1013 -0
- package/dist/generated/abi/DataRegistryImplementation.js +1317 -0
- package/dist/generated/abi/DataRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/QueryEngineImplementation.cjs +1319 -0
- package/dist/generated/abi/QueryEngineImplementation.cjs.map +1 -0
- package/dist/generated/abi/QueryEngineImplementation.d.ts +1000 -0
- package/dist/generated/abi/QueryEngineImplementation.js +1295 -0
- package/dist/generated/abi/QueryEngineImplementation.js.map +1 -0
- package/dist/generated/abi/SwapHelperImplementation.cjs +1019 -0
- package/dist/generated/abi/SwapHelperImplementation.cjs.map +1 -0
- package/dist/generated/abi/SwapHelperImplementation.d.ts +763 -0
- package/dist/generated/abi/SwapHelperImplementation.js +995 -0
- package/dist/generated/abi/SwapHelperImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.d.ts +700 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.js +912 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.d.ts +700 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.js +912 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.d.ts +700 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.js +912 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolImplementation.cjs +1313 -0
- package/dist/generated/abi/TeePoolImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolImplementation.d.ts +992 -0
- package/dist/generated/abi/TeePoolImplementation.js +1289 -0
- package/dist/generated/abi/TeePoolImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.d.ts +700 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.js +912 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.d.ts +700 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.js +912 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.cjs +1313 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.d.ts +992 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.js +1289 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.js.map +1 -0
- package/dist/generated/abi/VanaEpochImplementation.cjs +1188 -0
- package/dist/generated/abi/VanaEpochImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaEpochImplementation.d.ts +899 -0
- package/dist/generated/abi/VanaEpochImplementation.js +1164 -0
- package/dist/generated/abi/VanaEpochImplementation.js.map +1 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.cjs +1234 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.d.ts +933 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.js +1210 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.js.map +1 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.cjs +921 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.d.ts +692 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.js +897 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.js.map +1 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.cjs +538 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.d.ts +393 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.js +514 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/index.cjs +177 -0
- package/dist/generated/abi/index.cjs.map +1 -0
- package/dist/{index.node.d.cts → generated/abi/index.d.ts} +26541 -37893
- package/dist/generated/abi/index.js +120 -0
- package/dist/generated/abi/index.js.map +1 -0
- package/dist/generated/event-types.cjs +17 -0
- package/dist/generated/event-types.cjs.map +1 -0
- package/dist/generated/event-types.d.ts +854 -0
- package/dist/generated/event-types.js +1 -0
- package/dist/generated/event-types.js.map +1 -0
- package/dist/generated/eventRegistry.cjs +3351 -0
- package/dist/generated/eventRegistry.cjs.map +1 -0
- package/dist/generated/eventRegistry.d.ts +14 -0
- package/dist/generated/eventRegistry.js +3326 -0
- package/dist/generated/eventRegistry.js.map +1 -0
- package/dist/generated/server/server-exports.cjs +23 -0
- package/dist/generated/server/server-exports.cjs.map +1 -0
- package/dist/generated/server/server-exports.d.ts +19 -0
- package/dist/generated/server/server-exports.js +2 -0
- package/dist/generated/server/server-exports.js.map +1 -0
- package/dist/generated/server/server.cjs +17 -0
- package/dist/generated/server/server.cjs.map +1 -0
- package/dist/generated/server/server.d.ts +538 -0
- package/dist/generated/server/server.js +1 -0
- package/dist/generated/server/server.js.map +1 -0
- package/dist/generated/subgraph.cjs +675 -0
- package/dist/generated/subgraph.cjs.map +1 -0
- package/dist/generated/subgraph.d.ts +5978 -0
- package/dist/generated/subgraph.js +644 -0
- package/dist/generated/subgraph.js.map +1 -0
- package/dist/index.browser.d.ts +45 -37628
- package/dist/index.browser.js +66 -47417
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/index.node.cjs +87 -47907
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +47 -37764
- package/dist/index.node.js +68 -47792
- package/dist/index.node.js.map +1 -1
- package/dist/node.cjs +2 -321
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +4 -1
- package/dist/node.js +1 -307
- package/dist/node.js.map +1 -1
- package/dist/platform/browser-only.cjs +37 -0
- package/dist/platform/browser-only.cjs.map +1 -0
- package/dist/platform/browser-only.d.ts +22 -0
- package/dist/platform/browser-only.js +12 -0
- package/dist/platform/browser-only.js.map +1 -0
- package/dist/platform/browser-only.test.d.ts +1 -0
- package/dist/platform/browser-safe.cjs +57 -0
- package/dist/platform/browser-safe.cjs.map +1 -0
- package/dist/platform/browser-safe.d.ts +29 -0
- package/dist/platform/browser-safe.js +31 -0
- package/dist/platform/browser-safe.js.map +1 -0
- package/dist/platform/browser-safe.test.d.ts +1 -0
- package/dist/platform/browser.cjs +330 -0
- package/dist/platform/browser.cjs.map +1 -0
- package/dist/platform/browser.d.ts +71 -0
- package/dist/platform/browser.js +296 -0
- package/dist/platform/browser.js.map +1 -0
- package/dist/platform/browser.test.d.ts +1 -0
- package/dist/platform/index.cjs +50 -0
- package/dist/platform/index.cjs.map +1 -0
- package/dist/platform/index.d.ts +11 -0
- package/dist/platform/index.js +27 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/interface.cjs +17 -0
- package/dist/platform/interface.cjs.map +1 -0
- package/dist/{node-D9-F9uEP.d.cts → platform/interface.d.ts} +6 -28
- package/dist/platform/interface.js +1 -0
- package/dist/platform/interface.js.map +1 -0
- package/dist/platform/node.cjs +351 -0
- package/dist/platform/node.cjs.map +1 -0
- package/dist/platform/node.d.ts +23 -0
- package/dist/platform/node.js +320 -0
- package/dist/platform/node.js.map +1 -0
- package/dist/platform/ports/openpgp-port.cjs +74 -0
- package/dist/platform/ports/openpgp-port.cjs.map +1 -0
- package/dist/platform/ports/openpgp-port.d.ts +13 -0
- package/dist/platform/ports/openpgp-port.js +59 -0
- package/dist/platform/ports/openpgp-port.js.map +1 -0
- package/dist/platform/ports/pgp-port.cjs +17 -0
- package/dist/platform/ports/pgp-port.cjs.map +1 -0
- package/dist/platform/ports/pgp-port.d.ts +35 -0
- package/dist/platform/ports/pgp-port.js +1 -0
- package/dist/platform/ports/pgp-port.js.map +1 -0
- package/dist/platform/shared/error-utils.cjs +43 -0
- package/dist/platform/shared/error-utils.cjs.map +1 -0
- package/dist/platform/shared/error-utils.d.ts +23 -0
- package/dist/platform/shared/error-utils.js +18 -0
- package/dist/platform/shared/error-utils.js.map +1 -0
- package/dist/platform/shared/pgp-utils.cjs +55 -0
- package/dist/platform/shared/pgp-utils.cjs.map +1 -0
- package/dist/platform/shared/pgp-utils.d.ts +59 -0
- package/dist/platform/shared/pgp-utils.js +29 -0
- package/dist/platform/shared/pgp-utils.js.map +1 -0
- package/dist/platform/shared/stream-utils.cjs +49 -0
- package/dist/platform/shared/stream-utils.cjs.map +1 -0
- package/dist/platform/shared/stream-utils.d.ts +14 -0
- package/dist/platform/shared/stream-utils.js +25 -0
- package/dist/platform/shared/stream-utils.js.map +1 -0
- package/dist/platform/utils.cjs +114 -0
- package/dist/platform/utils.cjs.map +1 -0
- package/dist/platform/utils.d.ts +49 -0
- package/dist/platform/utils.js +76 -0
- package/dist/platform/utils.js.map +1 -0
- package/dist/platform/utils.test.d.ts +1 -0
- package/dist/platform.browser.d.ts +6 -57
- package/dist/platform.browser.js +10 -379
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.cjs +14 -708
- package/dist/platform.cjs.map +1 -1
- package/dist/platform.d.ts +11 -2
- package/dist/platform.js +14 -694
- package/dist/platform.js.map +1 -1
- package/dist/platform.node.cjs +14 -708
- package/dist/platform.node.cjs.map +1 -1
- package/dist/platform.node.d.ts +7 -102
- package/dist/platform.node.js +14 -694
- package/dist/platform.node.js.map +1 -1
- package/dist/schemas/dataSchema.schema.json +53 -0
- package/dist/schemas/grantFile.schema.json +43 -0
- package/dist/server/handler.cjs +101 -0
- package/dist/server/handler.cjs.map +1 -0
- package/dist/server/handler.d.ts +87 -0
- package/dist/server/handler.js +77 -0
- package/dist/server/handler.js.map +1 -0
- package/dist/storage/index.cjs +44 -0
- package/dist/storage/index.cjs.map +1 -0
- package/dist/storage/index.d.ts +56 -0
- package/dist/storage/index.js +15 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/manager.cjs +189 -0
- package/dist/storage/manager.cjs.map +1 -0
- package/dist/storage/manager.d.ts +147 -0
- package/dist/storage/manager.js +165 -0
- package/dist/storage/manager.js.map +1 -0
- package/dist/storage/providers/callback-storage.cjs +177 -0
- package/dist/storage/providers/callback-storage.cjs.map +1 -0
- package/dist/storage/providers/callback-storage.d.ts +94 -0
- package/dist/storage/providers/callback-storage.js +155 -0
- package/dist/storage/providers/callback-storage.js.map +1 -0
- package/dist/storage/providers/google-drive.cjs +516 -0
- package/dist/storage/providers/google-drive.cjs.map +1 -0
- package/dist/storage/providers/google-drive.d.ts +152 -0
- package/dist/storage/providers/google-drive.js +494 -0
- package/dist/storage/providers/google-drive.js.map +1 -0
- package/dist/storage/providers/google-drive.test.d.ts +1 -0
- package/dist/storage/providers/ipfs.cjs +283 -0
- package/dist/storage/providers/ipfs.cjs.map +1 -0
- package/dist/storage/providers/ipfs.d.ts +160 -0
- package/dist/storage/providers/ipfs.js +261 -0
- package/dist/storage/providers/ipfs.js.map +1 -0
- package/dist/storage/providers/pinata.cjs +339 -0
- package/dist/storage/providers/pinata.cjs.map +1 -0
- package/dist/storage/providers/pinata.d.ts +170 -0
- package/dist/storage/providers/pinata.js +317 -0
- package/dist/storage/providers/pinata.js.map +1 -0
- package/dist/storage/tests/callbackStorage.test.d.ts +1 -0
- package/dist/storage/tests/googleDriveStorage.test.d.ts +1 -0
- package/dist/storage/tests/ipfsStorage.test.d.ts +1 -0
- package/dist/storage/tests/pinataStorage.test.d.ts +1 -0
- package/dist/storage/tests/storageManager.test.d.ts +1 -0
- package/dist/tests/abi.test.d.ts +1 -0
- package/dist/tests/chains-definitions.test.d.ts +1 -0
- package/dist/tests/core-encryption.test.d.ts +1 -0
- package/dist/tests/core-extended.test.d.ts +1 -0
- package/dist/tests/core-generics-coverage.test.d.ts +1 -0
- package/dist/tests/coverage-boost.test.d.ts +1 -0
- package/dist/tests/crypto-cross-platform-compatibility.test.d.ts +1 -0
- package/dist/tests/data-addfile-permissions-schema.test.d.ts +1 -0
- package/dist/tests/data-additional-methods.test.d.ts +1 -0
- package/dist/tests/data-controller-edge-cases.test.d.ts +1 -0
- package/dist/tests/data-ipfs-gateways.test.d.ts +1 -0
- package/dist/tests/data-relayer.test.d.ts +1 -0
- package/dist/tests/data-schema-validation.test.d.ts +1 -0
- package/dist/tests/data-simple-methods.test.d.ts +1 -0
- package/dist/tests/data.test.d.ts +1 -0
- package/dist/tests/demo-integration.test.d.ts +1 -0
- package/dist/tests/demo-trusted-server-integration.test.d.ts +1 -0
- package/dist/tests/download-relayer.test.d.ts +1 -0
- package/dist/tests/dual-mode-permissions.test.d.ts +1 -0
- package/dist/tests/dual-mode-trusted-servers.test.d.ts +1 -0
- package/dist/tests/encryption-correct-implementation.test.d.ts +1 -0
- package/dist/tests/encryption-coverage.test.d.ts +1 -0
- package/dist/tests/encryption-edge-cases.test.d.ts +1 -0
- package/dist/tests/encryption-utils-updated.test.d.ts +1 -0
- package/dist/tests/errors-coverage.test.d.ts +1 -0
- package/dist/tests/errors.test.d.ts +1 -0
- package/dist/tests/factories/mockFactory.d.ts +316 -0
- package/dist/tests/fakes/FakeStorageManager.d.ts +200 -0
- package/dist/tests/fakes/FakeStorageManager.test.d.ts +1 -0
- package/dist/tests/fakes/FakeWaitForTransactionEvents.d.ts +170 -0
- package/dist/tests/fakes/FakeWaitForTransactionEvents.test.d.ts +1 -0
- package/dist/tests/fakes/fake-pgp-port.d.ts +13 -0
- package/dist/tests/grantValidation-edge-cases.test.d.ts +1 -0
- package/dist/tests/grantValidation-unreachable-branch.test.d.ts +1 -0
- package/dist/tests/helper-methods.test.d.ts +1 -0
- package/dist/tests/helpers/platformTestHelpers.d.ts +106 -0
- package/dist/tests/helpers/typedMocks.d.ts +64 -0
- package/dist/tests/index-browser.test.d.ts +1 -0
- package/dist/tests/index-node.test.d.ts +1 -0
- package/dist/tests/index.test.d.ts +1 -0
- package/dist/tests/mocks/platformAdapter.d.ts +12 -0
- package/dist/tests/new-permissions-methods.test.d.ts +1 -0
- package/dist/tests/no-buffer-browser.test.d.ts +1 -0
- package/dist/tests/permissions-grantee.test.d.ts +1 -0
- package/dist/tests/permissions-schema-validation.test.d.ts +1 -0
- package/dist/tests/permissions-server-files.test.d.ts +1 -0
- package/dist/tests/permissions-trust-servers.test.d.ts +1 -0
- package/dist/tests/permissions.test.d.ts +1 -0
- package/dist/tests/personal.test.d.ts +1 -0
- package/dist/tests/platform-browser.test.d.ts +1 -0
- package/dist/tests/platform-crypto-expanded.test.d.ts +1 -0
- package/dist/tests/platform-crypto.test.d.ts +1 -0
- package/dist/tests/platform-index.test.d.ts +1 -0
- package/dist/tests/platform-node.test.d.ts +1 -0
- package/dist/tests/platform-shared-utils.test.d.ts +1 -0
- package/dist/tests/platform-updated.test.d.ts +1 -0
- package/dist/tests/protocol-additional-methods.test.d.ts +1 -0
- package/dist/tests/protocol.test.d.ts +1 -0
- package/dist/tests/schemas.test.d.ts +1 -0
- package/dist/tests/server-handler.test.d.ts +1 -0
- package/dist/tests/setup.d.ts +7 -0
- package/dist/tests/signatureFormatter.test.d.ts +1 -0
- package/dist/tests/trusted-server-queries.test.d.ts +1 -0
- package/dist/tests/typedDataConverter.test.d.ts +1 -0
- package/dist/tests/types-contracts.test.d.ts +1 -0
- package/dist/tests/types-data.test.d.ts +1 -0
- package/dist/tests/types-external-apis.test.d.ts +1 -0
- package/dist/tests/types-generics.test.d.ts +1 -0
- package/dist/tests/types-permissions.test.d.ts +1 -0
- package/dist/tests/types-upload-params.test.d.ts +1 -0
- package/dist/tests/types.test.d.ts +1 -0
- package/dist/tests/utils-formatters.test.d.ts +1 -0
- package/dist/tests/utils-grantFiles-edge-cases.test.d.ts +1 -0
- package/dist/tests/utils-grantFiles-validation.test.d.ts +1 -0
- package/dist/tests/utils-grantFiles.test.d.ts +1 -0
- package/dist/tests/utils-grantValidation-consolidated.test.d.ts +1 -0
- package/dist/tests/utils-grants.test.d.ts +1 -0
- package/dist/tests/utils-ipfs-additional.test.d.ts +1 -0
- package/dist/tests/utils-ipfs.test.d.ts +4 -0
- package/dist/tests/utils-schemaValidation.test.d.ts +1 -0
- package/dist/tests/vana.test.d.ts +1 -0
- package/dist/tests/wallet-crypto-compatibility.test.d.ts +1 -0
- package/dist/types/blockchain.cjs +17 -0
- package/dist/types/blockchain.cjs.map +1 -0
- package/dist/types/blockchain.d.ts +57 -0
- package/dist/types/blockchain.js +1 -0
- package/dist/types/blockchain.js.map +1 -0
- package/dist/types/chains-additional.test.d.ts +1 -0
- package/dist/types/chains.cjs +36 -0
- package/dist/types/chains.cjs.map +1 -0
- package/dist/types/chains.d.ts +31 -0
- package/dist/types/chains.js +11 -0
- package/dist/types/chains.js.map +1 -0
- package/dist/types/config.cjs +41 -0
- package/dist/types/config.cjs.map +1 -0
- package/dist/types/config.d.ts +723 -0
- package/dist/types/config.js +15 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/contracts.cjs +17 -0
- package/dist/types/contracts.cjs.map +1 -0
- package/dist/types/contracts.d.ts +65 -0
- package/dist/types/contracts.js +1 -0
- package/dist/types/contracts.js.map +1 -0
- package/dist/types/controller-context.cjs +17 -0
- package/dist/types/controller-context.cjs.map +1 -0
- package/dist/types/controller-context.d.ts +62 -0
- package/dist/types/controller-context.js +1 -0
- package/dist/types/controller-context.js.map +1 -0
- package/dist/types/data.cjs +17 -0
- package/dist/types/data.cjs.map +1 -0
- package/dist/types/data.d.ts +691 -0
- package/dist/types/data.js +1 -0
- package/dist/types/data.js.map +1 -0
- package/dist/types/eccrypto-js.d.cjs +2 -0
- package/dist/types/eccrypto-js.d.cjs.map +1 -0
- package/dist/types/eccrypto-js.d.js +1 -0
- package/dist/types/eccrypto-js.d.js.map +1 -0
- package/dist/types/external-apis.cjs +61 -0
- package/dist/types/external-apis.cjs.map +1 -0
- package/dist/types/external-apis.d.ts +184 -0
- package/dist/types/external-apis.js +34 -0
- package/dist/types/external-apis.js.map +1 -0
- package/dist/types/generics.cjs +17 -0
- package/dist/types/generics.cjs.map +1 -0
- package/dist/types/generics.d.ts +447 -0
- package/dist/types/generics.js +1 -0
- package/dist/types/generics.js.map +1 -0
- package/dist/types/index.cjs +61 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/index.js +34 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/operations.cjs +65 -0
- package/dist/types/operations.cjs.map +1 -0
- package/dist/types/operations.d.ts +112 -0
- package/dist/types/operations.js +37 -0
- package/dist/types/operations.js.map +1 -0
- package/dist/types/permissions.cjs +17 -0
- package/dist/types/permissions.cjs.map +1 -0
- package/dist/types/permissions.d.ts +954 -0
- package/dist/types/permissions.js +1 -0
- package/dist/types/permissions.js.map +1 -0
- package/dist/types/personal.cjs +17 -0
- package/dist/types/personal.cjs.map +1 -0
- package/dist/types/personal.d.ts +38 -0
- package/dist/types/personal.js +1 -0
- package/dist/types/personal.js.map +1 -0
- package/dist/types/relayer.cjs +17 -0
- package/dist/types/relayer.cjs.map +1 -0
- package/dist/types/relayer.d.ts +281 -0
- package/dist/types/relayer.js +1 -0
- package/dist/types/relayer.js.map +1 -0
- package/dist/types/storage.cjs +39 -0
- package/dist/types/storage.cjs.map +1 -0
- package/dist/types/storage.d.ts +129 -0
- package/dist/types/storage.js +15 -0
- package/dist/types/storage.js.map +1 -0
- package/dist/types/transactionResults.cjs +17 -0
- package/dist/types/transactionResults.cjs.map +1 -0
- package/dist/types/transactionResults.d.ts +193 -0
- package/dist/types/transactionResults.js +1 -0
- package/dist/types/transactionResults.js.map +1 -0
- package/dist/types/utils.cjs +17 -0
- package/dist/types/utils.cjs.map +1 -0
- package/dist/types/utils.d.ts +816 -0
- package/dist/types/utils.js +1 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/types.cjs +23 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.ts +30 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/__tests__/parseTransaction.test.d.ts +1 -0
- package/dist/utils/__tests__/pojo-serialization.test.d.ts +1 -0
- package/dist/utils/__tests__/signatureCache.test.d.ts +1 -0
- package/dist/utils/__tests__/transaction-edge-cases.test.d.ts +1 -0
- package/dist/utils/__tests__/transactionHelpers.test.d.ts +1 -0
- package/dist/utils/__tests__/urlResolver.test.d.ts +4 -0
- package/dist/utils/blockchain/registry.cjs +81 -0
- package/dist/utils/blockchain/registry.cjs.map +1 -0
- package/dist/utils/blockchain/registry.d.ts +32 -0
- package/dist/utils/blockchain/registry.js +56 -0
- package/dist/utils/blockchain/registry.js.map +1 -0
- package/dist/utils/blockchain/registry.test.d.ts +1 -0
- package/dist/utils/crypto-utils.cjs +108 -0
- package/dist/utils/crypto-utils.cjs.map +1 -0
- package/dist/utils/crypto-utils.d.ts +100 -0
- package/dist/utils/crypto-utils.js +76 -0
- package/dist/utils/crypto-utils.js.map +1 -0
- package/dist/utils/crypto-utils.test.d.ts +1 -0
- package/dist/utils/download.cjs +69 -0
- package/dist/utils/download.cjs.map +1 -0
- package/dist/utils/download.d.ts +40 -0
- package/dist/utils/download.js +45 -0
- package/dist/utils/download.js.map +1 -0
- package/dist/utils/encoding.cjs +66 -0
- package/dist/utils/encoding.cjs.map +1 -0
- package/dist/utils/encoding.d.ts +52 -0
- package/dist/utils/encoding.js +39 -0
- package/dist/utils/encoding.js.map +1 -0
- package/dist/utils/encoding.test.d.ts +1 -0
- package/dist/utils/encryption.cjs +176 -0
- package/dist/utils/encryption.cjs.map +1 -0
- package/dist/utils/encryption.d.ts +271 -0
- package/dist/utils/encryption.js +142 -0
- package/dist/utils/encryption.js.map +1 -0
- package/dist/utils/formatters.cjs +55 -0
- package/dist/utils/formatters.cjs.map +1 -0
- package/dist/utils/formatters.d.ts +118 -0
- package/dist/utils/formatters.js +28 -0
- package/dist/utils/formatters.js.map +1 -0
- package/dist/utils/grantFiles.cjs +178 -0
- package/dist/utils/grantFiles.cjs.map +1 -0
- package/dist/utils/grantFiles.d.ts +182 -0
- package/dist/utils/grantFiles.js +140 -0
- package/dist/utils/grantFiles.js.map +1 -0
- package/dist/utils/grantValidation.cjs +243 -0
- package/dist/utils/grantValidation.cjs.map +1 -0
- package/dist/utils/grantValidation.d.ts +147 -0
- package/dist/utils/grantValidation.js +201 -0
- package/dist/utils/grantValidation.js.map +1 -0
- package/dist/utils/grants.cjs +108 -0
- package/dist/utils/grants.cjs.map +1 -0
- package/dist/utils/grants.d.ts +67 -0
- package/dist/utils/grants.js +82 -0
- package/dist/utils/grants.js.map +1 -0
- package/dist/utils/ipfs.cjs +130 -0
- package/dist/utils/ipfs.cjs.map +1 -0
- package/dist/utils/ipfs.d.ts +88 -0
- package/dist/utils/ipfs.js +99 -0
- package/dist/utils/ipfs.js.map +1 -0
- package/dist/utils/lazy-import.cjs +38 -0
- package/dist/utils/lazy-import.cjs.map +1 -0
- package/dist/utils/lazy-import.d.ts +18 -0
- package/dist/utils/lazy-import.js +14 -0
- package/dist/utils/lazy-import.js.map +1 -0
- package/dist/utils/multicall.cjs +233 -0
- package/dist/utils/multicall.cjs.map +1 -0
- package/dist/utils/multicall.d.ts +126 -0
- package/dist/utils/multicall.js +208 -0
- package/dist/utils/multicall.js.map +1 -0
- package/dist/utils/parseTransactionPojo.cjs +87 -0
- package/dist/utils/parseTransactionPojo.cjs.map +1 -0
- package/dist/utils/parseTransactionPojo.d.ts +31 -0
- package/dist/utils/parseTransactionPojo.js +63 -0
- package/dist/utils/parseTransactionPojo.js.map +1 -0
- package/dist/utils/schemaValidation.cjs +258 -0
- package/dist/utils/schemaValidation.cjs.map +1 -0
- package/dist/utils/schemaValidation.d.ts +168 -0
- package/dist/utils/schemaValidation.js +219 -0
- package/dist/utils/schemaValidation.js.map +1 -0
- package/dist/utils/signatureCache.cjs +186 -0
- package/dist/utils/signatureCache.cjs.map +1 -0
- package/dist/utils/signatureCache.d.ts +131 -0
- package/dist/utils/signatureCache.js +161 -0
- package/dist/utils/signatureCache.js.map +1 -0
- package/dist/utils/signatureFormatter.cjs +42 -0
- package/dist/utils/signatureFormatter.cjs.map +1 -0
- package/dist/utils/signatureFormatter.d.ts +36 -0
- package/dist/utils/signatureFormatter.js +18 -0
- package/dist/utils/signatureFormatter.js.map +1 -0
- package/dist/utils/tests/multicall.test.d.ts +1 -0
- package/dist/utils/transactionHelpers.cjs +54 -0
- package/dist/utils/transactionHelpers.cjs.map +1 -0
- package/dist/utils/transactionHelpers.d.ts +80 -0
- package/dist/utils/transactionHelpers.js +29 -0
- package/dist/utils/transactionHelpers.js.map +1 -0
- package/dist/utils/typeGuards.cjs +109 -0
- package/dist/utils/typeGuards.cjs.map +1 -0
- package/dist/utils/typeGuards.d.ts +138 -0
- package/dist/utils/typeGuards.js +74 -0
- package/dist/utils/typeGuards.js.map +1 -0
- package/dist/utils/typedDataConverter.cjs +43 -0
- package/dist/utils/typedDataConverter.cjs.map +1 -0
- package/dist/utils/typedDataConverter.d.ts +10 -0
- package/dist/utils/typedDataConverter.js +19 -0
- package/dist/utils/typedDataConverter.js.map +1 -0
- package/dist/utils/urlResolver.cjs +55 -0
- package/dist/utils/urlResolver.cjs.map +1 -0
- package/dist/utils/urlResolver.d.ts +38 -0
- package/dist/utils/urlResolver.js +30 -0
- package/dist/utils/urlResolver.js.map +1 -0
- package/dist/utils/withEvents.cjs +44 -0
- package/dist/utils/withEvents.cjs.map +1 -0
- package/dist/utils/withEvents.d.ts +56 -0
- package/dist/utils/withEvents.js +18 -0
- package/dist/utils/withEvents.js.map +1 -0
- package/package.json +61 -29
- package/dist/browser-DY8XDblx.d.ts +0 -241
- package/dist/chains.browser.cjs.map +0 -1
- package/dist/chains.d.cts +0 -2
- package/dist/chains.node.d.cts +0 -2
- package/dist/index.d.cts +0 -2
- package/dist/node-D9-F9uEP.d.ts +0 -238
- package/dist/node.d.cts +0 -1
- package/dist/platform.d.cts +0 -2
- package/dist/platform.node.d.cts +0 -105
|
@@ -0,0 +1,932 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
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";
|
|
5
|
+
import type { ControllerContext } from "./permissions";
|
|
6
|
+
import { type DataSchema } from "../utils/schemaValidation";
|
|
7
|
+
/**
|
|
8
|
+
* Manages encrypted user data files and their blockchain registration on the Vana network.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This controller handles the complete file lifecycle from encrypted upload to
|
|
12
|
+
* blockchain registration and decryption. It provides methods for querying user files,
|
|
13
|
+
* uploading new encrypted content, managing file schemas, and handling permissions for
|
|
14
|
+
* secure data sharing. All operations respect the user's privacy through client-side
|
|
15
|
+
* encryption before any data leaves the user's device.
|
|
16
|
+
*
|
|
17
|
+
* The controller integrates with multiple storage providers (IPFS, Pinata, Google Drive)
|
|
18
|
+
* and supports both gasless transactions via relayers and direct blockchain interaction.
|
|
19
|
+
* File metadata and access permissions are stored on the Vana blockchain while encrypted
|
|
20
|
+
* file content is stored on decentralized storage networks.
|
|
21
|
+
*
|
|
22
|
+
* **Method Selection:**
|
|
23
|
+
* - `upload()` handles encryption, storage, and blockchain registration automatically
|
|
24
|
+
* - `getUserFiles()` queries existing file metadata from blockchain and subgraph
|
|
25
|
+
* - `decryptFile()` decrypts files for which you have access permissions
|
|
26
|
+
* - `getFileById()` retrieves specific file metadata when you have the file ID
|
|
27
|
+
*
|
|
28
|
+
* **Storage Requirements:**
|
|
29
|
+
* Methods requiring storage configuration: `upload()`
|
|
30
|
+
* Methods working without storage: `getUserFiles()`, `decryptFile()`, `getFileById()`
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // Upload an encrypted file with automatic schema validation
|
|
34
|
+
* const result = await vana.data.upload({
|
|
35
|
+
* content: "My personal data",
|
|
36
|
+
* filename: "personal-data.json"
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* // Query files owned by a user
|
|
40
|
+
* const files = await vana.data.getUserFiles({
|
|
41
|
+
* owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* // Decrypt accessible file content
|
|
45
|
+
* const decryptedData = await vana.data.decryptFile(files[0]);
|
|
46
|
+
* ```
|
|
47
|
+
* @category Data Management
|
|
48
|
+
* @see {@link https://docs.vana.com/developer/data-registry | Vana Data Registry Documentation} for conceptual overview
|
|
49
|
+
*/
|
|
50
|
+
export declare class DataController {
|
|
51
|
+
private readonly context;
|
|
52
|
+
constructor(context: ControllerContext);
|
|
53
|
+
/**
|
|
54
|
+
* Uploads user data with automatic encryption and blockchain registration.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* This is the primary method for uploading user data to the Vana network. It handles
|
|
58
|
+
* the complete workflow including content normalization, schema validation, encryption,
|
|
59
|
+
* storage upload, file permission granting, and blockchain registration.
|
|
60
|
+
*
|
|
61
|
+
* The method automatically:
|
|
62
|
+
* - Normalizes input content to a Blob
|
|
63
|
+
* - Validates data against schema if provided
|
|
64
|
+
* - Generates encryption keys and encrypts the data
|
|
65
|
+
* - Uploads to the configured storage provider
|
|
66
|
+
* - Grants file decryption permissions to specified accounts
|
|
67
|
+
* - Registers the file on the blockchain
|
|
68
|
+
*
|
|
69
|
+
* **TypeScript Overloads:**
|
|
70
|
+
* This method has three overloads to ensure type safety:
|
|
71
|
+
* 1. `EncryptedUploadParams` - When `encrypt: true` (default), permissions require publicKey
|
|
72
|
+
* 2. `UnencryptedUploadParams` - When `encrypt: false`, permissions are optional
|
|
73
|
+
* 3. `UploadParams` - General signature for runtime determination
|
|
74
|
+
*
|
|
75
|
+
* IMPORTANT: The permissions parameter only grants decryption access to the file.
|
|
76
|
+
* To grant operation permissions (like "llm_inference"), use vana.permissions.grant()
|
|
77
|
+
* after uploading. This separation ensures clear distinction between:
|
|
78
|
+
* - File permissions: Who can decrypt and read the encrypted file (handled here)
|
|
79
|
+
* - Operation permissions: What operations can be performed on the data (handled separately)
|
|
80
|
+
*
|
|
81
|
+
* @param params - Upload parameters including content, filename, schema, and permissions
|
|
82
|
+
* @param params.permissions - Optional array of file permissions for granting decryption access
|
|
83
|
+
* @param params.schemaId - Optional schema ID for data validation. Get available schemas from `vana.schemas.list()`.
|
|
84
|
+
* @param params.owner - Optional owner address if uploading on behalf of another user (requires delegation).
|
|
85
|
+
* @returns Promise resolving to upload results with file ID and transaction hash
|
|
86
|
+
* @throws {Error} When storage manager is not configured - "Storage manager not configured. Please provide storage providers in VanaConfig."
|
|
87
|
+
* @throws {Error} When no wallet addresses available - "No addresses available in wallet client"
|
|
88
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
89
|
+
* @throws {Error} When relay callback doesn't support required features - "The configured relay callback does not support schemas or permissions"
|
|
90
|
+
* @throws {Error} When schema fetch fails - "Failed to fetch schema definition: {status}"
|
|
91
|
+
* @throws {SchemaValidationError} When data doesn't match schema - includes specific validation errors
|
|
92
|
+
* @throws {Error} General upload failures - "Upload failed: {specific error message}"
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* // Basic file upload
|
|
96
|
+
* const result = await vana.data.upload({
|
|
97
|
+
* content: "My personal data",
|
|
98
|
+
* filename: "diary.txt"
|
|
99
|
+
* });
|
|
100
|
+
*
|
|
101
|
+
* // Upload with schema validation
|
|
102
|
+
* const result = await vana.data.upload({
|
|
103
|
+
* content: { name: "John", age: 30 },
|
|
104
|
+
* filename: "profile.json",
|
|
105
|
+
* schemaId: 1
|
|
106
|
+
* });
|
|
107
|
+
*
|
|
108
|
+
* // Upload with file permissions (for decryption access)
|
|
109
|
+
* const result = await vana.data.upload({
|
|
110
|
+
* content: "Data for AI analysis",
|
|
111
|
+
* filename: "analysis.txt",
|
|
112
|
+
* permissions: [{
|
|
113
|
+
* account: "0x1234...", // Server address that can decrypt
|
|
114
|
+
* publicKey: "0x04..." // Server's public key for encryption
|
|
115
|
+
* }]
|
|
116
|
+
* });
|
|
117
|
+
*
|
|
118
|
+
* // After upload, grant operation permissions separately:
|
|
119
|
+
* // await vana.permissions.grant({
|
|
120
|
+
* // grantee: "0x1234...",
|
|
121
|
+
* // fileIds: [result.fileId],
|
|
122
|
+
* // operation: "llm_inference",
|
|
123
|
+
* // parameters: { model: "gpt-4" }
|
|
124
|
+
* // });
|
|
125
|
+
*
|
|
126
|
+
* // Upload without encryption (public data)
|
|
127
|
+
* // Note: Cast to UnencryptedUploadParams for TypeScript
|
|
128
|
+
* const result = await vana.data.upload({
|
|
129
|
+
* content: "Public data",
|
|
130
|
+
* filename: "public.txt",
|
|
131
|
+
* encrypt: false
|
|
132
|
+
* } as const); // 'as const' ensures TypeScript infers encrypt: false literally
|
|
133
|
+
*
|
|
134
|
+
* // Upload on behalf of another user (delegation)
|
|
135
|
+
* const result = await vana.data.upload({
|
|
136
|
+
* content: "User's data",
|
|
137
|
+
* filename: "delegated.txt",
|
|
138
|
+
* owner: "0x5678...", // Different from connected wallet
|
|
139
|
+
* permissions: [{
|
|
140
|
+
* account: "0x1234...", // Address that can decrypt
|
|
141
|
+
* publicKey: "0x04..." // Their public key for encryption
|
|
142
|
+
* }]
|
|
143
|
+
* });
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
upload(params: EncryptedUploadParams): Promise<UploadResult>;
|
|
147
|
+
upload(params: UnencryptedUploadParams): Promise<UploadResult>;
|
|
148
|
+
upload(params: UploadParams): Promise<UploadResult>;
|
|
149
|
+
/**
|
|
150
|
+
* Decrypts a file owned by the user using their wallet signature.
|
|
151
|
+
*
|
|
152
|
+
* @remarks
|
|
153
|
+
* This is the high-level convenience method for decrypting user files, serving as the
|
|
154
|
+
* symmetrical counterpart to the `upload` method. It handles the complete decryption
|
|
155
|
+
* workflow including key generation, URL protocol detection, content fetching, and
|
|
156
|
+
* decryption.
|
|
157
|
+
*
|
|
158
|
+
* The method automatically:
|
|
159
|
+
* - Generates the decryption key from the user's wallet signature
|
|
160
|
+
* - Determines the appropriate fetch method based on the file URL protocol
|
|
161
|
+
* - Fetches the encrypted content from IPFS or standard HTTP URLs
|
|
162
|
+
* - Decrypts the content using the generated key
|
|
163
|
+
*
|
|
164
|
+
* For IPFS URLs, the method uses gateway fallback for improved reliability. For
|
|
165
|
+
* standard HTTP URLs, it uses a simple fetch. If you need custom authentication
|
|
166
|
+
* headers or specific gateway configurations, use the low-level primitives directly.
|
|
167
|
+
*
|
|
168
|
+
* @param file - The user file to decrypt (typically from getUserFiles)
|
|
169
|
+
* @param encryptionSeed - Optional custom encryption seed (defaults to Vana standard)
|
|
170
|
+
* @returns Promise resolving to the decrypted file content as a Blob
|
|
171
|
+
* @throws {Error} "No addresses available in wallet client" - When wallet is not connected
|
|
172
|
+
* @throws {Error} "Network error: Cannot access the file URL" - When file URL is inaccessible (CORS, server down)
|
|
173
|
+
* @throws {Error} "File not found: The encrypted file is no longer available" - When file returns 404
|
|
174
|
+
* @throws {Error} "Access denied" - When file returns 403 (no permission)
|
|
175
|
+
* @throws {Error} "File is empty or could not be retrieved" - When file has no content
|
|
176
|
+
* @throws {Error} "Invalid file format: This file doesn't appear to be encrypted with the Vana protocol" - When file is not properly encrypted
|
|
177
|
+
* @throws {Error} "Wrong encryption key" - When decryption fails due to incorrect key/seed
|
|
178
|
+
* @throws {Error} "Failed to decrypt file: {error}" - General decryption failures
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* // Basic file decryption
|
|
182
|
+
* const files = await vana.data.getUserFiles({ owner: userAddress });
|
|
183
|
+
* const decryptedBlob = await vana.data.decryptFile(files[0]);
|
|
184
|
+
*
|
|
185
|
+
* // Convert to text
|
|
186
|
+
* const text = await decryptedBlob.text();
|
|
187
|
+
* console.log('Decrypted content:', text);
|
|
188
|
+
*
|
|
189
|
+
* // Convert to JSON
|
|
190
|
+
* const json = JSON.parse(await decryptedBlob.text());
|
|
191
|
+
* console.log('Decrypted data:', json);
|
|
192
|
+
*
|
|
193
|
+
* // With custom encryption seed
|
|
194
|
+
* const decryptedBlob = await vana.data.decryptFile(
|
|
195
|
+
* files[0],
|
|
196
|
+
* "My custom encryption seed"
|
|
197
|
+
* );
|
|
198
|
+
*
|
|
199
|
+
* // Save to file (in Node.js)
|
|
200
|
+
* const buffer = await decryptedBlob.arrayBuffer();
|
|
201
|
+
* fs.writeFileSync('decrypted-file.txt', Buffer.from(buffer));
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
decryptFile(file: UserFile, encryptionSeed?: string): Promise<Blob>;
|
|
205
|
+
/**
|
|
206
|
+
* Retrieves all data files owned by a specific user address.
|
|
207
|
+
*
|
|
208
|
+
* @remarks
|
|
209
|
+
* This method queries the Vana subgraph to find files directly owned by the user.
|
|
210
|
+
* It efficiently handles large datasets by using the File entity's owner field
|
|
211
|
+
* and returns complete file metadata without additional contract calls.
|
|
212
|
+
*
|
|
213
|
+
* **Deduplication Behavior:**
|
|
214
|
+
* The method automatically deduplicates files by ID, keeping only the latest version
|
|
215
|
+
* (highest timestamp) when duplicate file IDs are found. This handles cases where
|
|
216
|
+
* the subgraph may contain multiple entries for the same file due to re-indexing
|
|
217
|
+
* or blockchain reorganizations.
|
|
218
|
+
* @param params - The query parameters object
|
|
219
|
+
* @param params.owner - The wallet address of the file owner to query
|
|
220
|
+
* @param params.subgraphUrl - Optional subgraph URL to override the default endpoint
|
|
221
|
+
* @returns A Promise that resolves to an array of UserFile objects with metadata, sorted by latest timestamp first
|
|
222
|
+
* @throws {Error} When subgraphUrl is not provided and not configured - "subgraphUrl is required"
|
|
223
|
+
* @throws {Error} When subgraph request fails - "Subgraph request failed: {status} {statusText}"
|
|
224
|
+
* @throws {Error} When subgraph returns errors - "Subgraph errors: {error messages}"
|
|
225
|
+
* @throws {Error} When JSON parsing fails - "Failed to fetch user files from subgraph: {error}"
|
|
226
|
+
* @example
|
|
227
|
+
* ```typescript
|
|
228
|
+
* // Query files for a specific user
|
|
229
|
+
* const files = await vana.data.getUserFiles({
|
|
230
|
+
* owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
|
|
231
|
+
* });
|
|
232
|
+
*
|
|
233
|
+
* files.forEach(file => {
|
|
234
|
+
* console.log(`File ${file.id}: ${file.url} (Schema: ${file.schemaId})`);
|
|
235
|
+
* });
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
getUserFiles(params: {
|
|
239
|
+
owner: Address;
|
|
240
|
+
subgraphUrl?: string;
|
|
241
|
+
}): Promise<UserFile[]>;
|
|
242
|
+
/**
|
|
243
|
+
* Fetches proof data for multiple files from the subgraph.
|
|
244
|
+
*
|
|
245
|
+
* @private
|
|
246
|
+
* @param fileIds - Array of file IDs to fetch proofs for
|
|
247
|
+
* @param subgraphUrl - The subgraph endpoint URL
|
|
248
|
+
* @returns Map of file IDs to their associated DLP IDs
|
|
249
|
+
*/
|
|
250
|
+
private _fetchProofsFromSubgraph;
|
|
251
|
+
/**
|
|
252
|
+
* Fetches proof data for multiple files from the blockchain.
|
|
253
|
+
* Falls back to this when subgraph is unavailable.
|
|
254
|
+
*
|
|
255
|
+
* @private
|
|
256
|
+
* @param fileIds - Array of file IDs to fetch proofs for
|
|
257
|
+
* @returns Map of file IDs to their associated DLP IDs
|
|
258
|
+
*/
|
|
259
|
+
private _fetchProofsFromChain;
|
|
260
|
+
/**
|
|
261
|
+
* Retrieves information about a specific Data Liquidity Pool (DLP).
|
|
262
|
+
*
|
|
263
|
+
* @remarks
|
|
264
|
+
* DLPs are entities that process and verify data files in the Vana network.
|
|
265
|
+
* This method fetches DLP metadata including name, status, and performance rating.
|
|
266
|
+
* Uses subgraph first for efficiency, falls back to chain if unavailable.
|
|
267
|
+
*
|
|
268
|
+
* @param dlpId - The unique identifier of the DLP
|
|
269
|
+
* @param options - Optional parameters
|
|
270
|
+
* @param options.subgraphUrl - Custom subgraph URL to override default
|
|
271
|
+
* @returns Promise resolving to DLP information
|
|
272
|
+
* @throws {Error} When DLP cannot be found - "DLP not found: {dlpId}"
|
|
273
|
+
* @throws {Error} When query fails - "Failed to fetch DLP: {error}"
|
|
274
|
+
* @example
|
|
275
|
+
* ```typescript
|
|
276
|
+
* const dlp = await vana.data.getDLP(26);
|
|
277
|
+
* console.log(`DLP ${dlp.name}: ${dlp.status}`);
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
getDLP(dlpId: number, options?: {
|
|
281
|
+
subgraphUrl?: string;
|
|
282
|
+
}): Promise<{
|
|
283
|
+
id: number;
|
|
284
|
+
name: string;
|
|
285
|
+
metadata?: string;
|
|
286
|
+
status?: number;
|
|
287
|
+
address?: Address;
|
|
288
|
+
owner?: Address;
|
|
289
|
+
}>;
|
|
290
|
+
/**
|
|
291
|
+
* Lists all Data Liquidity Pools (DLPs) with optional pagination.
|
|
292
|
+
*
|
|
293
|
+
* @remarks
|
|
294
|
+
* Fetches a paginated list of all DLPs registered in the network.
|
|
295
|
+
* Uses subgraph for efficient querying with fallback to chain multicall.
|
|
296
|
+
*
|
|
297
|
+
* @param options - Optional parameters for pagination and filtering
|
|
298
|
+
* @param options.limit - Maximum number of DLPs to return (default: 100)
|
|
299
|
+
* @param options.offset - Number of DLPs to skip (default: 0)
|
|
300
|
+
* @param options.subgraphUrl - Custom subgraph URL to override default
|
|
301
|
+
* @returns Promise resolving to array of DLP information
|
|
302
|
+
* @throws {Error} When query fails - "Failed to list DLPs: {error}"
|
|
303
|
+
* @example
|
|
304
|
+
* ```typescript
|
|
305
|
+
* // Get first 10 DLPs
|
|
306
|
+
* const dlps = await vana.data.listDLPs({ limit: 10 });
|
|
307
|
+
* dlps.forEach(dlp => console.log(`${dlp.id}: ${dlp.name}`));
|
|
308
|
+
*
|
|
309
|
+
* // Get next page
|
|
310
|
+
* const nextPage = await vana.data.listDLPs({ limit: 10, offset: 10 });
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
listDLPs(options?: {
|
|
314
|
+
limit?: number;
|
|
315
|
+
offset?: number;
|
|
316
|
+
subgraphUrl?: string;
|
|
317
|
+
}): Promise<Array<{
|
|
318
|
+
id: number;
|
|
319
|
+
name: string;
|
|
320
|
+
metadata?: string;
|
|
321
|
+
status?: number;
|
|
322
|
+
address?: Address;
|
|
323
|
+
owner?: Address;
|
|
324
|
+
}>>;
|
|
325
|
+
/**
|
|
326
|
+
* Retrieves a list of permissions granted by a user.
|
|
327
|
+
*
|
|
328
|
+
* This method supports automatic fallback between subgraph and RPC modes:
|
|
329
|
+
* - If subgraph URL is available, tries subgraph query first
|
|
330
|
+
* - Falls back to direct contract queries via RPC if subgraph fails
|
|
331
|
+
* - RPC mode uses gasAwareMulticall for efficient batch queries
|
|
332
|
+
*
|
|
333
|
+
* @param params - Object containing the user address and optional subgraph URL
|
|
334
|
+
* @param params.user - The wallet address of the user to query permissions for
|
|
335
|
+
* @param params.subgraphUrl - Optional subgraph URL to override the default
|
|
336
|
+
* @returns Promise resolving to an array of permission objects
|
|
337
|
+
* @throws Error if both subgraph and RPC queries fail
|
|
338
|
+
*/
|
|
339
|
+
getUserPermissions(params: {
|
|
340
|
+
user: Address;
|
|
341
|
+
subgraphUrl?: string;
|
|
342
|
+
}): Promise<Array<{
|
|
343
|
+
id: string;
|
|
344
|
+
grant: string;
|
|
345
|
+
nonce: bigint;
|
|
346
|
+
signature: string;
|
|
347
|
+
addedAtBlock: bigint;
|
|
348
|
+
addedAtTimestamp: bigint;
|
|
349
|
+
transactionHash: Address;
|
|
350
|
+
user: Address;
|
|
351
|
+
}>>;
|
|
352
|
+
/**
|
|
353
|
+
* Internal method: Query user permissions via subgraph
|
|
354
|
+
*
|
|
355
|
+
* @param params - Query parameters object
|
|
356
|
+
* @param params.user - The user address to query permissions for
|
|
357
|
+
* @param params.subgraphUrl - The subgraph URL endpoint to query
|
|
358
|
+
* @returns Promise resolving to an array of permission objects
|
|
359
|
+
*/
|
|
360
|
+
private _getUserPermissionsViaSubgraph;
|
|
361
|
+
/**
|
|
362
|
+
* Internal method: Query user permissions via direct RPC
|
|
363
|
+
*
|
|
364
|
+
* @param params - Query parameters object
|
|
365
|
+
* @param params.user - The user address to query permissions for
|
|
366
|
+
* @returns Promise resolving to an array of permission objects
|
|
367
|
+
*/
|
|
368
|
+
private _getUserPermissionsViaRpc;
|
|
369
|
+
/**
|
|
370
|
+
* Retrieves a list of trusted servers for a user.
|
|
371
|
+
*
|
|
372
|
+
* This method supports automatic fallback between subgraph and RPC modes:
|
|
373
|
+
* - If subgraph URL is available, tries subgraph query first for fast results
|
|
374
|
+
* - Falls back to direct contract queries via RPC if subgraph fails
|
|
375
|
+
* - RPC mode uses gasAwareMulticall for efficient batch queries
|
|
376
|
+
*
|
|
377
|
+
* @param params - Query parameters including user address and optional pagination
|
|
378
|
+
* @param params.user - The wallet address of the user to query trusted servers for
|
|
379
|
+
* @param params.subgraphUrl - Optional subgraph URL to override the default
|
|
380
|
+
* @param params.limit - Maximum number of results to return (default: 50)
|
|
381
|
+
* @param params.offset - Number of results to skip for pagination (default: 0)
|
|
382
|
+
* @returns Promise resolving to an array of trusted server objects
|
|
383
|
+
* @throws Error if both subgraph and RPC queries fail
|
|
384
|
+
* @example
|
|
385
|
+
* ```typescript
|
|
386
|
+
* // Basic usage with automatic fallback
|
|
387
|
+
* const servers = await vana.data.getUserTrustedServers({
|
|
388
|
+
* user: '0x...'
|
|
389
|
+
* });
|
|
390
|
+
*
|
|
391
|
+
* // With pagination
|
|
392
|
+
* const servers = await vana.data.getUserTrustedServers({
|
|
393
|
+
* user: '0x...',
|
|
394
|
+
* limit: 10,
|
|
395
|
+
* offset: 20
|
|
396
|
+
* });
|
|
397
|
+
*
|
|
398
|
+
* // With custom subgraph URL
|
|
399
|
+
* const servers = await vana.data.getUserTrustedServers({
|
|
400
|
+
* user: '0x...',
|
|
401
|
+
* subgraphUrl: 'https://custom-subgraph.com/graphql'
|
|
402
|
+
* });
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
getUserTrustedServers(params: GetUserTrustedServersParams): Promise<TrustedServer[]>;
|
|
406
|
+
/**
|
|
407
|
+
* Internal method: Query trusted servers via subgraph
|
|
408
|
+
*
|
|
409
|
+
* @param params - Query parameters object
|
|
410
|
+
* @param params.user - The user address to query trusted servers for
|
|
411
|
+
* @param params.subgraphUrl - The subgraph URL endpoint to query
|
|
412
|
+
* @returns Promise resolving to an array of trusted server objects
|
|
413
|
+
*/
|
|
414
|
+
private _getUserTrustedServersViaSubgraph;
|
|
415
|
+
/**
|
|
416
|
+
* Internal method: Query trusted servers via direct RPC
|
|
417
|
+
*
|
|
418
|
+
* @param params - Query parameters object
|
|
419
|
+
* @param params.user - The user address to query trusted servers for
|
|
420
|
+
* @param params.limit - Maximum number of results to return
|
|
421
|
+
* @param params.offset - Number of results to skip for pagination
|
|
422
|
+
* @returns Promise resolving to pagination result with servers, total count, and hasMore flag
|
|
423
|
+
*/
|
|
424
|
+
private _getUserTrustedServersViaRpc;
|
|
425
|
+
/**
|
|
426
|
+
* Gets the total number of files in the registry from the contract.
|
|
427
|
+
*
|
|
428
|
+
* @returns Promise resolving to the total file count
|
|
429
|
+
* @example
|
|
430
|
+
* ```typescript
|
|
431
|
+
* const totalFiles = await vana.data.getTotalFilesCount();
|
|
432
|
+
* console.log(`Total files in registry: ${totalFiles}`);
|
|
433
|
+
*
|
|
434
|
+
* // Use for pagination calculations
|
|
435
|
+
* const filesPerPage = 20;
|
|
436
|
+
* const totalPages = Math.ceil(totalFiles / filesPerPage);
|
|
437
|
+
* console.log(`Total pages: ${totalPages}`);
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
440
|
+
getTotalFilesCount(): Promise<number>;
|
|
441
|
+
/**
|
|
442
|
+
* Retrieves details for a specific file by its ID.
|
|
443
|
+
*
|
|
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
|
+
* @example
|
|
450
|
+
* ```typescript
|
|
451
|
+
* try {
|
|
452
|
+
* const file = await vana.data.getFileById(123);
|
|
453
|
+
* console.log('File details:', {
|
|
454
|
+
* id: file.id,
|
|
455
|
+
* url: file.url,
|
|
456
|
+
* owner: file.ownerAddress,
|
|
457
|
+
* addedAt: file.addedAtBlock
|
|
458
|
+
* });
|
|
459
|
+
* } catch (error) {
|
|
460
|
+
* console.error('File not found or error retrieving file:', error);
|
|
461
|
+
* }
|
|
462
|
+
* ```
|
|
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
|
+
*/
|
|
469
|
+
getFileById(fileId: number): Promise<UserFile>;
|
|
470
|
+
/**
|
|
471
|
+
* Registers a file URL directly on the blockchain with a schema ID.
|
|
472
|
+
*
|
|
473
|
+
* @remarks
|
|
474
|
+
* This method registers an existing file URL on the DataRegistry contract
|
|
475
|
+
* with a schema ID, without uploading any data. Useful when you have already
|
|
476
|
+
* uploaded content to storage and just need to register it on-chain.
|
|
477
|
+
*
|
|
478
|
+
* @param url - The URL of the file to register (IPFS or HTTP/HTTPS)
|
|
479
|
+
* @param schemaId - The schema ID to associate with the file
|
|
480
|
+
* @returns Promise resolving to the file ID and transaction hash
|
|
481
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
482
|
+
* @throws {Error} When wallet address is unavailable - "No addresses available"
|
|
483
|
+
* @throws {Error} When transaction fails - "Failed to register file with schema"
|
|
484
|
+
* @example
|
|
485
|
+
* ```typescript
|
|
486
|
+
* const { fileId, transactionHash } = await vana.data.registerFileWithSchema(
|
|
487
|
+
* "ipfs://QmXxx...",
|
|
488
|
+
* 1
|
|
489
|
+
* );
|
|
490
|
+
* console.log(`File ${fileId} registered with schema in tx ${transactionHash}`);
|
|
491
|
+
* ```
|
|
492
|
+
*/
|
|
493
|
+
registerFileWithSchema(url: string, schemaId: number): Promise<TransactionResult<"DataRegistry", "addFileWithSchema">>;
|
|
494
|
+
/**
|
|
495
|
+
* Gets the user's address from the wallet client.
|
|
496
|
+
*
|
|
497
|
+
* @returns Promise resolving to the user's wallet address
|
|
498
|
+
* @throws {Error} When no addresses are available in wallet client
|
|
499
|
+
*/
|
|
500
|
+
private getUserAddress;
|
|
501
|
+
/**
|
|
502
|
+
* Adds a file with permissions to the DataRegistry contract.
|
|
503
|
+
*
|
|
504
|
+
* @param url - The file URL to register
|
|
505
|
+
* @param ownerAddress - The address of the file owner
|
|
506
|
+
* @param permissions - Array of permissions to set for the file
|
|
507
|
+
* @returns Promise resolving to file ID and transaction hash
|
|
508
|
+
* @throws {Error} When chain ID is not available
|
|
509
|
+
* @throws {ContractError} When contract execution fails
|
|
510
|
+
* @throws {Error} When transaction receipt is not available
|
|
511
|
+
* @throws {Error} When FileAdded event cannot be parsed
|
|
512
|
+
*
|
|
513
|
+
* This method handles the core logic of registering a file
|
|
514
|
+
* with specific permissions on the DataRegistry contract. It can be used
|
|
515
|
+
* by both direct transactions and relayer services.
|
|
516
|
+
*/
|
|
517
|
+
addFileWithPermissions(url: string, ownerAddress: Address, permissions?: Array<{
|
|
518
|
+
account: Address;
|
|
519
|
+
key: string;
|
|
520
|
+
}>): Promise<TransactionResult<"DataRegistry", "addFileWithPermissions">>;
|
|
521
|
+
/**
|
|
522
|
+
* Adds a file to the registry with permissions and schema.
|
|
523
|
+
* This combines the functionality of addFileWithPermissions and schema validation.
|
|
524
|
+
*
|
|
525
|
+
* @remarks
|
|
526
|
+
* This method automatically encrypts permissions when a publicKey is provided.
|
|
527
|
+
* It generates the user's encryption key and encrypts it with each recipient's
|
|
528
|
+
* public key before registering on the blockchain.
|
|
529
|
+
*
|
|
530
|
+
* @param url - The URL of the file to register
|
|
531
|
+
* @param ownerAddress - The address of the file owner
|
|
532
|
+
* @param permissions - Array of permissions to grant, each with account and publicKey properties
|
|
533
|
+
* @param schemaId - The schema ID to associate with the file (0 for no schema)
|
|
534
|
+
* @returns Promise resolving to TransactionResult with fileId and transactionHash
|
|
535
|
+
* @throws {Error} "Chain ID not available" - When wallet chain is not configured
|
|
536
|
+
* @throws {Error} "Failed to generate encryption key" - When encryption key generation fails
|
|
537
|
+
* @throws {Error} "Permission for {account} must include 'publicKey'" - When publicKey is missing
|
|
538
|
+
* @throws {Error} "Failed to add file with permissions and schema: {error}" - When transaction fails
|
|
539
|
+
* @example
|
|
540
|
+
* ```typescript
|
|
541
|
+
* // Get server's public key
|
|
542
|
+
* const serverIdentity = await vana.server.getIdentity({
|
|
543
|
+
* userAddress: "0x..."
|
|
544
|
+
* });
|
|
545
|
+
*
|
|
546
|
+
* // Add file with permissions and schema
|
|
547
|
+
* const result = await vana.data.addFileWithPermissionsAndSchema(
|
|
548
|
+
* "ipfs://QmXxx...",
|
|
549
|
+
* ownerAddress,
|
|
550
|
+
* [{
|
|
551
|
+
* account: serverIdentity.address,
|
|
552
|
+
* publicKey: serverIdentity.publicKey
|
|
553
|
+
* }],
|
|
554
|
+
* schemaId
|
|
555
|
+
* );
|
|
556
|
+
*
|
|
557
|
+
* console.log(`File ${result.fileId} registered in tx ${result.hash}`);
|
|
558
|
+
* ```
|
|
559
|
+
*/
|
|
560
|
+
addFileWithPermissionsAndSchema(url: string, ownerAddress: Address, permissions?: Array<{
|
|
561
|
+
account: Address;
|
|
562
|
+
publicKey: string;
|
|
563
|
+
}>, schemaId?: number): Promise<TransactionResult<"DataRegistry", "addFileWithPermissionsAndSchema">>;
|
|
564
|
+
/**
|
|
565
|
+
* Internal method to add file with encrypted permissions and schema.
|
|
566
|
+
* @private
|
|
567
|
+
*/
|
|
568
|
+
private _addFileWithPermissionsAndSchemaInternal;
|
|
569
|
+
/**
|
|
570
|
+
* Adds a new refiner to the DataRefinerRegistry.
|
|
571
|
+
*
|
|
572
|
+
* @remarks
|
|
573
|
+
* Refiners are data processing templates that define how raw data should be
|
|
574
|
+
* transformed into structured formats. Each refiner is associated with a DLP
|
|
575
|
+
* (Data Liquidity Pool), has a specific schema for output, and includes
|
|
576
|
+
* instructions for the refinement process.
|
|
577
|
+
*
|
|
578
|
+
* @param params - Refiner configuration parameters
|
|
579
|
+
* @param params.dlpId - The Data Liquidity Pool ID this refiner belongs to
|
|
580
|
+
* @param params.name - Human-readable name for the refiner
|
|
581
|
+
* @param params.schemaId - Schema ID that defines the output format
|
|
582
|
+
* @param params.refinementInstructionUrl - URL containing processing instructions
|
|
583
|
+
* @returns Promise resolving to the new refiner ID and transaction hash
|
|
584
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
585
|
+
* @throws {Error} When transaction fails - "Failed to add refiner: {error}"
|
|
586
|
+
* @example
|
|
587
|
+
* ```typescript
|
|
588
|
+
* const result = await vana.data.addRefiner({
|
|
589
|
+
* dlpId: 1,
|
|
590
|
+
* name: "Social Media Sentiment Analyzer",
|
|
591
|
+
* schemaId: 42,
|
|
592
|
+
* refinementInstructionUrl: "ipfs://QmXxx..."
|
|
593
|
+
* });
|
|
594
|
+
* console.log(`Created refiner ${result.refinerId} in tx ${result.transactionHash}`);
|
|
595
|
+
* ```
|
|
596
|
+
*/
|
|
597
|
+
addRefiner(params: AddRefinerParams): Promise<AddRefinerResult>;
|
|
598
|
+
/**
|
|
599
|
+
* Retrieves a refiner by its ID.
|
|
600
|
+
*
|
|
601
|
+
* @remarks
|
|
602
|
+
* Queries the DataRefinerRegistry contract to get complete information about
|
|
603
|
+
* a specific refiner including its DLP association, schema, and instructions.
|
|
604
|
+
*
|
|
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
|
+
* @example
|
|
611
|
+
* ```typescript
|
|
612
|
+
* const refiner = await vana.data.getRefiner(1);
|
|
613
|
+
* console.log({
|
|
614
|
+
* name: refiner.name,
|
|
615
|
+
* dlp: refiner.dlpId,
|
|
616
|
+
* schema: refiner.schemaId,
|
|
617
|
+
* instructions: refiner.refinementInstructionUrl
|
|
618
|
+
* });
|
|
619
|
+
* ```
|
|
620
|
+
*/
|
|
621
|
+
getRefiner(refinerId: number): Promise<Refiner>;
|
|
622
|
+
/**
|
|
623
|
+
* Validates if a schema ID exists in the registry.
|
|
624
|
+
*
|
|
625
|
+
* @remarks
|
|
626
|
+
* Checks the DataRefinerRegistry contract to determine if a given schema ID
|
|
627
|
+
* has been registered and is available for use.
|
|
628
|
+
*
|
|
629
|
+
* @param schemaId - The numeric schema ID to validate
|
|
630
|
+
* @returns Promise resolving to true if schema exists, false otherwise
|
|
631
|
+
* @example
|
|
632
|
+
* ```typescript
|
|
633
|
+
* const isValid = await vana.data.isValidSchemaId(42);
|
|
634
|
+
* if (isValid) {
|
|
635
|
+
* console.log('Schema 42 is available for use');
|
|
636
|
+
* } else {
|
|
637
|
+
* console.log('Schema 42 does not exist');
|
|
638
|
+
* }
|
|
639
|
+
* ```
|
|
640
|
+
*/
|
|
641
|
+
isValidSchemaId(schemaId: number): Promise<boolean>;
|
|
642
|
+
/**
|
|
643
|
+
* Gets the total number of refiners in the registry.
|
|
644
|
+
*
|
|
645
|
+
* @remarks
|
|
646
|
+
* Queries the DataRefinerRegistry contract to get the total count of all
|
|
647
|
+
* registered refiners across all DLPs.
|
|
648
|
+
*
|
|
649
|
+
* @returns Promise resolving to the total refiner count
|
|
650
|
+
* @example
|
|
651
|
+
* ```typescript
|
|
652
|
+
* const count = await vana.data.getRefinersCount();
|
|
653
|
+
* console.log(`Total refiners registered: ${count}`);
|
|
654
|
+
* ```
|
|
655
|
+
*/
|
|
656
|
+
getRefinersCount(): Promise<number>;
|
|
657
|
+
/**
|
|
658
|
+
* Updates the schema ID for an existing refiner.
|
|
659
|
+
*
|
|
660
|
+
* @remarks
|
|
661
|
+
* Allows the owner of a refiner to update its associated schema ID.
|
|
662
|
+
* This is useful when refiner output format needs to change.
|
|
663
|
+
*
|
|
664
|
+
* @param params - Update parameters
|
|
665
|
+
* @param params.refinerId - The refiner ID to update
|
|
666
|
+
* @param params.newSchemaId - The new schema ID to set
|
|
667
|
+
* @returns Promise resolving to the transaction hash
|
|
668
|
+
* @throws {Error} When chain ID is not available - "Chain ID not available"
|
|
669
|
+
* @throws {Error} When transaction fails - "Failed to update schema ID: {error}"
|
|
670
|
+
* @example
|
|
671
|
+
* ```typescript
|
|
672
|
+
* const result = await vana.data.updateSchemaId({
|
|
673
|
+
* refinerId: 1,
|
|
674
|
+
* newSchemaId: 55
|
|
675
|
+
* });
|
|
676
|
+
* console.log(`Schema updated in tx ${result.transactionHash}`);
|
|
677
|
+
* ```
|
|
678
|
+
*/
|
|
679
|
+
updateSchemaId(params: UpdateSchemaIdParams): Promise<UpdateSchemaIdResult>;
|
|
680
|
+
/**
|
|
681
|
+
* Uploads an encrypted file and grants permission to a party with a public key.
|
|
682
|
+
*
|
|
683
|
+
* This method handles the complete workflow:
|
|
684
|
+
* 1. Encrypts the file with the user's encryption key
|
|
685
|
+
* 2. Uploads the encrypted file to storage
|
|
686
|
+
* 3. Encrypts the user's encryption key with the provided public key
|
|
687
|
+
* 4. Registers the file with permissions
|
|
688
|
+
*
|
|
689
|
+
* @param data - The file data to encrypt and upload
|
|
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
|
|
693
|
+
* @returns Promise resolving to upload result with file ID and storage URL
|
|
694
|
+
*/
|
|
695
|
+
uploadFileWithPermissions(data: Blob, permissions: Array<{
|
|
696
|
+
account: Address;
|
|
697
|
+
publicKey: string;
|
|
698
|
+
}>, filename?: string, providerName?: string): Promise<UploadEncryptedFileResult>;
|
|
699
|
+
/**
|
|
700
|
+
* Uploads content to storage without registering it on the blockchain.
|
|
701
|
+
* This method only handles the storage upload and returns the file URL.
|
|
702
|
+
*
|
|
703
|
+
* @param content - The content to upload (string, Blob, Buffer, or object - objects will be JSON stringified)
|
|
704
|
+
* @param filename - Optional filename for the uploaded file (defaults to timestamp-based name)
|
|
705
|
+
* @param encrypt - Optional flag to encrypt the content before upload
|
|
706
|
+
* @param providerName - Optional specific storage provider to use
|
|
707
|
+
* @returns Promise resolving to the storage upload result with url, size, and contentType
|
|
708
|
+
*/
|
|
709
|
+
uploadToStorage(content: string | Blob | Buffer | object, filename?: string, encrypt?: boolean, providerName?: string): Promise<StorageUploadResult>;
|
|
710
|
+
/**
|
|
711
|
+
* Adds a permission for a party to access an existing file.
|
|
712
|
+
*
|
|
713
|
+
* This method handles the complete workflow:
|
|
714
|
+
* 1. Gets the user's encryption key
|
|
715
|
+
* 2. Encrypts the user's encryption key with the provided public key
|
|
716
|
+
* 3. Adds the permission to the file
|
|
717
|
+
* 4. Returns the permission data from the blockchain event
|
|
718
|
+
*
|
|
719
|
+
* For advanced users who need more control over transaction timing,
|
|
720
|
+
* use `submitFilePermission()` instead.
|
|
721
|
+
*
|
|
722
|
+
* @param fileId - The ID of the file to add permissions for
|
|
723
|
+
* @param account - The address of the account to grant permission to
|
|
724
|
+
* @param publicKey - The public key to encrypt the user's encryption key with (hex string with 0x prefix)
|
|
725
|
+
* @returns Promise resolving to permission data from PermissionGranted event
|
|
726
|
+
* @throws {Error} "No addresses available in wallet client" - When wallet is not connected
|
|
727
|
+
* @throws {Error} "Chain ID not available" - When wallet chain is not configured
|
|
728
|
+
* @throws {Error} "Failed to add permission to file: {error}" - When transaction fails or user doesn't own file
|
|
729
|
+
* @example
|
|
730
|
+
* ```typescript
|
|
731
|
+
* const result = await vana.data.addPermissionToFile(fileId, account, publicKey);
|
|
732
|
+
* console.log(`Permission granted to ${result.account} for file ${result.fileId}`);
|
|
733
|
+
* console.log(`Transaction: ${result.transactionHash}`);
|
|
734
|
+
* ```
|
|
735
|
+
*/
|
|
736
|
+
addPermissionToFile(fileId: number, account: Address, publicKey: string): Promise<TransactionResult<"DataRegistry", "addFilePermission">>;
|
|
737
|
+
/**
|
|
738
|
+
* Submits a file permission transaction to the blockchain.
|
|
739
|
+
*
|
|
740
|
+
* @remarks
|
|
741
|
+
* This method supports gasless transactions via relayer callbacks when configured.
|
|
742
|
+
* It encrypts the user's encryption key with the recipient's public key before submission.
|
|
743
|
+
* Use this when you want to handle transaction confirmation and event parsing separately.
|
|
744
|
+
*
|
|
745
|
+
* @param fileId - The ID of the file to grant permission for
|
|
746
|
+
* @param account - The recipient's wallet address that will access the file
|
|
747
|
+
* @param publicKey - The recipient's public key for encryption.
|
|
748
|
+
* Obtain via `vana.server.getIdentity(account).publicKey`
|
|
749
|
+
* @returns Promise resolving to TransactionResult for tracking the transaction
|
|
750
|
+
* @throws {Error} When chain ID is not available
|
|
751
|
+
* @throws {Error} When encryption key generation fails
|
|
752
|
+
* @throws {Error} When public key encryption fails
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* ```typescript
|
|
756
|
+
* const tx = await vana.data.submitFilePermission(
|
|
757
|
+
* fileId,
|
|
758
|
+
* "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
|
|
759
|
+
* recipientPublicKey
|
|
760
|
+
* );
|
|
761
|
+
* const result = await tx.waitForEvents();
|
|
762
|
+
* console.log(`Permission granted with ID: ${result.permissionId}`);
|
|
763
|
+
* ```
|
|
764
|
+
*/
|
|
765
|
+
submitFilePermission(fileId: number, account: Address, publicKey: string): Promise<TransactionResult<"DataRegistry", "addFilePermission">>;
|
|
766
|
+
/**
|
|
767
|
+
* Gets the encrypted key for a specific account's permission to access a file.
|
|
768
|
+
*
|
|
769
|
+
* @param fileId - The ID of the file
|
|
770
|
+
* @param account - The account address to get the permission for
|
|
771
|
+
* @returns Promise resolving to the encrypted key for that account
|
|
772
|
+
*/
|
|
773
|
+
getFilePermission(fileId: number, account: Address): Promise<string>;
|
|
774
|
+
/**
|
|
775
|
+
* Decrypts a file that the user has permission to access using their private key.
|
|
776
|
+
*
|
|
777
|
+
* This method handles the complete workflow for servers or other permitted parties:
|
|
778
|
+
* 1. Gets the encrypted encryption key from file permissions
|
|
779
|
+
* 2. Decrypts the encryption key using the provided private key
|
|
780
|
+
* 3. Downloads and decrypts the file data
|
|
781
|
+
*
|
|
782
|
+
* @param file - The file to decrypt
|
|
783
|
+
* @param privateKey - The private key to decrypt the user's encryption key
|
|
784
|
+
* @param account - The account address that has permission (defaults to current wallet account)
|
|
785
|
+
* @returns Promise resolving to the decrypted file data
|
|
786
|
+
*/
|
|
787
|
+
decryptFileWithPermission(file: UserFile, privateKey: string, account?: Address): Promise<Blob>;
|
|
788
|
+
/**
|
|
789
|
+
* Simple network-agnostic fetch utility for retrieving file content.
|
|
790
|
+
*
|
|
791
|
+
* @remarks
|
|
792
|
+
* This is a thin wrapper around the global fetch API that returns the response as a Blob.
|
|
793
|
+
* It provides a consistent interface for fetching encrypted content before decryption.
|
|
794
|
+
* For IPFS URLs, consider using fetchFromIPFS for better reliability.
|
|
795
|
+
*
|
|
796
|
+
* @param url - The URL to fetch content from
|
|
797
|
+
* @returns Promise resolving to the fetched content as a Blob
|
|
798
|
+
* @throws {Error} "HTTP error! status: {status} {statusText}" - When server returns error status
|
|
799
|
+
* @throws {Error} "Empty response" - When server returns no content
|
|
800
|
+
* @throws {Error} "Network error: Failed to fetch from {url}" - When network request fails
|
|
801
|
+
*
|
|
802
|
+
* @example
|
|
803
|
+
* ```typescript
|
|
804
|
+
* // Fetch and decrypt a file
|
|
805
|
+
* const encryptionKey = await generateEncryptionKey(walletClient);
|
|
806
|
+
* const encryptedBlob = await vana.data.fetch(file.url);
|
|
807
|
+
* const decryptedBlob = await decryptBlob(encryptedBlob, encryptionKey, platform);
|
|
808
|
+
*
|
|
809
|
+
* // With custom headers for authentication
|
|
810
|
+
* const response = await fetch(file.url, {
|
|
811
|
+
* headers: { 'Authorization': 'Bearer token' }
|
|
812
|
+
* });
|
|
813
|
+
* const encryptedBlob = await response.blob();
|
|
814
|
+
* ```
|
|
815
|
+
*/
|
|
816
|
+
fetch(url: string): Promise<Blob>;
|
|
817
|
+
/**
|
|
818
|
+
* Specialized IPFS fetcher with gateway fallback mechanism.
|
|
819
|
+
*
|
|
820
|
+
* @remarks
|
|
821
|
+
* This method provides robust IPFS content fetching by trying multiple gateways
|
|
822
|
+
* in sequence until one succeeds. It supports both ipfs:// URLs and raw CIDs.
|
|
823
|
+
*
|
|
824
|
+
* The default gateway list includes public gateways, but you should provide
|
|
825
|
+
* your own gateways for production use to ensure reliability and privacy.
|
|
826
|
+
*
|
|
827
|
+
* @param url - The IPFS URL (ipfs://...) or CID to fetch
|
|
828
|
+
* @param options - Optional configuration
|
|
829
|
+
* @param options.gateways - Array of IPFS gateway URLs to try (must end with /)
|
|
830
|
+
* @returns Promise resolving to the fetched content as a Blob
|
|
831
|
+
* @throws {Error} "Invalid IPFS URL format" - When URL is not ipfs:// or valid CID
|
|
832
|
+
* @throws {Error} "Empty response" - When gateway returns no content
|
|
833
|
+
* @throws {Error} "HTTP error! status: {status}" - When gateway returns error status
|
|
834
|
+
* @throws {Error} "Failed to fetch IPFS content {cid} from all gateways" - When all gateways fail
|
|
835
|
+
*
|
|
836
|
+
* @example
|
|
837
|
+
* ```typescript
|
|
838
|
+
* // Fetch from IPFS with custom gateways
|
|
839
|
+
* const encryptedBlob = await vana.data.fetchFromIPFS(file.url, {
|
|
840
|
+
* gateways: [
|
|
841
|
+
* 'https://my-private-gateway.com/ipfs/',
|
|
842
|
+
* 'https://dweb.link/ipfs/',
|
|
843
|
+
* 'https://ipfs.io/ipfs/'
|
|
844
|
+
* ]
|
|
845
|
+
* });
|
|
846
|
+
*
|
|
847
|
+
* // Decrypt the fetched content
|
|
848
|
+
* const encryptionKey = await generateEncryptionKey(walletClient);
|
|
849
|
+
* const decryptedBlob = await decryptBlob(encryptedBlob, encryptionKey, platform);
|
|
850
|
+
*
|
|
851
|
+
* // With raw CID
|
|
852
|
+
* const blob = await vana.data.fetchFromIPFS('QmXxx...', {
|
|
853
|
+
* gateways: ['https://ipfs.io/ipfs/']
|
|
854
|
+
* });
|
|
855
|
+
* ```
|
|
856
|
+
*/
|
|
857
|
+
fetchFromIPFS(url: string, options?: {
|
|
858
|
+
gateways?: string[];
|
|
859
|
+
}): Promise<Blob>;
|
|
860
|
+
/**
|
|
861
|
+
* Validates a data schema definition against the Vana meta-schema.
|
|
862
|
+
*
|
|
863
|
+
* @param schema - The data schema definition to validate
|
|
864
|
+
* @returns The validated DataSchema
|
|
865
|
+
* @throws SchemaValidationError if invalid
|
|
866
|
+
* @example
|
|
867
|
+
* ```typescript
|
|
868
|
+
* const schema = {
|
|
869
|
+
* name: "User Profile",
|
|
870
|
+
* version: "1.0.0",
|
|
871
|
+
* dialect: "json",
|
|
872
|
+
* schema: {
|
|
873
|
+
* type: "object",
|
|
874
|
+
* properties: {
|
|
875
|
+
* name: { type: "string" },
|
|
876
|
+
* age: { type: "number" }
|
|
877
|
+
* }
|
|
878
|
+
* }
|
|
879
|
+
* };
|
|
880
|
+
*
|
|
881
|
+
* const validatedSchema = vana.data.validateDataSchemaAgainstMetaSchema(schema);
|
|
882
|
+
* ```
|
|
883
|
+
*/
|
|
884
|
+
validateDataSchemaAgainstMetaSchema(schema: unknown): DataSchema;
|
|
885
|
+
/**
|
|
886
|
+
* Validates data against a JSON Schema from a data schema.
|
|
887
|
+
*
|
|
888
|
+
* @param data - The data to validate
|
|
889
|
+
* @param schema - The data schema containing the schema
|
|
890
|
+
* @returns Void (throws if validation fails)
|
|
891
|
+
* @throws SchemaValidationError if invalid
|
|
892
|
+
* @example
|
|
893
|
+
* ```typescript
|
|
894
|
+
* const schema = {
|
|
895
|
+
* name: "User Profile",
|
|
896
|
+
* version: "1.0.0",
|
|
897
|
+
* dialect: "json",
|
|
898
|
+
* schema: {
|
|
899
|
+
* type: "object",
|
|
900
|
+
* properties: {
|
|
901
|
+
* name: { type: "string" },
|
|
902
|
+
* age: { type: "number" }
|
|
903
|
+
* },
|
|
904
|
+
* required: ["name"]
|
|
905
|
+
* }
|
|
906
|
+
* };
|
|
907
|
+
*
|
|
908
|
+
* const userData = { name: "Alice", age: 30 };
|
|
909
|
+
* vana.data.validateDataAgainstSchema(userData, schema);
|
|
910
|
+
* ```
|
|
911
|
+
*/
|
|
912
|
+
validateDataAgainstSchema(data: unknown, schema: DataSchema): void;
|
|
913
|
+
/**
|
|
914
|
+
* Fetches and validates a data schema from a URL, then returns the parsed data schema.
|
|
915
|
+
*
|
|
916
|
+
* @param url - The URL to fetch the data schema from
|
|
917
|
+
* @returns The validated data schema
|
|
918
|
+
* @throws SchemaValidationError if invalid or fetch fails
|
|
919
|
+
* @example
|
|
920
|
+
* ```typescript
|
|
921
|
+
* // Fetch and validate a schema from IPFS or HTTP
|
|
922
|
+
* const schema = await vana.data.fetchAndValidateSchema("https://example.com/schema.json");
|
|
923
|
+
* console.log(schema.name, schema.dialect);
|
|
924
|
+
*
|
|
925
|
+
* // Use the schema to validate user data
|
|
926
|
+
* if (schema.dialect === "json") {
|
|
927
|
+
* vana.data.validateDataAgainstSchema(userData, schema);
|
|
928
|
+
* }
|
|
929
|
+
* ```
|
|
930
|
+
*/
|
|
931
|
+
fetchAndValidateSchema(url: string): Promise<DataSchema>;
|
|
932
|
+
}
|