@opendatalabs/vana-sdk 0.1.0-alpha.9b6ddbc → 0.1.0-alpha.9bbda27
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/client/__tests__/enhancedResponse.test.d.ts +1 -0
- package/dist/client/enhancedResponse.cjs +164 -0
- package/dist/client/enhancedResponse.cjs.map +1 -0
- package/dist/client/enhancedResponse.d.ts +120 -0
- package/dist/client/enhancedResponse.js +138 -0
- package/dist/client/enhancedResponse.js.map +1 -0
- package/dist/config/contracts.config.cjs +403 -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 +378 -0
- package/dist/config/contracts.config.js.map +1 -0
- package/dist/contracts/contractController.cjs +1 -1
- package/dist/contracts/contractController.cjs.map +1 -1
- 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 +33 -0
- package/dist/controllers/base.cjs.map +1 -1
- package/dist/controllers/base.d.ts +10 -0
- package/dist/controllers/base.js +33 -0
- package/dist/controllers/base.js.map +1 -1
- package/dist/controllers/data.cjs +279 -160
- package/dist/controllers/data.cjs.map +1 -1
- package/dist/controllers/data.d.ts +34 -19
- package/dist/controllers/data.js +292 -163
- package/dist/controllers/data.js.map +1 -1
- package/dist/controllers/dataset.cjs +357 -0
- package/dist/controllers/dataset.cjs.map +1 -0
- package/dist/controllers/dataset.d.ts +178 -0
- package/dist/controllers/dataset.js +333 -0
- package/dist/controllers/dataset.js.map +1 -0
- package/dist/controllers/dataset.test.d.ts +1 -0
- 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 +606 -214
- package/dist/controllers/permissions.cjs.map +1 -1
- package/dist/controllers/permissions.d.ts +141 -34
- package/dist/controllers/permissions.js +606 -214
- package/dist/controllers/permissions.js.map +1 -1
- package/dist/controllers/runtimePermissions.cjs +285 -0
- package/dist/controllers/runtimePermissions.cjs.map +1 -0
- package/dist/controllers/runtimePermissions.d.ts +152 -0
- package/dist/controllers/runtimePermissions.js +264 -0
- package/dist/controllers/runtimePermissions.js.map +1 -0
- package/dist/controllers/runtimePermissions.test.d.ts +1 -0
- package/dist/controllers/schemas.cjs +82 -5
- package/dist/controllers/schemas.cjs.map +1 -1
- package/dist/controllers/schemas.d.ts +41 -0
- package/dist/controllers/schemas.js +82 -5
- package/dist/controllers/schemas.js.map +1 -1
- package/dist/controllers/server.cjs +184 -49
- package/dist/controllers/server.cjs.map +1 -1
- package/dist/controllers/server.d.ts +74 -13
- package/dist/controllers/server.js +184 -49
- 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/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 +67 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +63 -3
- package/dist/core.js +67 -1
- 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/index.cjs.map +1 -1
- package/dist/crypto/ecies/index.d.ts +10 -2
- package/dist/crypto/ecies/index.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 +29 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +64 -0
- package/dist/errors.js +28 -0
- package/dist/errors.js.map +1 -1
- package/dist/generated/abi/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 +7 -1
- package/dist/index.browser.js +26 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +47 -1
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +55 -6
- package/dist/index.node.js +43 -2
- 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/server/relayerHandler.cjs +313 -75
- package/dist/server/relayerHandler.cjs.map +1 -1
- package/dist/server/relayerHandler.d.ts +35 -2
- package/dist/server/relayerHandler.js +313 -75
- package/dist/server/relayerHandler.js.map +1 -1
- package/dist/storage/index.cjs +3 -0
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/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/tests/data-upload-owner-validation.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/config.cjs.map +1 -1
- package/dist/types/config.d.ts +32 -0
- package/dist/types/config.js.map +1 -1
- package/dist/types/controller-context.cjs.map +1 -1
- package/dist/types/controller-context.d.ts +4 -1
- package/dist/types/data.cjs.map +1 -1
- package/dist/types/data.d.ts +7 -4
- package/dist/types/dataset.cjs +17 -0
- package/dist/types/dataset.cjs.map +1 -0
- package/dist/types/dataset.d.ts +51 -0
- package/dist/types/dataset.js +1 -0
- package/dist/types/dataset.js.map +1 -0
- package/dist/types/generics.cjs.map +1 -1
- package/dist/types/generics.d.ts +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.ts +7 -2
- 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 +8 -52
- 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 +4 -0
- package/dist/types/relayer.cjs.map +1 -1
- package/dist/types/relayer.d.ts +55 -10
- 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/utils.cjs.map +1 -1
- package/dist/types/utils.d.ts +0 -49
- 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 +1 -1
- package/dist/utils/blockchain/registry.cjs.map +1 -1
- package/dist/utils/blockchain/registry.js +1 -1
- 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.js +4 -1
- package/dist/utils/grantFiles.js.map +1 -1
- package/dist/utils/ipfs.cjs +1 -3
- package/dist/utils/ipfs.cjs.map +1 -1
- package/dist/utils/ipfs.d.ts +4 -4
- package/dist/utils/ipfs.js +1 -3
- package/dist/utils/ipfs.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/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/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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CreateOperationParams, InitPersonalServerParams, PersonalServerIdentity, DownloadArtifactParams } from "../types";
|
|
2
|
+
import type { CreateOperationResponse } from "../generated/server/server-exports";
|
|
2
3
|
import type { ControllerContext } from "./permissions";
|
|
3
4
|
import type { Operation, PollingOptions } from "../types/operations";
|
|
4
5
|
import { BaseController } from "./base";
|
|
@@ -89,51 +90,54 @@ export declare class ServerController extends BaseController {
|
|
|
89
90
|
*/
|
|
90
91
|
getIdentity(request: InitPersonalServerParams): Promise<PersonalServerIdentity>;
|
|
91
92
|
/**
|
|
92
|
-
* Creates a server operation and returns its details
|
|
93
|
+
* Creates a server operation and returns its details from the OpenAPI schema.
|
|
93
94
|
*
|
|
94
95
|
* @remarks
|
|
95
96
|
* This method submits a computation request to the personal server and returns
|
|
96
|
-
*
|
|
97
|
-
*
|
|
97
|
+
* the server's CreateOperationResponse. The response contains the operation ID
|
|
98
|
+
* which can be used with `waitForOperation()` to poll for completion.
|
|
98
99
|
*
|
|
99
100
|
* @param params - The operation request parameters
|
|
100
101
|
* @param params.permissionId - The permission ID authorizing this operation.
|
|
101
102
|
* Obtain via `vana.permissions.getUserPermissionGrantsOnChain()`.
|
|
102
|
-
* @returns
|
|
103
|
+
* @returns Server response with operation ID
|
|
103
104
|
* @throws {PersonalServerError} When the server request fails or parameters are invalid
|
|
104
105
|
* @throws {NetworkError} When personal server API communication fails
|
|
105
106
|
* @example
|
|
106
107
|
* ```typescript
|
|
107
|
-
* const
|
|
108
|
+
* const response = await vana.server.createOperation({
|
|
108
109
|
* permissionId: 123
|
|
109
110
|
* });
|
|
110
|
-
* console.log(`Operation ID: ${
|
|
111
|
+
* console.log(`Operation ID: ${response.id}`);
|
|
111
112
|
*
|
|
112
113
|
* // Wait for completion
|
|
113
|
-
* const result = await vana.server.waitForOperation(
|
|
114
|
+
* const result = await vana.server.waitForOperation(response.id);
|
|
114
115
|
* console.log("Result:", result.result);
|
|
115
116
|
* ```
|
|
116
117
|
*/
|
|
117
|
-
createOperation
|
|
118
|
+
createOperation(params: CreateOperationParams): Promise<CreateOperationResponse>;
|
|
118
119
|
/**
|
|
119
120
|
* Retrieves the current status and result of a server operation.
|
|
120
121
|
*
|
|
121
122
|
* @remarks
|
|
122
|
-
* Common status values: `starting`, `
|
|
123
|
+
* Common status values: `starting`, `processing`, `succeeded`, `failed`, `canceled`.
|
|
123
124
|
* When status is `succeeded`, the result field contains the operation output.
|
|
125
|
+
* Returns the server response directly from the OpenAPI schema.
|
|
124
126
|
*
|
|
125
127
|
* @param operationId - The ID of the operation to query
|
|
126
|
-
* @returns The operation
|
|
128
|
+
* @returns The operation status response from the server
|
|
127
129
|
* @throws {NetworkError} When the API request fails or returns invalid data
|
|
128
130
|
* @example
|
|
129
131
|
* ```typescript
|
|
130
132
|
* const operation = await vana.server.getOperation(operationId);
|
|
131
133
|
* if (operation.status === 'succeeded') {
|
|
132
134
|
* console.log('Result:', operation.result);
|
|
135
|
+
* console.log('Started at:', operation.started_at);
|
|
136
|
+
* console.log('Finished at:', operation.finished_at);
|
|
133
137
|
* }
|
|
134
138
|
* ```
|
|
135
139
|
*/
|
|
136
|
-
getOperation
|
|
140
|
+
getOperation(operationId: string): Promise<Operation>;
|
|
137
141
|
/**
|
|
138
142
|
* Waits for an operation to complete and returns the final result.
|
|
139
143
|
*
|
|
@@ -141,10 +145,11 @@ export declare class ServerController extends BaseController {
|
|
|
141
145
|
* This method polls the operation status at regular intervals until it
|
|
142
146
|
* reaches a terminal state (succeeded, failed, or canceled). Supports
|
|
143
147
|
* ergonomic overloads to accept either an Operation object or just the ID.
|
|
148
|
+
* Returns the server response directly from the OpenAPI schema.
|
|
144
149
|
*
|
|
145
150
|
* @param opOrId - Either an Operation object or operation ID string
|
|
146
151
|
* @param options - Optional polling configuration
|
|
147
|
-
* @returns The completed operation with result
|
|
152
|
+
* @returns The completed operation with result and timestamp data
|
|
148
153
|
* @throws {PersonalServerError} When the operation fails or times out
|
|
149
154
|
* @example
|
|
150
155
|
* ```typescript
|
|
@@ -160,9 +165,13 @@ export declare class ServerController extends BaseController {
|
|
|
160
165
|
* timeout: 60000,
|
|
161
166
|
* pollingInterval: 1000
|
|
162
167
|
* });
|
|
168
|
+
*
|
|
169
|
+
* // Access server-provided timestamps
|
|
170
|
+
* console.log('Started:', completed.started_at);
|
|
171
|
+
* console.log('Finished:', completed.finished_at);
|
|
163
172
|
* ```
|
|
164
173
|
*/
|
|
165
|
-
waitForOperation
|
|
174
|
+
waitForOperation(opOrId: Operation | string, options?: PollingOptions): Promise<Operation>;
|
|
166
175
|
/**
|
|
167
176
|
* Downloads an artifact generated by a server operation.
|
|
168
177
|
*
|
|
@@ -171,6 +180,12 @@ export declare class ServerController extends BaseController {
|
|
|
171
180
|
* The download requires authentication using the application's signature.
|
|
172
181
|
* This method returns the artifact as a Blob that can be saved or processed.
|
|
173
182
|
*
|
|
183
|
+
* **Simplified Signature Scheme:**
|
|
184
|
+
* The signature is generated over the operation ID only, allowing a single signature
|
|
185
|
+
* to be reused for listing and downloading multiple artifacts from the same operation.
|
|
186
|
+
* This simplifies client implementation while maintaining security - access to the
|
|
187
|
+
* operation ID grants access to all artifacts.
|
|
188
|
+
*
|
|
174
189
|
* @param params - The download parameters
|
|
175
190
|
* @param params.operationId - The operation ID that generated the artifact
|
|
176
191
|
* @param params.artifactPath - The path to the artifact file to download
|
|
@@ -199,6 +214,45 @@ export declare class ServerController extends BaseController {
|
|
|
199
214
|
* ```
|
|
200
215
|
*/
|
|
201
216
|
downloadArtifact(params: DownloadArtifactParams): Promise<Blob>;
|
|
217
|
+
/**
|
|
218
|
+
* Lists all artifacts generated by a server operation.
|
|
219
|
+
*
|
|
220
|
+
* @remarks
|
|
221
|
+
* Retrieves metadata for all artifact files produced by an operation,
|
|
222
|
+
* including file paths, sizes, and content types. This provides visibility
|
|
223
|
+
* into available outputs without downloading them.
|
|
224
|
+
*
|
|
225
|
+
* **Simplified Signature Scheme:**
|
|
226
|
+
* Uses the same signature as downloadArtifact - signs only operation_id.
|
|
227
|
+
* This allows reusing the same signature for listing and downloading.
|
|
228
|
+
*
|
|
229
|
+
* @param operationId - The operation ID that generated the artifacts
|
|
230
|
+
* @returns Promise resolving to array of artifact metadata objects
|
|
231
|
+
* @throws {PersonalServerError} When artifacts cannot be listed
|
|
232
|
+
* @throws {NetworkError} When unable to reach the personal server API
|
|
233
|
+
* @throws {SignatureError} When unable to create the required signature
|
|
234
|
+
* @example
|
|
235
|
+
* ```typescript
|
|
236
|
+
* // List artifacts from a Gemini operation
|
|
237
|
+
* const artifacts = await vana.server.listArtifacts('op_123');
|
|
238
|
+
*
|
|
239
|
+
* console.log(`Found ${artifacts.length} artifacts:`);
|
|
240
|
+
* artifacts.forEach(artifact => {
|
|
241
|
+
* console.log(`- ${artifact.path} (${artifact.size} bytes)`);
|
|
242
|
+
* });
|
|
243
|
+
*
|
|
244
|
+
* // Download a specific artifact
|
|
245
|
+
* const blob = await vana.server.downloadArtifact({
|
|
246
|
+
* operationId: 'op_123',
|
|
247
|
+
* artifactPath: artifacts[0].path
|
|
248
|
+
* });
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
listArtifacts(operationId: string): Promise<Array<{
|
|
252
|
+
path: string;
|
|
253
|
+
size: number;
|
|
254
|
+
content_type: string;
|
|
255
|
+
}>>;
|
|
202
256
|
/**
|
|
203
257
|
* Cancels a running operation on the personal server.
|
|
204
258
|
*
|
|
@@ -251,6 +305,13 @@ export declare class ServerController extends BaseController {
|
|
|
251
305
|
* @returns JSON string representation of the request data
|
|
252
306
|
*/
|
|
253
307
|
private makeRequest;
|
|
308
|
+
/**
|
|
309
|
+
* Gets the account address from the wallet client.
|
|
310
|
+
*
|
|
311
|
+
* @returns The account address
|
|
312
|
+
* @throws {Error} When no account is available
|
|
313
|
+
*/
|
|
314
|
+
private getAccountAddress;
|
|
254
315
|
/**
|
|
255
316
|
* Creates a signature for the request JSON.
|
|
256
317
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SERVER_PATHS } from "../generated/server/server-exports";
|
|
1
2
|
import {
|
|
2
3
|
NetworkError,
|
|
3
4
|
SerializationError,
|
|
@@ -5,6 +6,7 @@ import {
|
|
|
5
6
|
PersonalServerError
|
|
6
7
|
} from "../errors";
|
|
7
8
|
import { BaseController } from "./base";
|
|
9
|
+
import { SignatureCache } from "../utils/signatureCache";
|
|
8
10
|
class ServerController extends BaseController {
|
|
9
11
|
constructor(context) {
|
|
10
12
|
super(context);
|
|
@@ -15,7 +17,11 @@ class ServerController extends BaseController {
|
|
|
15
17
|
"Personal server URL is required for server operations. Please configure defaultPersonalServerUrl in your VanaConfig."
|
|
16
18
|
);
|
|
17
19
|
}
|
|
18
|
-
|
|
20
|
+
let url = this.context.defaultPersonalServerUrl;
|
|
21
|
+
if (url.endsWith("/api/v1")) {
|
|
22
|
+
url = url.slice(0, -7);
|
|
23
|
+
}
|
|
24
|
+
return url;
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* Retrieves cryptographic identity for a personal server.
|
|
@@ -55,7 +61,7 @@ class ServerController extends BaseController {
|
|
|
55
61
|
async getIdentity(request) {
|
|
56
62
|
try {
|
|
57
63
|
const response = await fetch(
|
|
58
|
-
`${this.personalServerBaseUrl}
|
|
64
|
+
`${this.personalServerBaseUrl}${SERVER_PATHS.getIdentityApiV1IdentityGet}?address=${request.userAddress}`,
|
|
59
65
|
{
|
|
60
66
|
method: "GET",
|
|
61
67
|
headers: {
|
|
@@ -88,28 +94,28 @@ class ServerController extends BaseController {
|
|
|
88
94
|
}
|
|
89
95
|
}
|
|
90
96
|
/**
|
|
91
|
-
* Creates a server operation and returns its details
|
|
97
|
+
* Creates a server operation and returns its details from the OpenAPI schema.
|
|
92
98
|
*
|
|
93
99
|
* @remarks
|
|
94
100
|
* This method submits a computation request to the personal server and returns
|
|
95
|
-
*
|
|
96
|
-
*
|
|
101
|
+
* the server's CreateOperationResponse. The response contains the operation ID
|
|
102
|
+
* which can be used with `waitForOperation()` to poll for completion.
|
|
97
103
|
*
|
|
98
104
|
* @param params - The operation request parameters
|
|
99
105
|
* @param params.permissionId - The permission ID authorizing this operation.
|
|
100
106
|
* Obtain via `vana.permissions.getUserPermissionGrantsOnChain()`.
|
|
101
|
-
* @returns
|
|
107
|
+
* @returns Server response with operation ID
|
|
102
108
|
* @throws {PersonalServerError} When the server request fails or parameters are invalid
|
|
103
109
|
* @throws {NetworkError} When personal server API communication fails
|
|
104
110
|
* @example
|
|
105
111
|
* ```typescript
|
|
106
|
-
* const
|
|
112
|
+
* const response = await vana.server.createOperation({
|
|
107
113
|
* permissionId: 123
|
|
108
114
|
* });
|
|
109
|
-
* console.log(`Operation ID: ${
|
|
115
|
+
* console.log(`Operation ID: ${response.id}`);
|
|
110
116
|
*
|
|
111
117
|
* // Wait for completion
|
|
112
|
-
* const result = await vana.server.waitForOperation(
|
|
118
|
+
* const result = await vana.server.waitForOperation(response.id);
|
|
113
119
|
* console.log("Result:", result.result);
|
|
114
120
|
* ```
|
|
115
121
|
*/
|
|
@@ -127,11 +133,7 @@ class ServerController extends BaseController {
|
|
|
127
133
|
};
|
|
128
134
|
console.debug("\u{1F50D} Debug - createOperation requestBody", requestBody);
|
|
129
135
|
const response = await this.makeRequest(requestBody);
|
|
130
|
-
return
|
|
131
|
-
id: response.id,
|
|
132
|
-
status: "starting",
|
|
133
|
-
createdAt: Date.now()
|
|
134
|
-
};
|
|
136
|
+
return response;
|
|
135
137
|
} catch (error) {
|
|
136
138
|
if (error instanceof Error) {
|
|
137
139
|
if (error instanceof NetworkError || error instanceof SerializationError || error instanceof SignatureError || error instanceof PersonalServerError) {
|
|
@@ -151,17 +153,20 @@ class ServerController extends BaseController {
|
|
|
151
153
|
* Retrieves the current status and result of a server operation.
|
|
152
154
|
*
|
|
153
155
|
* @remarks
|
|
154
|
-
* Common status values: `starting`, `
|
|
156
|
+
* Common status values: `starting`, `processing`, `succeeded`, `failed`, `canceled`.
|
|
155
157
|
* When status is `succeeded`, the result field contains the operation output.
|
|
158
|
+
* Returns the server response directly from the OpenAPI schema.
|
|
156
159
|
*
|
|
157
160
|
* @param operationId - The ID of the operation to query
|
|
158
|
-
* @returns The operation
|
|
161
|
+
* @returns The operation status response from the server
|
|
159
162
|
* @throws {NetworkError} When the API request fails or returns invalid data
|
|
160
163
|
* @example
|
|
161
164
|
* ```typescript
|
|
162
165
|
* const operation = await vana.server.getOperation(operationId);
|
|
163
166
|
* if (operation.status === 'succeeded') {
|
|
164
167
|
* console.log('Result:', operation.result);
|
|
168
|
+
* console.log('Started at:', operation.started_at);
|
|
169
|
+
* console.log('Finished at:', operation.finished_at);
|
|
165
170
|
* }
|
|
166
171
|
* ```
|
|
167
172
|
*/
|
|
@@ -169,7 +174,7 @@ class ServerController extends BaseController {
|
|
|
169
174
|
try {
|
|
170
175
|
console.debug("Polling Operation Status:", operationId);
|
|
171
176
|
const response = await fetch(
|
|
172
|
-
`${this.personalServerBaseUrl}
|
|
177
|
+
`${this.personalServerBaseUrl}${SERVER_PATHS.getOperationApiV1Operations_OperationId_Get(operationId)}`,
|
|
173
178
|
{
|
|
174
179
|
method: "GET",
|
|
175
180
|
headers: {
|
|
@@ -190,14 +195,7 @@ class ServerController extends BaseController {
|
|
|
190
195
|
}
|
|
191
196
|
const data = await response.json();
|
|
192
197
|
console.debug("Polling Success Response:", data);
|
|
193
|
-
return
|
|
194
|
-
id: data.id,
|
|
195
|
-
status: data.status,
|
|
196
|
-
createdAt: Date.now(),
|
|
197
|
-
updatedAt: Date.now(),
|
|
198
|
-
result: data.status === "succeeded" ? data.result : void 0,
|
|
199
|
-
error: data.status === "failed" ? data.result ?? void 0 : void 0
|
|
200
|
-
};
|
|
198
|
+
return data;
|
|
201
199
|
} catch (error) {
|
|
202
200
|
if (error instanceof NetworkError) {
|
|
203
201
|
throw error;
|
|
@@ -214,10 +212,11 @@ class ServerController extends BaseController {
|
|
|
214
212
|
* This method polls the operation status at regular intervals until it
|
|
215
213
|
* reaches a terminal state (succeeded, failed, or canceled). Supports
|
|
216
214
|
* ergonomic overloads to accept either an Operation object or just the ID.
|
|
215
|
+
* Returns the server response directly from the OpenAPI schema.
|
|
217
216
|
*
|
|
218
217
|
* @param opOrId - Either an Operation object or operation ID string
|
|
219
218
|
* @param options - Optional polling configuration
|
|
220
|
-
* @returns The completed operation with result
|
|
219
|
+
* @returns The completed operation with result and timestamp data
|
|
221
220
|
* @throws {PersonalServerError} When the operation fails or times out
|
|
222
221
|
* @example
|
|
223
222
|
* ```typescript
|
|
@@ -233,6 +232,10 @@ class ServerController extends BaseController {
|
|
|
233
232
|
* timeout: 60000,
|
|
234
233
|
* pollingInterval: 1000
|
|
235
234
|
* });
|
|
235
|
+
*
|
|
236
|
+
* // Access server-provided timestamps
|
|
237
|
+
* console.log('Started:', completed.started_at);
|
|
238
|
+
* console.log('Finished:', completed.finished_at);
|
|
236
239
|
* ```
|
|
237
240
|
*/
|
|
238
241
|
async waitForOperation(opOrId, options) {
|
|
@@ -246,8 +249,13 @@ class ServerController extends BaseController {
|
|
|
246
249
|
return operation;
|
|
247
250
|
}
|
|
248
251
|
if (operation.status === "failed") {
|
|
252
|
+
let errorMessage = "Unknown error";
|
|
253
|
+
if (operation.result) {
|
|
254
|
+
const resultObj = operation.result;
|
|
255
|
+
errorMessage = typeof resultObj.error === "string" ? resultObj.error : typeof resultObj.detail === "string" ? resultObj.detail : JSON.stringify(operation.result);
|
|
256
|
+
}
|
|
249
257
|
throw new PersonalServerError(
|
|
250
|
-
`Operation ${operation.status}: ${
|
|
258
|
+
`Operation ${operation.status}: ${errorMessage}`
|
|
251
259
|
);
|
|
252
260
|
}
|
|
253
261
|
if (operation.status === "canceled") {
|
|
@@ -267,6 +275,12 @@ class ServerController extends BaseController {
|
|
|
267
275
|
* The download requires authentication using the application's signature.
|
|
268
276
|
* This method returns the artifact as a Blob that can be saved or processed.
|
|
269
277
|
*
|
|
278
|
+
* **Simplified Signature Scheme:**
|
|
279
|
+
* The signature is generated over the operation ID only, allowing a single signature
|
|
280
|
+
* to be reused for listing and downloading multiple artifacts from the same operation.
|
|
281
|
+
* This simplifies client implementation while maintaining security - access to the
|
|
282
|
+
* operation ID grants access to all artifacts.
|
|
283
|
+
*
|
|
270
284
|
* @param params - The download parameters
|
|
271
285
|
* @param params.operationId - The operation ID that generated the artifact
|
|
272
286
|
* @param params.artifactPath - The path to the artifact file to download
|
|
@@ -297,18 +311,34 @@ class ServerController extends BaseController {
|
|
|
297
311
|
async downloadArtifact(params) {
|
|
298
312
|
this.assertWallet();
|
|
299
313
|
try {
|
|
300
|
-
const
|
|
301
|
-
operation_id: params.operationId
|
|
302
|
-
artifact_path: params.artifactPath
|
|
314
|
+
const signatureData = {
|
|
315
|
+
operation_id: params.operationId
|
|
303
316
|
};
|
|
304
|
-
const requestJson = JSON.stringify(
|
|
305
|
-
const
|
|
317
|
+
const requestJson = JSON.stringify(signatureData);
|
|
318
|
+
const messageHash = SignatureCache.hashMessage(signatureData);
|
|
319
|
+
let signature = SignatureCache.get(
|
|
320
|
+
this.context.platform.cache,
|
|
321
|
+
this.getAccountAddress(),
|
|
322
|
+
messageHash
|
|
323
|
+
);
|
|
324
|
+
if (!signature) {
|
|
325
|
+
signature = await this.createSignature(requestJson);
|
|
326
|
+
SignatureCache.set(
|
|
327
|
+
this.context.platform.cache,
|
|
328
|
+
this.getAccountAddress(),
|
|
329
|
+
messageHash,
|
|
330
|
+
signature,
|
|
331
|
+
24
|
|
332
|
+
// Cache for 24 hours since operation_id doesn't change
|
|
333
|
+
);
|
|
334
|
+
}
|
|
306
335
|
const requestBody = {
|
|
307
|
-
|
|
336
|
+
operation_id: params.operationId,
|
|
337
|
+
artifact_path: params.artifactPath,
|
|
308
338
|
signature
|
|
309
339
|
};
|
|
310
340
|
const response = await fetch(
|
|
311
|
-
`${this.personalServerBaseUrl}
|
|
341
|
+
`${this.personalServerBaseUrl}${SERVER_PATHS.downloadArtifactApiV1ArtifactsDownloadPost}`,
|
|
312
342
|
{
|
|
313
343
|
method: "POST",
|
|
314
344
|
headers: {
|
|
@@ -333,6 +363,95 @@ class ServerController extends BaseController {
|
|
|
333
363
|
);
|
|
334
364
|
}
|
|
335
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Lists all artifacts generated by a server operation.
|
|
368
|
+
*
|
|
369
|
+
* @remarks
|
|
370
|
+
* Retrieves metadata for all artifact files produced by an operation,
|
|
371
|
+
* including file paths, sizes, and content types. This provides visibility
|
|
372
|
+
* into available outputs without downloading them.
|
|
373
|
+
*
|
|
374
|
+
* **Simplified Signature Scheme:**
|
|
375
|
+
* Uses the same signature as downloadArtifact - signs only operation_id.
|
|
376
|
+
* This allows reusing the same signature for listing and downloading.
|
|
377
|
+
*
|
|
378
|
+
* @param operationId - The operation ID that generated the artifacts
|
|
379
|
+
* @returns Promise resolving to array of artifact metadata objects
|
|
380
|
+
* @throws {PersonalServerError} When artifacts cannot be listed
|
|
381
|
+
* @throws {NetworkError} When unable to reach the personal server API
|
|
382
|
+
* @throws {SignatureError} When unable to create the required signature
|
|
383
|
+
* @example
|
|
384
|
+
* ```typescript
|
|
385
|
+
* // List artifacts from a Gemini operation
|
|
386
|
+
* const artifacts = await vana.server.listArtifacts('op_123');
|
|
387
|
+
*
|
|
388
|
+
* console.log(`Found ${artifacts.length} artifacts:`);
|
|
389
|
+
* artifacts.forEach(artifact => {
|
|
390
|
+
* console.log(`- ${artifact.path} (${artifact.size} bytes)`);
|
|
391
|
+
* });
|
|
392
|
+
*
|
|
393
|
+
* // Download a specific artifact
|
|
394
|
+
* const blob = await vana.server.downloadArtifact({
|
|
395
|
+
* operationId: 'op_123',
|
|
396
|
+
* artifactPath: artifacts[0].path
|
|
397
|
+
* });
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
async listArtifacts(operationId) {
|
|
401
|
+
this.assertWallet();
|
|
402
|
+
try {
|
|
403
|
+
const signatureData = {
|
|
404
|
+
operation_id: operationId
|
|
405
|
+
};
|
|
406
|
+
const requestJson = JSON.stringify(signatureData);
|
|
407
|
+
const messageHash = SignatureCache.hashMessage(signatureData);
|
|
408
|
+
let signature = SignatureCache.get(
|
|
409
|
+
this.context.platform.cache,
|
|
410
|
+
this.getAccountAddress(),
|
|
411
|
+
messageHash
|
|
412
|
+
);
|
|
413
|
+
if (!signature) {
|
|
414
|
+
signature = await this.createSignature(requestJson);
|
|
415
|
+
SignatureCache.set(
|
|
416
|
+
this.context.platform.cache,
|
|
417
|
+
this.getAccountAddress(),
|
|
418
|
+
messageHash,
|
|
419
|
+
signature,
|
|
420
|
+
24
|
|
421
|
+
// Cache for 24 hours since operation_id doesn't change
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
const requestBody = {
|
|
425
|
+
operation_id: operationId,
|
|
426
|
+
signature
|
|
427
|
+
};
|
|
428
|
+
const response = await fetch(
|
|
429
|
+
`${this.personalServerBaseUrl}${SERVER_PATHS.listArtifactsApiV1Artifacts_OperationId_ListPost(operationId)}`,
|
|
430
|
+
{
|
|
431
|
+
method: "POST",
|
|
432
|
+
headers: {
|
|
433
|
+
"Content-Type": "application/json"
|
|
434
|
+
},
|
|
435
|
+
body: JSON.stringify(requestBody)
|
|
436
|
+
}
|
|
437
|
+
);
|
|
438
|
+
if (!response.ok) {
|
|
439
|
+
const errorText = await response.text();
|
|
440
|
+
throw new PersonalServerError(
|
|
441
|
+
`Failed to list artifacts: ${response.status} ${response.statusText} - ${errorText}`
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
const data = await response.json();
|
|
445
|
+
return data.artifacts ?? [];
|
|
446
|
+
} catch (error) {
|
|
447
|
+
if (error instanceof NetworkError || error instanceof PersonalServerError || error instanceof SignatureError) {
|
|
448
|
+
throw error;
|
|
449
|
+
}
|
|
450
|
+
throw new PersonalServerError(
|
|
451
|
+
`Failed to list artifacts: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
336
455
|
/**
|
|
337
456
|
* Cancels a running operation on the personal server.
|
|
338
457
|
*
|
|
@@ -380,7 +499,7 @@ class ServerController extends BaseController {
|
|
|
380
499
|
async cancelOperation(operationId) {
|
|
381
500
|
try {
|
|
382
501
|
const response = await fetch(
|
|
383
|
-
`${this.personalServerBaseUrl}
|
|
502
|
+
`${this.personalServerBaseUrl}${SERVER_PATHS.cancelOperationApiV1Operations_OperationId_CancelPost(operationId)}`,
|
|
384
503
|
{
|
|
385
504
|
method: "POST"
|
|
386
505
|
}
|
|
@@ -409,20 +528,23 @@ class ServerController extends BaseController {
|
|
|
409
528
|
async makeRequest(requestBody) {
|
|
410
529
|
try {
|
|
411
530
|
console.debug("Personal Server Request:", {
|
|
412
|
-
url: `${this.personalServerBaseUrl}
|
|
531
|
+
url: `${this.personalServerBaseUrl}${SERVER_PATHS.createOperationApiV1OperationsPost}`,
|
|
413
532
|
method: "POST",
|
|
414
533
|
headers: {
|
|
415
534
|
"Content-Type": "application/json"
|
|
416
535
|
},
|
|
417
536
|
body: requestBody
|
|
418
537
|
});
|
|
419
|
-
const response = await fetch(
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
538
|
+
const response = await fetch(
|
|
539
|
+
`${this.personalServerBaseUrl}${SERVER_PATHS.createOperationApiV1OperationsPost}`,
|
|
540
|
+
{
|
|
541
|
+
method: "POST",
|
|
542
|
+
headers: {
|
|
543
|
+
"Content-Type": "application/json"
|
|
544
|
+
},
|
|
545
|
+
body: JSON.stringify(requestBody)
|
|
546
|
+
}
|
|
547
|
+
);
|
|
426
548
|
if (!response.ok) {
|
|
427
549
|
const errorText = await response.text();
|
|
428
550
|
console.debug("Personal Server Error Response:", {
|
|
@@ -446,6 +568,23 @@ class ServerController extends BaseController {
|
|
|
446
568
|
);
|
|
447
569
|
}
|
|
448
570
|
}
|
|
571
|
+
/**
|
|
572
|
+
* Gets the account address from the wallet client.
|
|
573
|
+
*
|
|
574
|
+
* @returns The account address
|
|
575
|
+
* @throws {Error} When no account is available
|
|
576
|
+
*/
|
|
577
|
+
getAccountAddress() {
|
|
578
|
+
const client = this.context.applicationClient ?? this.context.walletClient;
|
|
579
|
+
if (!client) {
|
|
580
|
+
throw new Error("No client available for getting account address");
|
|
581
|
+
}
|
|
582
|
+
const { account } = client;
|
|
583
|
+
if (!account) {
|
|
584
|
+
throw new Error("No account available");
|
|
585
|
+
}
|
|
586
|
+
return typeof account === "string" ? account : account.address;
|
|
587
|
+
}
|
|
449
588
|
/**
|
|
450
589
|
* Creates a signature for the request JSON.
|
|
451
590
|
*
|
|
@@ -463,13 +602,9 @@ class ServerController extends BaseController {
|
|
|
463
602
|
if (!account) {
|
|
464
603
|
throw new SignatureError("No account available for signing");
|
|
465
604
|
}
|
|
466
|
-
if (account.type !== "local") {
|
|
467
|
-
throw new SignatureError(
|
|
468
|
-
"Only local accounts are supported for signing"
|
|
469
|
-
);
|
|
470
|
-
}
|
|
471
605
|
console.debug("\u{1F50D} Debug - createSignature account", account);
|
|
472
|
-
const signature = await
|
|
606
|
+
const signature = await client.signMessage({
|
|
607
|
+
account,
|
|
473
608
|
message: requestJson
|
|
474
609
|
});
|
|
475
610
|
return signature;
|