@opendatalabs/vana-sdk 0.1.0-alpha.eebb656 → 0.1.0-alpha.ef15099
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -351
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +33 -1
- package/dist/browser.js.map +1 -1
- package/dist/chains/definitions.cjs +9 -6
- package/dist/chains/definitions.cjs.map +1 -1
- package/dist/chains/definitions.d.ts +2 -0
- package/dist/chains/definitions.js +9 -6
- package/dist/chains/definitions.js.map +1 -1
- package/dist/chains/index.cjs.map +1 -1
- package/dist/chains/index.d.ts +30 -1
- package/dist/chains/index.js.map +1 -1
- package/dist/client/enhancedResponse.cjs +164 -0
- package/dist/client/enhancedResponse.cjs.map +1 -0
- package/dist/client/enhancedResponse.d.ts +120 -0
- package/dist/client/enhancedResponse.js +138 -0
- package/dist/client/enhancedResponse.js.map +1 -0
- package/dist/config/chains.cjs.map +1 -1
- package/dist/config/chains.d.ts +99 -0
- package/dist/config/chains.js.map +1 -1
- package/dist/config/contracts.config.cjs +400 -0
- package/dist/config/contracts.config.cjs.map +1 -0
- package/dist/config/contracts.config.d.ts +84 -0
- package/dist/config/contracts.config.js +375 -0
- package/dist/config/contracts.config.js.map +1 -0
- package/dist/config/default-services.cjs +60 -0
- package/dist/config/default-services.cjs.map +1 -0
- package/dist/config/default-services.d.ts +46 -0
- package/dist/config/default-services.js +33 -0
- package/dist/config/default-services.js.map +1 -0
- package/dist/config/default-services.test.d.ts +1 -0
- package/dist/contracts/contractController.cjs +1 -1
- package/dist/contracts/contractController.cjs.map +1 -1
- package/dist/contracts/contractController.d.ts +66 -10
- package/dist/contracts/contractController.js +1 -1
- package/dist/contracts/contractController.js.map +1 -1
- package/dist/controllers/__tests__/data-consistency-integration.test.d.ts +7 -0
- package/dist/controllers/__tests__/operations.processQueue.test.d.ts +1 -0
- package/dist/controllers/accessSettlement.cjs +289 -0
- package/dist/controllers/accessSettlement.cjs.map +1 -0
- package/dist/controllers/accessSettlement.d.ts +157 -0
- package/dist/controllers/accessSettlement.js +265 -0
- package/dist/controllers/accessSettlement.js.map +1 -0
- package/dist/controllers/accessSettlement.test.d.ts +1 -0
- package/dist/controllers/base.cjs +116 -0
- package/dist/controllers/base.cjs.map +1 -0
- package/dist/controllers/base.d.ts +94 -0
- package/dist/controllers/base.js +92 -0
- package/dist/controllers/base.js.map +1 -0
- package/dist/controllers/data.cjs +634 -352
- package/dist/controllers/data.cjs.map +1 -1
- package/dist/controllers/data.d.ts +348 -213
- package/dist/controllers/data.js +647 -355
- package/dist/controllers/data.js.map +1 -1
- package/dist/controllers/operations.cjs +430 -0
- package/dist/controllers/operations.cjs.map +1 -0
- package/dist/controllers/operations.d.ts +229 -0
- package/dist/controllers/operations.js +406 -0
- package/dist/controllers/operations.js.map +1 -0
- package/dist/controllers/permissions.cjs +943 -443
- package/dist/controllers/permissions.cjs.map +1 -1
- package/dist/controllers/permissions.d.ts +201 -120
- package/dist/controllers/permissions.js +943 -443
- package/dist/controllers/permissions.js.map +1 -1
- package/dist/controllers/protocol.cjs +14 -10
- package/dist/controllers/protocol.cjs.map +1 -1
- package/dist/controllers/protocol.d.ts +30 -31
- package/dist/controllers/protocol.js +14 -10
- package/dist/controllers/protocol.js.map +1 -1
- package/dist/controllers/runtimePermissions.cjs +272 -0
- package/dist/controllers/runtimePermissions.cjs.map +1 -0
- package/dist/controllers/runtimePermissions.d.ts +152 -0
- package/dist/controllers/runtimePermissions.js +251 -0
- package/dist/controllers/runtimePermissions.js.map +1 -0
- package/dist/controllers/runtimePermissions.test.d.ts +1 -0
- package/dist/controllers/schemas.cjs +113 -43
- package/dist/controllers/schemas.cjs.map +1 -1
- package/dist/controllers/schemas.d.ts +90 -43
- package/dist/controllers/schemas.js +113 -43
- package/dist/controllers/schemas.js.map +1 -1
- package/dist/controllers/server.cjs +276 -60
- package/dist/controllers/server.cjs.map +1 -1
- package/dist/controllers/server.d.ts +159 -54
- package/dist/controllers/server.js +276 -60
- package/dist/controllers/server.js.map +1 -1
- package/dist/core/__tests__/health.test.d.ts +1 -0
- package/dist/core/__tests__/inMemoryNonceManager.test.d.ts +1 -0
- package/dist/core/__tests__/nonceManager.test.d.ts +1 -0
- package/dist/core/__tests__/pollingManager.test.d.ts +4 -0
- package/dist/core/apiClient.cjs +53 -3
- package/dist/core/apiClient.cjs.map +1 -1
- package/dist/core/apiClient.d.ts +132 -7
- package/dist/core/apiClient.js +53 -3
- package/dist/core/apiClient.js.map +1 -1
- package/dist/core/generics.cjs +30 -3
- package/dist/core/generics.cjs.map +1 -1
- package/dist/core/generics.d.ts +95 -6
- package/dist/core/generics.js +30 -3
- package/dist/core/generics.js.map +1 -1
- package/dist/core/health.cjs +289 -0
- package/dist/core/health.cjs.map +1 -0
- package/dist/core/health.d.ts +143 -0
- package/dist/core/health.js +265 -0
- package/dist/core/health.js.map +1 -0
- package/dist/core/inMemoryNonceManager.cjs +138 -0
- package/dist/core/inMemoryNonceManager.cjs.map +1 -0
- package/dist/core/inMemoryNonceManager.d.ts +69 -0
- package/dist/core/inMemoryNonceManager.js +114 -0
- package/dist/core/inMemoryNonceManager.js.map +1 -0
- package/dist/core/nonceManager.cjs +304 -0
- package/dist/core/nonceManager.cjs.map +1 -0
- package/dist/core/nonceManager.d.ts +116 -0
- package/dist/core/nonceManager.js +280 -0
- package/dist/core/nonceManager.js.map +1 -0
- package/dist/core/pollingManager.cjs +292 -0
- package/dist/core/pollingManager.cjs.map +1 -0
- package/dist/core/pollingManager.d.ts +120 -0
- package/dist/core/pollingManager.js +268 -0
- package/dist/core/pollingManager.js.map +1 -0
- package/dist/core.cjs +164 -36
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +69 -10
- package/dist/core.js +167 -37
- package/dist/core.js.map +1 -1
- package/dist/crypto/ecies/__tests__/constants.test.d.ts +1 -1
- package/dist/crypto/ecies/__tests__/interface.test.d.ts +1 -0
- package/dist/crypto/ecies/__tests__/serialization.test.d.ts +8 -0
- package/dist/crypto/ecies/__tests__/utils.test.d.ts +1 -0
- package/dist/crypto/ecies/base.cjs +59 -23
- package/dist/crypto/ecies/base.cjs.map +1 -1
- package/dist/crypto/ecies/base.js +59 -23
- package/dist/crypto/ecies/base.js.map +1 -1
- package/dist/crypto/ecies/constants.cjs +2 -10
- package/dist/crypto/ecies/constants.cjs.map +1 -1
- package/dist/crypto/ecies/constants.d.ts +0 -9
- package/dist/crypto/ecies/constants.js +1 -8
- package/dist/crypto/ecies/constants.js.map +1 -1
- package/dist/crypto/ecies/interface.cjs +19 -2
- package/dist/crypto/ecies/interface.cjs.map +1 -1
- package/dist/crypto/ecies/interface.js +19 -2
- package/dist/crypto/ecies/interface.js.map +1 -1
- package/dist/errors.cjs +45 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +104 -0
- package/dist/errors.js +43 -0
- package/dist/errors.js.map +1 -1
- package/dist/generated/abi/AccessSettlementImplementation.cjs +635 -0
- package/dist/generated/abi/AccessSettlementImplementation.cjs.map +1 -0
- package/dist/generated/abi/AccessSettlementImplementation.d.ts +468 -0
- package/dist/generated/abi/AccessSettlementImplementation.js +611 -0
- package/dist/generated/abi/AccessSettlementImplementation.js.map +1 -0
- package/dist/generated/abi/AttestationPolicyImplementation.cjs +614 -0
- package/dist/generated/abi/AttestationPolicyImplementation.cjs.map +1 -0
- package/dist/generated/abi/AttestationPolicyImplementation.d.ts +449 -0
- package/dist/generated/abi/AttestationPolicyImplementation.js +590 -0
- package/dist/generated/abi/AttestationPolicyImplementation.js.map +1 -0
- package/dist/generated/abi/ComputeEngineImplementation.cjs.map +1 -1
- package/dist/generated/abi/ComputeEngineImplementation.js.map +1 -1
- package/dist/generated/abi/{DLPTreasuryImplementation.cjs → ComputeEngineTreasuryImplementation.cjs} +16 -92
- package/dist/generated/abi/ComputeEngineTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/{DLPTreasuryImplementation.d.ts → ComputeEngineTreasuryImplementation.d.ts} +9 -67
- package/dist/generated/abi/{DLPTreasuryImplementation.js → ComputeEngineTreasuryImplementation.js} +12 -88
- package/dist/generated/abi/ComputeEngineTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs.map +1 -1
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.js.map +1 -1
- package/dist/generated/abi/DATFactoryImplementation.cjs.map +1 -1
- package/dist/generated/abi/DATFactoryImplementation.js.map +1 -1
- package/dist/generated/abi/DATImplementation.cjs.map +1 -1
- package/dist/generated/abi/DATImplementation.js.map +1 -1
- package/dist/generated/abi/DATPausableImplementation.cjs.map +1 -1
- package/dist/generated/abi/DATPausableImplementation.js.map +1 -1
- package/dist/generated/abi/DATVotesImplementation.cjs.map +1 -1
- package/dist/generated/abi/DATVotesImplementation.js.map +1 -1
- package/dist/generated/abi/DLPPerformanceImplementation.cjs +42 -0
- package/dist/generated/abi/DLPPerformanceImplementation.cjs.map +1 -1
- package/dist/generated/abi/DLPPerformanceImplementation.d.ts +32 -0
- package/dist/generated/abi/DLPPerformanceImplementation.js +42 -0
- package/dist/generated/abi/DLPPerformanceImplementation.js.map +1 -1
- package/dist/generated/abi/DLPRegistryImplementation.cjs +5 -5
- package/dist/generated/abi/DLPRegistryImplementation.cjs.map +1 -1
- package/dist/generated/abi/DLPRegistryImplementation.d.ts +4 -4
- package/dist/generated/abi/DLPRegistryImplementation.js +5 -5
- package/dist/generated/abi/DLPRegistryImplementation.js.map +1 -1
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.cjs.map +1 -1
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.js.map +1 -1
- package/dist/generated/abi/DLPRewardDeployerImplementation.cjs +166 -2
- package/dist/generated/abi/DLPRewardDeployerImplementation.cjs.map +1 -1
- package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +129 -2
- package/dist/generated/abi/DLPRewardDeployerImplementation.js +166 -2
- package/dist/generated/abi/DLPRewardDeployerImplementation.js.map +1 -1
- package/dist/generated/abi/DLPRewardSwapImplementation.cjs.map +1 -1
- package/dist/generated/abi/DLPRewardSwapImplementation.js.map +1 -1
- package/dist/generated/abi/DataLiquidityPoolImplementation.cjs +282 -100
- package/dist/generated/abi/DataLiquidityPoolImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +218 -79
- package/dist/generated/abi/DataLiquidityPoolImplementation.js +281 -99
- package/dist/generated/abi/DataLiquidityPoolImplementation.js.map +1 -1
- package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs +167 -19
- package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataPortabilityGranteesImplementation.d.ts +127 -14
- package/dist/generated/abi/DataPortabilityGranteesImplementation.js +167 -19
- package/dist/generated/abi/DataPortabilityGranteesImplementation.js.map +1 -1
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs +0 -19
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.ts +0 -14
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.js +0 -19
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.js.map +1 -1
- package/dist/generated/abi/DataPortabilityServersImplementation.cjs +0 -19
- package/dist/generated/abi/DataPortabilityServersImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataPortabilityServersImplementation.d.ts +0 -14
- package/dist/generated/abi/DataPortabilityServersImplementation.js +0 -19
- package/dist/generated/abi/DataPortabilityServersImplementation.js.map +1 -1
- package/dist/generated/abi/DataRefinerRegistryImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataRefinerRegistryImplementation.js.map +1 -1
- package/dist/generated/abi/DataRegistryImplementation.cjs +0 -13
- package/dist/generated/abi/DataRegistryImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataRegistryImplementation.d.ts +0 -10
- package/dist/generated/abi/DataRegistryImplementation.js +0 -13
- package/dist/generated/abi/DataRegistryImplementation.js.map +1 -1
- package/dist/generated/abi/DatasetRegistryImplementation.cjs +751 -0
- package/dist/generated/abi/DatasetRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DatasetRegistryImplementation.d.ts +557 -0
- package/dist/generated/abi/DatasetRegistryImplementation.js +727 -0
- package/dist/generated/abi/DatasetRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/ProtocolConfigImplementation.cjs +578 -0
- package/dist/generated/abi/ProtocolConfigImplementation.cjs.map +1 -0
- package/dist/generated/abi/ProtocolConfigImplementation.d.ts +423 -0
- package/dist/generated/abi/ProtocolConfigImplementation.js +554 -0
- package/dist/generated/abi/ProtocolConfigImplementation.js.map +1 -0
- package/dist/generated/abi/QueryEngineImplementation.cjs.map +1 -1
- package/dist/generated/abi/QueryEngineImplementation.js.map +1 -1
- package/dist/generated/abi/SwapHelperImplementation.cjs +0 -43
- package/dist/generated/abi/SwapHelperImplementation.cjs.map +1 -1
- package/dist/generated/abi/SwapHelperImplementation.d.ts +0 -35
- package/dist/generated/abi/SwapHelperImplementation.js +0 -43
- package/dist/generated/abi/SwapHelperImplementation.js.map +1 -1
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.cjs.map +1 -1
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.js.map +1 -1
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.cjs.map +1 -1
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.js.map +1 -1
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.cjs.map +1 -1
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.js.map +1 -1
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.cjs.map +1 -1
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.js.map +1 -1
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.cjs.map +1 -1
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.js.map +1 -1
- package/dist/generated/abi/TeePoolPhalaImplementation.cjs.map +1 -1
- package/dist/generated/abi/TeePoolPhalaImplementation.js.map +1 -1
- package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.cjs +1251 -0
- package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.cjs.map +1 -0
- package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.d.ts +948 -0
- package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.js +1227 -0
- package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.js.map +1 -0
- package/dist/generated/abi/UniswapV3QuoterV2Implementation.cjs +297 -0
- package/dist/generated/abi/UniswapV3QuoterV2Implementation.cjs.map +1 -0
- package/dist/generated/abi/UniswapV3QuoterV2Implementation.d.ts +206 -0
- package/dist/generated/abi/UniswapV3QuoterV2Implementation.js +273 -0
- package/dist/generated/abi/UniswapV3QuoterV2Implementation.js.map +1 -0
- package/dist/generated/abi/VanaEpochImplementation.cjs +195 -0
- package/dist/generated/abi/VanaEpochImplementation.cjs.map +1 -1
- package/dist/generated/abi/VanaEpochImplementation.d.ts +151 -0
- package/dist/generated/abi/VanaEpochImplementation.js +195 -0
- package/dist/generated/abi/VanaEpochImplementation.js.map +1 -1
- package/dist/generated/abi/VanaPoolEntityImplementation.cjs +22 -65
- package/dist/generated/abi/VanaPoolEntityImplementation.cjs.map +1 -1
- package/dist/generated/abi/VanaPoolEntityImplementation.d.ts +17 -51
- package/dist/generated/abi/VanaPoolEntityImplementation.js +22 -65
- package/dist/generated/abi/VanaPoolEntityImplementation.js.map +1 -1
- package/dist/generated/abi/VanaPoolStakingImplementation.cjs +113 -1
- package/dist/generated/abi/VanaPoolStakingImplementation.cjs.map +1 -1
- package/dist/generated/abi/VanaPoolStakingImplementation.d.ts +85 -1
- package/dist/generated/abi/VanaPoolStakingImplementation.js +113 -1
- package/dist/generated/abi/VanaPoolStakingImplementation.js.map +1 -1
- package/dist/generated/abi/VanaPoolTreasuryImplementation.cjs.map +1 -1
- package/dist/generated/abi/VanaPoolTreasuryImplementation.js.map +1 -1
- package/dist/generated/abi/VanaRuntimePermissionsImplementation.cjs +759 -0
- package/dist/generated/abi/VanaRuntimePermissionsImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaRuntimePermissionsImplementation.d.ts +563 -0
- package/dist/generated/abi/VanaRuntimePermissionsImplementation.js +735 -0
- package/dist/generated/abi/VanaRuntimePermissionsImplementation.js.map +1 -0
- package/dist/generated/abi/VanaRuntimeServersImplementation.cjs +820 -0
- package/dist/generated/abi/VanaRuntimeServersImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaRuntimeServersImplementation.d.ts +609 -0
- package/dist/generated/abi/VanaRuntimeServersImplementation.js +796 -0
- package/dist/generated/abi/VanaRuntimeServersImplementation.js.map +1 -0
- package/dist/generated/abi/VanaTreasuryImplementation.cjs +536 -0
- package/dist/generated/abi/VanaTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaTreasuryImplementation.d.ts +393 -0
- package/dist/generated/abi/VanaTreasuryImplementation.js +512 -0
- package/dist/generated/abi/VanaTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/WVANAImplementation.cjs +339 -0
- package/dist/generated/abi/WVANAImplementation.cjs.map +1 -0
- package/dist/generated/abi/WVANAImplementation.d.ts +244 -0
- package/dist/generated/abi/WVANAImplementation.js +315 -0
- package/dist/generated/abi/WVANAImplementation.js.map +1 -0
- package/dist/generated/abi/index.cjs +79 -47
- package/dist/generated/abi/index.cjs.map +1 -1
- package/dist/generated/abi/index.d.ts +15783 -10449
- package/dist/generated/abi/index.js +65 -43
- package/dist/generated/abi/index.js.map +1 -1
- package/dist/{config → generated}/addresses.cjs +174 -75
- package/dist/generated/addresses.cjs.map +1 -0
- package/dist/{config → generated}/addresses.d.ts +174 -165
- package/dist/{config → generated}/addresses.js +174 -75
- package/dist/generated/addresses.js.map +1 -0
- package/dist/generated/event-types.cjs.map +1 -1
- package/dist/generated/event-types.d.ts +482 -399
- package/dist/generated/eventRegistry.cjs +2601 -724
- package/dist/generated/eventRegistry.cjs.map +1 -1
- package/dist/generated/eventRegistry.d.ts +2 -2
- package/dist/generated/eventRegistry.js +2601 -724
- package/dist/generated/eventRegistry.js.map +1 -1
- package/dist/generated/server/server-exports.cjs +22 -0
- package/dist/generated/server/server-exports.cjs.map +1 -1
- package/dist/generated/server/server-exports.d.ts +31 -11
- package/dist/generated/server/server-exports.js +17 -0
- package/dist/generated/server/server-exports.js.map +1 -1
- package/dist/generated/server/server.cjs.map +1 -1
- package/dist/generated/server/server.d.ts +771 -402
- package/dist/generated/subgraph.cjs +797 -32
- package/dist/generated/subgraph.cjs.map +1 -1
- package/dist/generated/subgraph.d.ts +135 -0
- package/dist/generated/subgraph.js +792 -32
- package/dist/generated/subgraph.js.map +1 -1
- package/dist/index.browser.d.ts +6 -1
- package/dist/index.browser.js +26 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.node.cjs +47 -4
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +60 -14
- package/dist/index.node.js +42 -3
- package/dist/index.node.js.map +1 -1
- package/dist/lib/__tests__/redisAtomicStore.test.d.ts +1 -0
- package/dist/lib/redisAtomicStore.cjs +201 -0
- package/dist/lib/redisAtomicStore.cjs.map +1 -0
- package/dist/lib/redisAtomicStore.d.ts +120 -0
- package/dist/lib/redisAtomicStore.js +177 -0
- package/dist/lib/redisAtomicStore.js.map +1 -0
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +39 -1
- package/dist/node.js.map +1 -1
- package/dist/platform/browser.cjs +160 -2
- package/dist/platform/browser.cjs.map +1 -1
- package/dist/platform/browser.d.ts +232 -12
- package/dist/platform/browser.js +160 -2
- package/dist/platform/browser.js.map +1 -1
- package/dist/platform/interface.cjs.map +1 -1
- package/dist/platform/interface.d.ts +283 -90
- package/dist/platform/node.cjs +163 -2
- package/dist/platform/node.cjs.map +1 -1
- package/dist/platform/node.d.ts +69 -6
- package/dist/platform/node.js +163 -2
- package/dist/platform/node.js.map +1 -1
- package/dist/server/relayerHandler.cjs +452 -0
- package/dist/server/relayerHandler.cjs.map +1 -0
- package/dist/server/relayerHandler.d.ts +69 -0
- package/dist/server/relayerHandler.js +428 -0
- package/dist/server/relayerHandler.js.map +1 -0
- package/dist/storage/index.cjs +3 -0
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/manager.cjs +108 -25
- package/dist/storage/manager.cjs.map +1 -1
- package/dist/storage/manager.d.ts +119 -25
- package/dist/storage/manager.js +108 -25
- package/dist/storage/manager.js.map +1 -1
- package/dist/storage/providers/callback-storage.cjs +86 -15
- package/dist/storage/providers/callback-storage.cjs.map +1 -1
- package/dist/storage/providers/callback-storage.d.ts +109 -20
- package/dist/storage/providers/callback-storage.js +86 -15
- package/dist/storage/providers/callback-storage.js.map +1 -1
- package/dist/storage/providers/dropbox.cjs +237 -0
- package/dist/storage/providers/dropbox.cjs.map +1 -0
- package/dist/storage/providers/dropbox.d.ts +39 -0
- package/dist/storage/providers/dropbox.js +215 -0
- package/dist/storage/providers/dropbox.js.map +1 -0
- package/dist/storage/providers/dropbox.test.d.ts +1 -0
- package/dist/storage/providers/pinata.cjs.map +1 -1
- package/dist/storage/providers/pinata.d.ts +12 -14
- package/dist/storage/providers/pinata.js.map +1 -1
- package/dist/tests/data-upload-owner-validation.test.d.ts +1 -0
- package/dist/tests/factories/mockFactory.d.ts +6 -6
- package/dist/tests/fakes/FakeWaitForTransactionEvents.d.ts +2 -2
- package/dist/tests/permissions-revoke-relayer.test.d.ts +1 -0
- package/dist/tests/permissions-transaction-options.test.d.ts +1 -0
- package/dist/tests/read-only-mode.test.d.ts +1 -0
- package/dist/tests/relayer-integration.test.d.ts +1 -0
- package/dist/tests/relayer-unified.test.d.ts +1 -0
- package/dist/tests/server-relayer-handler.test.d.ts +1 -0
- package/dist/types/accessSettlement.cjs +17 -0
- package/dist/types/accessSettlement.cjs.map +1 -0
- package/dist/types/accessSettlement.d.ts +66 -0
- package/dist/types/accessSettlement.js +1 -0
- package/dist/types/accessSettlement.js.map +1 -0
- package/dist/types/atomicStore.cjs +31 -0
- package/dist/types/atomicStore.cjs.map +1 -0
- package/dist/types/atomicStore.d.ts +236 -0
- package/dist/types/atomicStore.js +7 -0
- package/dist/types/atomicStore.js.map +1 -0
- package/dist/types/blockchain.cjs.map +1 -1
- package/dist/types/blockchain.d.ts +39 -11
- package/dist/types/chains.cjs.map +1 -1
- package/dist/types/chains.d.ts +74 -7
- package/dist/types/chains.js.map +1 -1
- package/dist/types/config.cjs +10 -0
- package/dist/types/config.cjs.map +1 -1
- package/dist/types/config.d.ts +217 -220
- package/dist/types/config.js +8 -0
- package/dist/types/config.js.map +1 -1
- package/dist/types/contracts.cjs.map +1 -1
- package/dist/types/contracts.d.ts +71 -7
- package/dist/types/controller-context.cjs.map +1 -1
- package/dist/types/controller-context.d.ts +12 -6
- package/dist/types/data.cjs.map +1 -1
- package/dist/types/data.d.ts +82 -10
- package/dist/types/generics.cjs.map +1 -1
- package/dist/types/generics.d.ts +81 -10
- package/dist/types/index.cjs +4 -0
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.ts +36 -6
- package/dist/types/index.js +9 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/operationStore.cjs +17 -0
- package/dist/types/operationStore.cjs.map +1 -0
- package/dist/types/operationStore.d.ts +171 -0
- package/dist/types/operationStore.js +1 -0
- package/dist/types/operationStore.js.map +1 -0
- package/dist/types/operations.cjs +3 -15
- package/dist/types/operations.cjs.map +1 -1
- package/dist/types/operations.d.ts +131 -39
- package/dist/types/operations.js +2 -13
- package/dist/types/operations.js.map +1 -1
- package/dist/types/options.cjs +17 -0
- package/dist/types/options.cjs.map +1 -0
- package/dist/types/options.d.ts +308 -0
- package/dist/types/options.js +1 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/permissions.cjs.map +1 -1
- package/dist/types/permissions.d.ts +19 -20
- package/dist/types/personal.cjs.map +1 -1
- package/dist/types/personal.d.ts +150 -14
- package/dist/types/relayer.cjs.map +1 -1
- package/dist/types/relayer.d.ts +307 -35
- package/dist/types/runtimePermissions.cjs +17 -0
- package/dist/types/runtimePermissions.cjs.map +1 -0
- package/dist/types/runtimePermissions.d.ts +122 -0
- package/dist/types/runtimePermissions.js +1 -0
- package/dist/types/runtimePermissions.js.map +1 -0
- package/dist/types/storage.cjs.map +1 -1
- package/dist/types/storage.d.ts +9 -21
- package/dist/types/storage.js.map +1 -1
- package/dist/types/utils.cjs.map +1 -1
- package/dist/types/utils.d.ts +0 -45
- package/dist/utils/__tests__/chainQuery.test.d.ts +1 -0
- package/dist/utils/__tests__/subgraphConsistency.test.d.ts +4 -0
- package/dist/utils/__tests__/subgraphPagination.test.d.ts +4 -0
- package/dist/utils/blockchain/registry.cjs +3 -3
- package/dist/utils/blockchain/registry.cjs.map +1 -1
- package/dist/utils/blockchain/registry.d.ts +1 -1
- package/dist/utils/blockchain/registry.js +3 -3
- package/dist/utils/blockchain/registry.js.map +1 -1
- package/dist/utils/chainQuery.cjs +107 -0
- package/dist/utils/chainQuery.cjs.map +1 -0
- package/dist/utils/chainQuery.d.ts +31 -0
- package/dist/utils/chainQuery.js +82 -0
- package/dist/utils/chainQuery.js.map +1 -0
- package/dist/utils/grantFiles.cjs +4 -1
- package/dist/utils/grantFiles.cjs.map +1 -1
- package/dist/utils/grantFiles.d.ts +10 -20
- package/dist/utils/grantFiles.js +4 -1
- package/dist/utils/grantFiles.js.map +1 -1
- package/dist/utils/grantValidation.cjs.map +1 -1
- package/dist/utils/grantValidation.d.ts +95 -16
- package/dist/utils/grantValidation.js.map +1 -1
- package/dist/utils/grants.cjs.map +1 -1
- package/dist/utils/grants.d.ts +93 -12
- package/dist/utils/grants.js.map +1 -1
- package/dist/utils/ipfs.cjs +2 -4
- package/dist/utils/ipfs.cjs.map +1 -1
- package/dist/utils/ipfs.d.ts +1 -1
- package/dist/utils/ipfs.js +2 -4
- package/dist/utils/ipfs.js.map +1 -1
- package/dist/utils/lazy-import.cjs.map +1 -1
- package/dist/utils/lazy-import.d.ts +32 -7
- package/dist/utils/lazy-import.js.map +1 -1
- package/dist/utils/multicall.cjs +1 -1
- package/dist/utils/multicall.cjs.map +1 -1
- package/dist/utils/multicall.js +1 -1
- package/dist/utils/multicall.js.map +1 -1
- package/dist/utils/runtimeGrantFiles.cjs +84 -0
- package/dist/utils/runtimeGrantFiles.cjs.map +1 -0
- package/dist/utils/runtimeGrantFiles.d.ts +66 -0
- package/dist/utils/runtimeGrantFiles.js +58 -0
- package/dist/utils/runtimeGrantFiles.js.map +1 -0
- package/dist/utils/signatureCache.cjs +8 -2
- package/dist/utils/signatureCache.cjs.map +1 -1
- package/dist/utils/signatureCache.d.ts +49 -8
- package/dist/utils/signatureCache.js +8 -2
- package/dist/utils/signatureCache.js.map +1 -1
- package/dist/utils/subgraphConsistency.cjs +184 -0
- package/dist/utils/subgraphConsistency.cjs.map +1 -0
- package/dist/utils/subgraphConsistency.d.ts +65 -0
- package/dist/utils/subgraphConsistency.js +155 -0
- package/dist/utils/subgraphConsistency.js.map +1 -0
- package/dist/utils/subgraphMetaCache.cjs +101 -0
- package/dist/utils/subgraphMetaCache.cjs.map +1 -0
- package/dist/utils/subgraphMetaCache.d.ts +56 -0
- package/dist/utils/subgraphMetaCache.js +76 -0
- package/dist/utils/subgraphMetaCache.js.map +1 -0
- package/dist/utils/subgraphPagination.cjs +104 -0
- package/dist/utils/subgraphPagination.cjs.map +1 -0
- package/dist/utils/subgraphPagination.d.ts +78 -0
- package/dist/utils/subgraphPagination.js +78 -0
- package/dist/utils/subgraphPagination.js.map +1 -0
- package/dist/utils/transactionHelpers.cjs.map +1 -1
- package/dist/utils/transactionHelpers.d.ts +12 -12
- package/dist/utils/transactionHelpers.js.map +1 -1
- package/dist/utils/typedDataConverter.cjs.map +1 -1
- package/dist/utils/typedDataConverter.d.ts +39 -3
- package/dist/utils/typedDataConverter.js.map +1 -1
- package/dist/utils/urlResolver.cjs +7 -0
- package/dist/utils/urlResolver.cjs.map +1 -1
- package/dist/utils/urlResolver.d.ts +22 -4
- package/dist/utils/urlResolver.js +7 -0
- package/dist/utils/urlResolver.js.map +1 -1
- package/dist/utils/wallet.cjs +63 -0
- package/dist/utils/wallet.cjs.map +1 -0
- package/dist/utils/wallet.d.ts +94 -0
- package/dist/utils/wallet.js +37 -0
- package/dist/utils/wallet.js.map +1 -0
- package/package.json +7 -2
- package/dist/config/addresses.cjs.map +0 -1
- package/dist/config/addresses.js.map +0 -1
- package/dist/generated/abi/DLPTreasuryImplementation.cjs.map +0 -1
- package/dist/generated/abi/DLPTreasuryImplementation.js.map +0 -1
- package/dist/server/handler.cjs +0 -101
- package/dist/server/handler.cjs.map +0 -1
- package/dist/server/handler.d.ts +0 -87
- package/dist/server/handler.js +0 -77
- package/dist/server/handler.js.map +0 -1
- /package/dist/{tests/server-handler.test.d.ts → client/__tests__/enhancedResponse.test.d.ts} +0 -0
package/dist/types/personal.d.ts
CHANGED
|
@@ -1,38 +1,174 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Defines parameters for posting data requests to personal servers.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Used to initiate data access requests that require user permission.
|
|
6
|
+
* The permission ID references a previously granted permission that
|
|
7
|
+
* authorizes the requester to access specific user data.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const params: PostRequestParams = {
|
|
12
|
+
* permissionId: 123
|
|
13
|
+
* };
|
|
14
|
+
*
|
|
15
|
+
* const response = await vana.personal.postRequest(params);
|
|
16
|
+
* console.log('Request posted:', response.requestId);
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @category Personal Server
|
|
3
20
|
*/
|
|
4
21
|
export interface PostRequestParams {
|
|
5
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* References a granted permission authorizing data access.
|
|
24
|
+
* Obtain via permission granting flow or query existing permissions.
|
|
25
|
+
* @throws {PermissionNotFoundError} If permission ID is invalid.
|
|
26
|
+
*/
|
|
6
27
|
permissionId: number;
|
|
7
28
|
}
|
|
8
29
|
/**
|
|
9
|
-
*
|
|
30
|
+
* Defines parameters for creating server-side operations.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Initiates asynchronous operations on the personal server that
|
|
34
|
+
* process user data according to granted permissions. Operations
|
|
35
|
+
* run in the background and can be monitored via their operation ID.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const params: CreateOperationParams = {
|
|
40
|
+
* permissionId: 456
|
|
41
|
+
* };
|
|
42
|
+
*
|
|
43
|
+
* const operation = await vana.server.createOperation(params);
|
|
44
|
+
* // Monitor operation status
|
|
45
|
+
* const status = await vana.server.getOperationStatus(operation.id);
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @category Personal Server
|
|
10
49
|
*/
|
|
11
50
|
export interface CreateOperationParams {
|
|
12
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* References the permission scope for this operation.
|
|
53
|
+
* Determines what data and actions are allowed.
|
|
54
|
+
* @throws {InsufficientPermissionsError} If permission scope is inadequate.
|
|
55
|
+
*/
|
|
13
56
|
permissionId: number;
|
|
14
57
|
}
|
|
15
58
|
/**
|
|
16
|
-
* Parameters for
|
|
59
|
+
* Parameters for downloading an artifact from a server operation.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* Artifacts are files generated during operations like Gemini agent analysis.
|
|
63
|
+
* The download requires authentication using the application's signature.
|
|
64
|
+
*
|
|
65
|
+
* @category Personal Server
|
|
66
|
+
*/
|
|
67
|
+
export interface DownloadArtifactParams {
|
|
68
|
+
/**
|
|
69
|
+
* The operation ID that generated the artifact.
|
|
70
|
+
*/
|
|
71
|
+
operationId: string;
|
|
72
|
+
/**
|
|
73
|
+
* The path to the artifact file to download.
|
|
74
|
+
*/
|
|
75
|
+
artifactPath: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Defines parameters for initializing personal server connections.
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* Establishes secure communication channels with a user's personal
|
|
82
|
+
* data server. The server manages encrypted user data and enforces
|
|
83
|
+
* permission-based access control. Initialization includes key exchange
|
|
84
|
+
* and session establishment.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const params: InitPersonalServerParams = {
|
|
89
|
+
* userAddress: '0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36'
|
|
90
|
+
* };
|
|
91
|
+
*
|
|
92
|
+
* const server = await vana.personal.initServer(params);
|
|
93
|
+
* console.log('Connected to server:', server.baseUrl);
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @category Personal Server
|
|
17
97
|
*/
|
|
18
98
|
export interface InitPersonalServerParams {
|
|
19
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Identifies the user whose personal server to connect to.
|
|
101
|
+
* Must be a valid Ethereum address in hex format.
|
|
102
|
+
* @example '0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36'
|
|
103
|
+
*/
|
|
20
104
|
userAddress: string;
|
|
21
105
|
}
|
|
22
106
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
107
|
+
* Represents comprehensive personal server identity and connection information.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* Combines core server identity with connection metadata required for
|
|
111
|
+
* establishing secure communication. Personal servers are user-controlled
|
|
112
|
+
* nodes that store and serve encrypted personal data according to
|
|
113
|
+
* user-defined permissions. This interface provides all necessary
|
|
114
|
+
* information to connect to and interact with a personal server.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const identity: PersonalServerIdentity = {
|
|
119
|
+
* kind: 'PersonalServer',
|
|
120
|
+
* address: '0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36',
|
|
121
|
+
* publicKey: '0x04...', // 65-byte uncompressed public key
|
|
122
|
+
* baseUrl: 'https://ps.user.vana.com',
|
|
123
|
+
* name: 'User Personal Server #1'
|
|
124
|
+
* };
|
|
125
|
+
*
|
|
126
|
+
* // Use identity to establish encrypted connection
|
|
127
|
+
* const encrypted = await crypto.encrypt(data, identity.publicKey);
|
|
128
|
+
* const response = await fetch(`${identity.baseUrl}/api/data`, {
|
|
129
|
+
* method: 'POST',
|
|
130
|
+
* body: encrypted
|
|
131
|
+
* });
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* @category Personal Server
|
|
26
135
|
*/
|
|
27
136
|
export interface PersonalServerIdentity {
|
|
28
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* Identifies the resource type for API disambiguation.
|
|
139
|
+
* Always 'PersonalServer' for personal server instances.
|
|
140
|
+
*/
|
|
29
141
|
kind: string;
|
|
30
|
-
/**
|
|
142
|
+
/**
|
|
143
|
+
* Uniquely identifies the server on the blockchain.
|
|
144
|
+
* Used for permission verification and identity proofs.
|
|
145
|
+
* @example '0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36'
|
|
146
|
+
*/
|
|
31
147
|
address: string;
|
|
32
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* Enables end-to-end encryption for data transmission.
|
|
150
|
+
* Must be in uncompressed format (65 bytes with 0x04 prefix).
|
|
151
|
+
* @example '0x04...' (130 hex characters)
|
|
152
|
+
*/
|
|
33
153
|
publicKey: string;
|
|
34
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* Provides the HTTPS endpoint for server API requests.
|
|
156
|
+
* Should not include trailing slashes or API paths.
|
|
157
|
+
* @example 'https://ps.user.vana.com'
|
|
158
|
+
*/
|
|
35
159
|
baseUrl: string;
|
|
36
|
-
/**
|
|
160
|
+
/**
|
|
161
|
+
* Displays a user-friendly identifier for the server.
|
|
162
|
+
* Used in UI components and logging for clarity.
|
|
163
|
+
* @example 'Primary Data Server'
|
|
164
|
+
*/
|
|
37
165
|
name: string;
|
|
38
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* @remarks
|
|
169
|
+
* Additional server response types are auto-generated from the OpenAPI
|
|
170
|
+
* specification and available in the server-exports module. Import those
|
|
171
|
+
* types directly when working with server API responses.
|
|
172
|
+
*
|
|
173
|
+
* @see {@link ../types/server-exports | Server Export Types}
|
|
174
|
+
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/relayer.ts"],"sourcesContent":["import type { Hash } from \"viem\";\nimport type { GrantFile, PermissionGrantTypedData } from \"./permissions\";\n\n/**\n * Response from the relayer service for grant file storage\n *\n * @category Advanced\n */\nexport interface RelayerStorageResponse {\n /** The IPFS URL where the grant file is stored */\n grantUrl: string;\n /** Success status */\n success: boolean;\n /** Optional error message */\n error?: string;\n /** Storage metadata */\n metadata?: {\n /** IPFS hash */\n ipfsHash: string;\n /** File size in bytes */\n size: number;\n /** Upload timestamp */\n timestamp: number;\n };\n}\n\n/**\n * Response from the relayer service for transaction submission\n *\n * @category Advanced\n */\nexport interface RelayerTransactionResponse {\n /** The transaction hash of the submitted transaction */\n transactionHash: Hash;\n /** Success status */\n success: boolean;\n /** Optional error message */\n error?: string;\n /** Transaction metadata */\n metadata?: {\n /** Gas used */\n gasUsed?: bigint;\n /** Gas price */\n gasPrice?: bigint;\n /** Block number */\n blockNumber?: bigint;\n /** Transaction status */\n status?: \"pending\" | \"confirmed\" | \"failed\";\n };\n}\n\n/**\n * Parameters for storing a grant file via relayer\n *\n * @category Advanced\n */\nexport interface RelayerStoreParams {\n /** The grant file to store */\n grantFile: GrantFile;\n /** Optional storage options */\n options?: {\n /** IPFS pin duration in seconds */\n pinDuration?: number;\n /** Whether to use encryption */\n encrypt?: boolean;\n /** Custom metadata */\n metadata?: Record<string, unknown>;\n };\n}\n\n/**\n * Parameters for submitting a transaction via relayer\n *\n * @category Advanced\n */\nexport interface RelayerSubmitParams {\n /** The signed typed data */\n typedData: PermissionGrantTypedData;\n /** The signature */\n signature: string;\n /** Optional transaction options */\n options?: {\n /** Gas limit */\n gasLimit?: bigint;\n /** Priority level */\n priority?: \"low\" | \"medium\" | \"high\";\n /** Whether to wait for confirmation */\n waitForConfirmation?: boolean;\n };\n}\n\n/**\n * Relayer service status\n *\n * @category Advanced\n */\nexport interface RelayerStatus {\n /** Whether the relayer is online */\n online: boolean;\n /** Service version */\n version: string;\n /** Supported chains */\n supportedChains: number[];\n /** Current chain status */\n chainStatus: Record<\n number,\n {\n /** Whether the chain is supported */\n supported: boolean;\n /** Current block number */\n currentBlock: bigint;\n /** Gas price estimation */\n gasPrice: bigint;\n /** Queue size */\n queueSize: number;\n }\n >;\n /** Rate limit information */\n rateLimits: {\n /** Requests per minute */\n requestsPerMinute: number;\n /** Storage requests per hour */\n storageRequestsPerHour: number;\n /** Transaction requests per hour */\n transactionRequestsPerHour: number;\n };\n}\n\n/**\n * Relayer configuration\n *\n * @category Advanced\n */\nexport interface RelayerConfig {\n /** Relayer service URL */\n url: string;\n /** API key for authentication */\n apiKey?: string;\n /** Timeout for requests in milliseconds */\n timeout?: number;\n /** Retry configuration */\n retry?: {\n /** Number of retry attempts */\n attempts: number;\n /** Delay between retries in milliseconds */\n delay: number;\n };\n /** Whether to use HTTPS */\n useHttps?: boolean;\n}\n\n/**\n * Relayer request options\n *\n * @category Advanced\n */\nexport interface RelayerRequestOptions {\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Whether to retry on failure */\n retry?: boolean;\n /** Custom headers */\n headers?: Record<string, string>;\n /** Request priority */\n priority?: \"low\" | \"medium\" | \"high\";\n}\n\n/**\n * Relayer error response\n *\n * @category Advanced\n */\nexport interface RelayerErrorResponse {\n /** Error code */\n code: string;\n /** Error message */\n message: string;\n /** Additional error details */\n details?: Record<string, unknown>;\n /** Request ID for debugging */\n requestId?: string;\n /** Timestamp of error */\n timestamp: number;\n}\n\n/**\n * Relayer queue information\n *\n * @category Advanced\n */\nexport interface RelayerQueueInfo {\n /** Current queue size */\n size: number;\n /** Estimated processing time in seconds */\n estimatedProcessingTime: number;\n /** Queue position for a specific request */\n position?: number;\n /** Processing statistics */\n stats: {\n /** Average processing time in seconds */\n averageProcessingTime: number;\n /** Requests processed in last hour */\n requestsProcessedHour: number;\n /** Success rate percentage */\n successRate: number;\n };\n}\n\n/**\n * Relayer transaction status\n *\n * @category Advanced\n */\nexport interface RelayerTransactionStatus {\n /** Transaction hash */\n transactionHash: Hash;\n /** Current status */\n status: \"pending\" | \"confirmed\" | \"failed\";\n /** Block number if confirmed */\n blockNumber?: bigint;\n /** Gas used */\n gasUsed?: bigint;\n /** Error message if failed */\n error?: string;\n /** Status checks performed */\n checks: Array<{\n /** Check timestamp */\n timestamp: number;\n /** Status at time of check */\n status: string;\n /** Block number at time of check */\n blockNumber: bigint;\n }>;\n}\n\n/**\n * Relayer metrics\n *\n * @category Advanced\n */\nexport interface RelayerMetrics {\n /** Total transactions processed */\n totalTransactions: number;\n /** Successful transactions */\n successfulTransactions: number;\n /** Failed transactions */\n failedTransactions: number;\n /** Average processing time in seconds */\n averageProcessingTime: number;\n /** Current queue size */\n queueSize: number;\n /** Uptime percentage */\n uptime: number;\n /** Last 24 hour statistics */\n last24Hours: {\n /** Transactions processed */\n transactions: number;\n /** Success rate */\n successRate: number;\n /** Average response time */\n averageResponseTime: number;\n };\n}\n\n/**\n * Relayer webhook configuration\n *\n * @category Advanced\n */\nexport interface RelayerWebhookConfig {\n /** Webhook URL */\n url: string;\n /** Events to subscribe to */\n events: Array<\n \"transaction_confirmed\" | \"transaction_failed\" | \"storage_complete\"\n >;\n /** Webhook secret for signature verification */\n secret?: string;\n /** Whether webhook is active */\n active: boolean;\n}\n\n/**\n * Relayer webhook payload\n *\n * @category Advanced\n */\nexport interface RelayerWebhookPayload {\n /** Event type */\n event: string;\n /** Event data */\n data: Record<string, unknown>;\n /** Timestamp */\n timestamp: number;\n /** Webhook ID */\n webhookId: string;\n /** Signature for verification */\n signature: string;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/relayer.ts"],"sourcesContent":["/**\n * Defines types for gasless transaction relayers and server operations.\n *\n * @remarks\n * This module provides comprehensive type definitions for interacting with\n * relayer services that enable gasless transactions and auxiliary operations.\n * It includes both legacy v1 types and the simplified v2 unified interface.\n *\n * @category Types\n * @module types/relayer\n */\n\nimport type { Hash, Address, TransactionReceipt } from \"viem\";\nimport type {\n GrantFile,\n PermissionGrantTypedData,\n GenericTypedData,\n} from \"./permissions\";\nimport type { RuntimeGrantFile } from \"./runtimePermissions\";\nimport type { Contract, Fn } from \"../generated/event-types\";\n\n/**\n * Represents the response from storing grant files via relayer.\n *\n * @remarks\n * Contains storage location, metadata, and error information for\n * grant file upload operations.\n *\n * @category Advanced\n */\nexport interface RelayerStorageResponse {\n /** The IPFS URL where the grant file is stored */\n grantUrl: string;\n /** Success status */\n success: boolean;\n /** Optional error message */\n error?: string;\n /** Storage metadata */\n metadata?: {\n /** IPFS hash */\n ipfsHash: string;\n /** File size in bytes */\n size: number;\n /** Upload timestamp */\n timestamp: number;\n };\n}\n\n/**\n * Represents the response from submitting transactions via relayer.\n *\n * @remarks\n * Contains transaction hash, status, and metadata for gasless\n * transaction submissions.\n *\n * @category Advanced\n */\nexport interface RelayerTransactionResponse {\n /** The transaction hash of the submitted transaction */\n transactionHash: Hash;\n /** Success status */\n success: boolean;\n /** Optional error message */\n error?: string;\n /** Transaction metadata */\n metadata?: {\n /** Gas used */\n gasUsed?: bigint;\n /** Gas price */\n gasPrice?: bigint;\n /** Block number */\n blockNumber?: bigint;\n /** Transaction status */\n status?: \"pending\" | \"confirmed\" | \"failed\";\n };\n}\n\n/**\n * Specifies parameters for storing grant files via relayer.\n *\n * @remarks\n * Includes the grant file and optional storage configuration\n * such as encryption and pinning duration.\n *\n * @category Advanced\n */\nexport interface RelayerStoreParams {\n /** The grant file to store */\n grantFile: GrantFile;\n /** Optional storage options */\n options?: {\n /** IPFS pin duration in seconds */\n pinDuration?: number;\n /** Whether to use encryption */\n encrypt?: boolean;\n /** Custom metadata */\n metadata?: Record<string, unknown>;\n };\n}\n\n/**\n * Specifies parameters for submitting gasless transactions.\n *\n * @remarks\n * Contains signed typed data and transaction configuration options\n * for relayer submission.\n *\n * @category Advanced\n */\nexport interface RelayerSubmitParams {\n /** The signed typed data */\n typedData: PermissionGrantTypedData;\n /** The signature */\n signature: string;\n /** Optional transaction options */\n options?: {\n /** Gas limit */\n gasLimit?: bigint;\n /** Priority level */\n priority?: \"low\" | \"medium\" | \"high\";\n /** Whether to wait for confirmation */\n waitForConfirmation?: boolean;\n };\n}\n\n/**\n * Represents the current status and capabilities of a relayer service.\n *\n * @remarks\n * Provides information about supported chains, rate limits, and\n * current operational status for monitoring and decision-making.\n *\n * @category Advanced\n */\nexport interface RelayerStatus {\n /** Whether the relayer is online */\n online: boolean;\n /** Service version */\n version: string;\n /** Supported chains */\n supportedChains: number[];\n /** Current chain status */\n chainStatus: Record<\n number,\n {\n /** Whether the chain is supported */\n supported: boolean;\n /** Current block number */\n currentBlock: bigint;\n /** Gas price estimation */\n gasPrice: bigint;\n /** Queue size */\n queueSize: number;\n }\n >;\n /** Rate limit information */\n rateLimits: {\n /** Requests per minute */\n requestsPerMinute: number;\n /** Storage requests per hour */\n storageRequestsPerHour: number;\n /** Transaction requests per hour */\n transactionRequestsPerHour: number;\n };\n}\n\n/**\n * Configures behavior for relayer requests.\n *\n * @remarks\n * Controls timeout, retry logic, headers, and priority for\n * relayer operation requests.\n *\n * @category Advanced\n */\nexport interface RelayerRequestOptions {\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Whether to retry on failure */\n retry?: boolean;\n /** Custom headers */\n headers?: Record<string, string>;\n /** Request priority */\n priority?: \"low\" | \"medium\" | \"high\";\n}\n\n/**\n * Represents an error response from the relayer service.\n *\n * @remarks\n * Provides structured error information including codes, messages,\n * and debugging details for error handling and recovery.\n *\n * @category Advanced\n */\nexport interface RelayerErrorResponse {\n /** Error code */\n code: string;\n /** Error message */\n message: string;\n /** Additional error details */\n details?: Record<string, unknown>;\n /** Request ID for debugging */\n requestId?: string;\n /** Timestamp of error */\n timestamp: number;\n}\n\n/**\n * Provides information about the relayer's processing queue.\n *\n * @remarks\n * Includes queue size, position, estimated processing time, and\n * performance statistics for queue monitoring.\n *\n * @category Advanced\n */\nexport interface RelayerQueueInfo {\n /** Current queue size */\n size: number;\n /** Estimated processing time in seconds */\n estimatedProcessingTime: number;\n /** Queue position for a specific request */\n position?: number;\n /** Processing statistics */\n stats: {\n /** Average processing time in seconds */\n averageProcessingTime: number;\n /** Requests processed in last hour */\n requestsProcessedHour: number;\n /** Success rate percentage */\n successRate: number;\n };\n}\n\n/**\n * Tracks the status of a transaction submitted via relayer.\n *\n * @remarks\n * Provides detailed tracking information including confirmation status,\n * gas usage, and historical status checks.\n *\n * @category Advanced\n */\nexport interface RelayerTransactionStatus {\n /** Transaction hash */\n transactionHash: Hash;\n /** Current status */\n status: \"pending\" | \"confirmed\" | \"failed\";\n /** Block number if confirmed */\n blockNumber?: bigint;\n /** Gas used */\n gasUsed?: bigint;\n /** Error message if failed */\n error?: string;\n /** Status checks performed */\n checks: Array<{\n /** Check timestamp */\n timestamp: number;\n /** Status at time of check */\n status: string;\n /** Block number at time of check */\n blockNumber: bigint;\n }>;\n}\n\n/**\n * Provides performance metrics for the relayer service.\n *\n * @remarks\n * Includes transaction statistics, success rates, processing times,\n * and uptime information for monitoring and optimization.\n *\n * @category Advanced\n */\nexport interface RelayerMetrics {\n /** Total transactions processed */\n totalTransactions: number;\n /** Successful transactions */\n successfulTransactions: number;\n /** Failed transactions */\n failedTransactions: number;\n /** Average processing time in seconds */\n averageProcessingTime: number;\n /** Current queue size */\n queueSize: number;\n /** Uptime percentage */\n uptime: number;\n /** Last 24 hour statistics */\n last24Hours: {\n /** Transactions processed */\n transactions: number;\n /** Success rate */\n successRate: number;\n /** Average response time */\n averageResponseTime: number;\n };\n}\n\n/**\n * Configures webhook notifications for relayer events.\n *\n * @remarks\n * Enables asynchronous notifications for transaction confirmations,\n * failures, and storage completions.\n *\n * @category Advanced\n */\nexport interface RelayerWebhookConfig {\n /** Webhook URL */\n url: string;\n /** Events to subscribe to */\n events: Array<\n \"transaction_confirmed\" | \"transaction_failed\" | \"storage_complete\"\n >;\n /** Webhook secret for signature verification */\n secret?: string;\n /** Whether webhook is active */\n active: boolean;\n}\n\n/**\n * Represents a webhook event payload from the relayer.\n *\n * @remarks\n * Contains event data, timestamp, and signature for verification\n * of webhook authenticity.\n *\n * @category Advanced\n */\nexport interface RelayerWebhookPayload {\n /** Event type */\n event: string;\n /** Event data */\n data: Record<string, unknown>;\n /** Timestamp */\n timestamp: number;\n /** Webhook ID */\n webhookId: string;\n /** Signature for verification */\n signature: string;\n}\n\n// ===== NEW SIMPLIFIED RELAYER TYPES (v2) =====\n\n/**\n * Handles both EIP-712 signed operations and direct server operations through a single interface.\n *\n * @remarks\n * This discriminated union provides type safety through TypeScript's narrowing.\n * The `type` field determines which operation variant is being used.\n * Signed operations require blockchain transactions, while direct operations\n * handle auxiliary tasks like file storage.\n *\n * @category Relayer\n * @see {@link https://docs.vana.org/docs/gasless-transactions | Gasless Transactions Guide}\n */\nexport type UnifiedRelayerRequest =\n | SignedRelayerRequest\n | DirectRelayerRequest\n | {\n type: \"status_check\";\n operationId: string;\n };\n\n/**\n * Represents an EIP-712 signed operation for gasless transaction submission.\n *\n * @remarks\n * Signed requests contain typed data and signatures that are verified\n * on-chain by smart contracts. The relayer pays gas fees on behalf of users.\n *\n * @category Relayer\n */\nexport interface SignedRelayerRequest {\n /** Discriminator field identifying this as a signed operation */\n type: \"signed\";\n /** Operation identifier for routing (e.g., 'submitAddPermission') */\n operation: SignedOperationType;\n /** EIP-712 typed data structure for the operation */\n typedData: GenericTypedData;\n /** User's signature of the typed data */\n signature: Hash;\n /** Optional address for additional signer verification */\n expectedUserAddress?: Address;\n}\n\n/**\n * Enumerates supported EIP-712 signed operation types.\n *\n * @remarks\n * Each operation type corresponds to a specific smart contract\n * function that accepts gasless transactions.\n *\n * @category Relayer\n */\nexport type SignedOperationType =\n | \"submitAddPermission\"\n | \"submitPermissionRevoke\"\n | \"submitTrustServer\"\n | \"submitAddAndTrustServer\"\n | \"submitUntrustServer\"\n | \"submitAddServerFilesAndPermissions\";\n// | \"submitRegisterGrantee\"; // TODO: Add when contract supports registerGranteeWithSignature\n\n/**\n * Represents direct server operations that don't require blockchain signatures.\n *\n * @remarks\n * Direct requests handle auxiliary operations like file uploads and grant storage.\n * These operations may still result in blockchain transactions but don't require\n * user signatures for gasless submission.\n *\n * @category Relayer\n */\nexport type DirectRelayerRequest =\n | {\n type: \"direct\";\n operation: \"submitFileAddition\";\n params: {\n url: string;\n userAddress: Address;\n };\n }\n | {\n type: \"direct\";\n operation: \"submitFileAdditionWithPermissions\";\n params: {\n url: string;\n userAddress: Address;\n permissions: Array<{ account: Address; key: string }>;\n };\n }\n | {\n type: \"direct\";\n operation: \"submitFileAdditionComplete\";\n params: {\n url: string;\n userAddress: Address;\n permissions: Array<{ account: Address; key: string }>;\n schemaId: number;\n ownerAddress?: Address;\n };\n }\n | {\n type: \"direct\";\n operation: \"storeGrantFile\";\n params: GrantFile | RuntimeGrantFile;\n }\n | {\n type: \"direct\";\n operation: \"submitRegisterGrantee\";\n params: {\n owner: Address;\n granteeAddress: Address;\n publicKey: string;\n };\n };\n\n/**\n * Context for transaction operations to enable proper event parsing.\n *\n * @remarks\n * This context is preserved in relayer responses to enable client-side\n * event parsing without requiring manual reconstruction of transaction details.\n *\n * @category Relayer\n */\nexport interface TransactionContext {\n /** The contract that was called */\n contract: Contract;\n /** The function that was called on the contract */\n fn: Fn<Contract>;\n /** The address that initiated the transaction */\n from: Address;\n}\n\n/**\n * Provides type-safe responses for all relayer operations.\n *\n * @remarks\n * The discriminated union ensures proper error handling and result typing.\n * Check the `type` field to determine success or failure before accessing results.\n * The new async pattern returns pending operations with operationIds for polling.\n *\n * Transaction responses include optional context to enable client-side event parsing\n * through the enhanced response pattern.\n *\n * @category Relayer\n */\nexport type UnifiedRelayerResponse =\n | {\n type: \"pending\";\n operationId: string;\n }\n | {\n type: \"submitted\";\n hash: Hash;\n /** Optional context for client-side event parsing and enhanced responses */\n context?: TransactionContext;\n }\n | {\n type: \"confirmed\";\n hash: Hash;\n // Receipt is optional; a performance hint for the client SDK's polling logic.\n receipt?: TransactionReceipt;\n }\n | {\n type: \"signed\";\n hash: Hash;\n /** Optional context for client-side event parsing and enhanced responses */\n context?: TransactionContext;\n }\n | {\n /** Non-transactional operations that complete immediately (e.g., IPFS uploads, file info) */\n type: \"direct\";\n /** The result data from the operation, structure depends on the specific operation */\n result: unknown;\n }\n | {\n type: \"error\";\n error: string;\n };\n\n/**\n * Simplified relayer configuration.\n * Can be a URL string for convenience, or a callback for full control.\n *\n * @category Configuration\n * @example\n * ```typescript\n * // Option 1: Simple URL (SDK handles the transport)\n * const vana = Vana({\n * walletClient,\n * relayer: '/api/relay'\n * });\n *\n * // Option 2: Full control with callback\n * const vana = Vana({\n * walletClient,\n * relayer: async (request) => {\n * const response = await fetch('/api/relay', {\n * method: 'POST',\n * body: JSON.stringify(request)\n * });\n * return response.json();\n * }\n * });\n * ```\n */\nexport type RelayerConfig =\n | string\n | ((request: UnifiedRelayerRequest) => Promise<UnifiedRelayerResponse>);\n\n/**\n * Simplified relayer callbacks interface (v2).\n * A single callback handles all relayer operations.\n *\n * @category Configuration\n * @example\n * ```typescript\n * const relayerCallbacks: RelayerCallbacksV2 = {\n * submit: async (request) => {\n * // Send to your server endpoint\n * const response = await fetch('/api/relay', {\n * method: 'POST',\n * headers: { 'Content-Type': 'application/json' },\n * body: JSON.stringify(request)\n * });\n * return response.json();\n * }\n * };\n * ```\n */\nexport interface RelayerCallbacksV2 {\n /**\n * Submits any relayer operation to the server.\n *\n * @remarks\n * This single callback handles all operations:\n * - EIP-712 signed operations (permissions, server trust, etc.)\n * - Direct operations (file additions, grant storage)\n *\n * On your server, pass the entire request object to the SDK's\n * `handleRelayerOperation` helper function.\n *\n * @param request - The unified request object.\n * Check `type` field to determine operation variant.\n * @returns Promise resolving to operation-specific response\n *\n * @example\n * ```typescript\n * async submit(request) {\n * const response = await fetch('/api/relay', {\n * method: 'POST',\n * body: JSON.stringify(request)\n * });\n * return response.json();\n * }\n * ```\n */\n submit: (request: UnifiedRelayerRequest) => Promise<UnifiedRelayerResponse>;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/types/relayer.d.ts
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
|
-
import type { Hash } from "viem";
|
|
2
|
-
import type { GrantFile, PermissionGrantTypedData } from "./permissions";
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
2
|
+
* Defines types for gasless transaction relayers and server operations.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This module provides comprehensive type definitions for interacting with
|
|
6
|
+
* relayer services that enable gasless transactions and auxiliary operations.
|
|
7
|
+
* It includes both legacy v1 types and the simplified v2 unified interface.
|
|
8
|
+
*
|
|
9
|
+
* @category Types
|
|
10
|
+
* @module types/relayer
|
|
11
|
+
*/
|
|
12
|
+
import type { Hash, Address, TransactionReceipt } from "viem";
|
|
13
|
+
import type { GrantFile, PermissionGrantTypedData, GenericTypedData } from "./permissions";
|
|
14
|
+
import type { RuntimeGrantFile } from "./runtimePermissions";
|
|
15
|
+
import type { Contract, Fn } from "../generated/event-types";
|
|
16
|
+
/**
|
|
17
|
+
* Represents the response from storing grant files via relayer.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Contains storage location, metadata, and error information for
|
|
21
|
+
* grant file upload operations.
|
|
5
22
|
*
|
|
6
23
|
* @category Advanced
|
|
7
24
|
*/
|
|
@@ -23,7 +40,11 @@ export interface RelayerStorageResponse {
|
|
|
23
40
|
};
|
|
24
41
|
}
|
|
25
42
|
/**
|
|
26
|
-
*
|
|
43
|
+
* Represents the response from submitting transactions via relayer.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* Contains transaction hash, status, and metadata for gasless
|
|
47
|
+
* transaction submissions.
|
|
27
48
|
*
|
|
28
49
|
* @category Advanced
|
|
29
50
|
*/
|
|
@@ -47,7 +68,11 @@ export interface RelayerTransactionResponse {
|
|
|
47
68
|
};
|
|
48
69
|
}
|
|
49
70
|
/**
|
|
50
|
-
*
|
|
71
|
+
* Specifies parameters for storing grant files via relayer.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* Includes the grant file and optional storage configuration
|
|
75
|
+
* such as encryption and pinning duration.
|
|
51
76
|
*
|
|
52
77
|
* @category Advanced
|
|
53
78
|
*/
|
|
@@ -65,7 +90,11 @@ export interface RelayerStoreParams {
|
|
|
65
90
|
};
|
|
66
91
|
}
|
|
67
92
|
/**
|
|
68
|
-
*
|
|
93
|
+
* Specifies parameters for submitting gasless transactions.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* Contains signed typed data and transaction configuration options
|
|
97
|
+
* for relayer submission.
|
|
69
98
|
*
|
|
70
99
|
* @category Advanced
|
|
71
100
|
*/
|
|
@@ -85,7 +114,11 @@ export interface RelayerSubmitParams {
|
|
|
85
114
|
};
|
|
86
115
|
}
|
|
87
116
|
/**
|
|
88
|
-
*
|
|
117
|
+
* Represents the current status and capabilities of a relayer service.
|
|
118
|
+
*
|
|
119
|
+
* @remarks
|
|
120
|
+
* Provides information about supported chains, rate limits, and
|
|
121
|
+
* current operational status for monitoring and decision-making.
|
|
89
122
|
*
|
|
90
123
|
* @category Advanced
|
|
91
124
|
*/
|
|
@@ -118,29 +151,11 @@ export interface RelayerStatus {
|
|
|
118
151
|
};
|
|
119
152
|
}
|
|
120
153
|
/**
|
|
121
|
-
*
|
|
154
|
+
* Configures behavior for relayer requests.
|
|
122
155
|
*
|
|
123
|
-
* @
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
/** Relayer service URL */
|
|
127
|
-
url: string;
|
|
128
|
-
/** API key for authentication */
|
|
129
|
-
apiKey?: string;
|
|
130
|
-
/** Timeout for requests in milliseconds */
|
|
131
|
-
timeout?: number;
|
|
132
|
-
/** Retry configuration */
|
|
133
|
-
retry?: {
|
|
134
|
-
/** Number of retry attempts */
|
|
135
|
-
attempts: number;
|
|
136
|
-
/** Delay between retries in milliseconds */
|
|
137
|
-
delay: number;
|
|
138
|
-
};
|
|
139
|
-
/** Whether to use HTTPS */
|
|
140
|
-
useHttps?: boolean;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Relayer request options
|
|
156
|
+
* @remarks
|
|
157
|
+
* Controls timeout, retry logic, headers, and priority for
|
|
158
|
+
* relayer operation requests.
|
|
144
159
|
*
|
|
145
160
|
* @category Advanced
|
|
146
161
|
*/
|
|
@@ -155,7 +170,11 @@ export interface RelayerRequestOptions {
|
|
|
155
170
|
priority?: "low" | "medium" | "high";
|
|
156
171
|
}
|
|
157
172
|
/**
|
|
158
|
-
*
|
|
173
|
+
* Represents an error response from the relayer service.
|
|
174
|
+
*
|
|
175
|
+
* @remarks
|
|
176
|
+
* Provides structured error information including codes, messages,
|
|
177
|
+
* and debugging details for error handling and recovery.
|
|
159
178
|
*
|
|
160
179
|
* @category Advanced
|
|
161
180
|
*/
|
|
@@ -172,7 +191,11 @@ export interface RelayerErrorResponse {
|
|
|
172
191
|
timestamp: number;
|
|
173
192
|
}
|
|
174
193
|
/**
|
|
175
|
-
*
|
|
194
|
+
* Provides information about the relayer's processing queue.
|
|
195
|
+
*
|
|
196
|
+
* @remarks
|
|
197
|
+
* Includes queue size, position, estimated processing time, and
|
|
198
|
+
* performance statistics for queue monitoring.
|
|
176
199
|
*
|
|
177
200
|
* @category Advanced
|
|
178
201
|
*/
|
|
@@ -194,7 +217,11 @@ export interface RelayerQueueInfo {
|
|
|
194
217
|
};
|
|
195
218
|
}
|
|
196
219
|
/**
|
|
197
|
-
*
|
|
220
|
+
* Tracks the status of a transaction submitted via relayer.
|
|
221
|
+
*
|
|
222
|
+
* @remarks
|
|
223
|
+
* Provides detailed tracking information including confirmation status,
|
|
224
|
+
* gas usage, and historical status checks.
|
|
198
225
|
*
|
|
199
226
|
* @category Advanced
|
|
200
227
|
*/
|
|
@@ -220,7 +247,11 @@ export interface RelayerTransactionStatus {
|
|
|
220
247
|
}>;
|
|
221
248
|
}
|
|
222
249
|
/**
|
|
223
|
-
*
|
|
250
|
+
* Provides performance metrics for the relayer service.
|
|
251
|
+
*
|
|
252
|
+
* @remarks
|
|
253
|
+
* Includes transaction statistics, success rates, processing times,
|
|
254
|
+
* and uptime information for monitoring and optimization.
|
|
224
255
|
*
|
|
225
256
|
* @category Advanced
|
|
226
257
|
*/
|
|
@@ -248,7 +279,11 @@ export interface RelayerMetrics {
|
|
|
248
279
|
};
|
|
249
280
|
}
|
|
250
281
|
/**
|
|
251
|
-
*
|
|
282
|
+
* Configures webhook notifications for relayer events.
|
|
283
|
+
*
|
|
284
|
+
* @remarks
|
|
285
|
+
* Enables asynchronous notifications for transaction confirmations,
|
|
286
|
+
* failures, and storage completions.
|
|
252
287
|
*
|
|
253
288
|
* @category Advanced
|
|
254
289
|
*/
|
|
@@ -263,7 +298,11 @@ export interface RelayerWebhookConfig {
|
|
|
263
298
|
active: boolean;
|
|
264
299
|
}
|
|
265
300
|
/**
|
|
266
|
-
*
|
|
301
|
+
* Represents a webhook event payload from the relayer.
|
|
302
|
+
*
|
|
303
|
+
* @remarks
|
|
304
|
+
* Contains event data, timestamp, and signature for verification
|
|
305
|
+
* of webhook authenticity.
|
|
267
306
|
*
|
|
268
307
|
* @category Advanced
|
|
269
308
|
*/
|
|
@@ -279,3 +318,236 @@ export interface RelayerWebhookPayload {
|
|
|
279
318
|
/** Signature for verification */
|
|
280
319
|
signature: string;
|
|
281
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* Handles both EIP-712 signed operations and direct server operations through a single interface.
|
|
323
|
+
*
|
|
324
|
+
* @remarks
|
|
325
|
+
* This discriminated union provides type safety through TypeScript's narrowing.
|
|
326
|
+
* The `type` field determines which operation variant is being used.
|
|
327
|
+
* Signed operations require blockchain transactions, while direct operations
|
|
328
|
+
* handle auxiliary tasks like file storage.
|
|
329
|
+
*
|
|
330
|
+
* @category Relayer
|
|
331
|
+
* @see {@link https://docs.vana.org/docs/gasless-transactions | Gasless Transactions Guide}
|
|
332
|
+
*/
|
|
333
|
+
export type UnifiedRelayerRequest = SignedRelayerRequest | DirectRelayerRequest | {
|
|
334
|
+
type: "status_check";
|
|
335
|
+
operationId: string;
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
* Represents an EIP-712 signed operation for gasless transaction submission.
|
|
339
|
+
*
|
|
340
|
+
* @remarks
|
|
341
|
+
* Signed requests contain typed data and signatures that are verified
|
|
342
|
+
* on-chain by smart contracts. The relayer pays gas fees on behalf of users.
|
|
343
|
+
*
|
|
344
|
+
* @category Relayer
|
|
345
|
+
*/
|
|
346
|
+
export interface SignedRelayerRequest {
|
|
347
|
+
/** Discriminator field identifying this as a signed operation */
|
|
348
|
+
type: "signed";
|
|
349
|
+
/** Operation identifier for routing (e.g., 'submitAddPermission') */
|
|
350
|
+
operation: SignedOperationType;
|
|
351
|
+
/** EIP-712 typed data structure for the operation */
|
|
352
|
+
typedData: GenericTypedData;
|
|
353
|
+
/** User's signature of the typed data */
|
|
354
|
+
signature: Hash;
|
|
355
|
+
/** Optional address for additional signer verification */
|
|
356
|
+
expectedUserAddress?: Address;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Enumerates supported EIP-712 signed operation types.
|
|
360
|
+
*
|
|
361
|
+
* @remarks
|
|
362
|
+
* Each operation type corresponds to a specific smart contract
|
|
363
|
+
* function that accepts gasless transactions.
|
|
364
|
+
*
|
|
365
|
+
* @category Relayer
|
|
366
|
+
*/
|
|
367
|
+
export type SignedOperationType = "submitAddPermission" | "submitPermissionRevoke" | "submitTrustServer" | "submitAddAndTrustServer" | "submitUntrustServer" | "submitAddServerFilesAndPermissions";
|
|
368
|
+
/**
|
|
369
|
+
* Represents direct server operations that don't require blockchain signatures.
|
|
370
|
+
*
|
|
371
|
+
* @remarks
|
|
372
|
+
* Direct requests handle auxiliary operations like file uploads and grant storage.
|
|
373
|
+
* These operations may still result in blockchain transactions but don't require
|
|
374
|
+
* user signatures for gasless submission.
|
|
375
|
+
*
|
|
376
|
+
* @category Relayer
|
|
377
|
+
*/
|
|
378
|
+
export type DirectRelayerRequest = {
|
|
379
|
+
type: "direct";
|
|
380
|
+
operation: "submitFileAddition";
|
|
381
|
+
params: {
|
|
382
|
+
url: string;
|
|
383
|
+
userAddress: Address;
|
|
384
|
+
};
|
|
385
|
+
} | {
|
|
386
|
+
type: "direct";
|
|
387
|
+
operation: "submitFileAdditionWithPermissions";
|
|
388
|
+
params: {
|
|
389
|
+
url: string;
|
|
390
|
+
userAddress: Address;
|
|
391
|
+
permissions: Array<{
|
|
392
|
+
account: Address;
|
|
393
|
+
key: string;
|
|
394
|
+
}>;
|
|
395
|
+
};
|
|
396
|
+
} | {
|
|
397
|
+
type: "direct";
|
|
398
|
+
operation: "submitFileAdditionComplete";
|
|
399
|
+
params: {
|
|
400
|
+
url: string;
|
|
401
|
+
userAddress: Address;
|
|
402
|
+
permissions: Array<{
|
|
403
|
+
account: Address;
|
|
404
|
+
key: string;
|
|
405
|
+
}>;
|
|
406
|
+
schemaId: number;
|
|
407
|
+
ownerAddress?: Address;
|
|
408
|
+
};
|
|
409
|
+
} | {
|
|
410
|
+
type: "direct";
|
|
411
|
+
operation: "storeGrantFile";
|
|
412
|
+
params: GrantFile | RuntimeGrantFile;
|
|
413
|
+
} | {
|
|
414
|
+
type: "direct";
|
|
415
|
+
operation: "submitRegisterGrantee";
|
|
416
|
+
params: {
|
|
417
|
+
owner: Address;
|
|
418
|
+
granteeAddress: Address;
|
|
419
|
+
publicKey: string;
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
/**
|
|
423
|
+
* Context for transaction operations to enable proper event parsing.
|
|
424
|
+
*
|
|
425
|
+
* @remarks
|
|
426
|
+
* This context is preserved in relayer responses to enable client-side
|
|
427
|
+
* event parsing without requiring manual reconstruction of transaction details.
|
|
428
|
+
*
|
|
429
|
+
* @category Relayer
|
|
430
|
+
*/
|
|
431
|
+
export interface TransactionContext {
|
|
432
|
+
/** The contract that was called */
|
|
433
|
+
contract: Contract;
|
|
434
|
+
/** The function that was called on the contract */
|
|
435
|
+
fn: Fn<Contract>;
|
|
436
|
+
/** The address that initiated the transaction */
|
|
437
|
+
from: Address;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Provides type-safe responses for all relayer operations.
|
|
441
|
+
*
|
|
442
|
+
* @remarks
|
|
443
|
+
* The discriminated union ensures proper error handling and result typing.
|
|
444
|
+
* Check the `type` field to determine success or failure before accessing results.
|
|
445
|
+
* The new async pattern returns pending operations with operationIds for polling.
|
|
446
|
+
*
|
|
447
|
+
* Transaction responses include optional context to enable client-side event parsing
|
|
448
|
+
* through the enhanced response pattern.
|
|
449
|
+
*
|
|
450
|
+
* @category Relayer
|
|
451
|
+
*/
|
|
452
|
+
export type UnifiedRelayerResponse = {
|
|
453
|
+
type: "pending";
|
|
454
|
+
operationId: string;
|
|
455
|
+
} | {
|
|
456
|
+
type: "submitted";
|
|
457
|
+
hash: Hash;
|
|
458
|
+
/** Optional context for client-side event parsing and enhanced responses */
|
|
459
|
+
context?: TransactionContext;
|
|
460
|
+
} | {
|
|
461
|
+
type: "confirmed";
|
|
462
|
+
hash: Hash;
|
|
463
|
+
receipt?: TransactionReceipt;
|
|
464
|
+
} | {
|
|
465
|
+
type: "signed";
|
|
466
|
+
hash: Hash;
|
|
467
|
+
/** Optional context for client-side event parsing and enhanced responses */
|
|
468
|
+
context?: TransactionContext;
|
|
469
|
+
} | {
|
|
470
|
+
/** Non-transactional operations that complete immediately (e.g., IPFS uploads, file info) */
|
|
471
|
+
type: "direct";
|
|
472
|
+
/** The result data from the operation, structure depends on the specific operation */
|
|
473
|
+
result: unknown;
|
|
474
|
+
} | {
|
|
475
|
+
type: "error";
|
|
476
|
+
error: string;
|
|
477
|
+
};
|
|
478
|
+
/**
|
|
479
|
+
* Simplified relayer configuration.
|
|
480
|
+
* Can be a URL string for convenience, or a callback for full control.
|
|
481
|
+
*
|
|
482
|
+
* @category Configuration
|
|
483
|
+
* @example
|
|
484
|
+
* ```typescript
|
|
485
|
+
* // Option 1: Simple URL (SDK handles the transport)
|
|
486
|
+
* const vana = Vana({
|
|
487
|
+
* walletClient,
|
|
488
|
+
* relayer: '/api/relay'
|
|
489
|
+
* });
|
|
490
|
+
*
|
|
491
|
+
* // Option 2: Full control with callback
|
|
492
|
+
* const vana = Vana({
|
|
493
|
+
* walletClient,
|
|
494
|
+
* relayer: async (request) => {
|
|
495
|
+
* const response = await fetch('/api/relay', {
|
|
496
|
+
* method: 'POST',
|
|
497
|
+
* body: JSON.stringify(request)
|
|
498
|
+
* });
|
|
499
|
+
* return response.json();
|
|
500
|
+
* }
|
|
501
|
+
* });
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
export type RelayerConfig = string | ((request: UnifiedRelayerRequest) => Promise<UnifiedRelayerResponse>);
|
|
505
|
+
/**
|
|
506
|
+
* Simplified relayer callbacks interface (v2).
|
|
507
|
+
* A single callback handles all relayer operations.
|
|
508
|
+
*
|
|
509
|
+
* @category Configuration
|
|
510
|
+
* @example
|
|
511
|
+
* ```typescript
|
|
512
|
+
* const relayerCallbacks: RelayerCallbacksV2 = {
|
|
513
|
+
* submit: async (request) => {
|
|
514
|
+
* // Send to your server endpoint
|
|
515
|
+
* const response = await fetch('/api/relay', {
|
|
516
|
+
* method: 'POST',
|
|
517
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
518
|
+
* body: JSON.stringify(request)
|
|
519
|
+
* });
|
|
520
|
+
* return response.json();
|
|
521
|
+
* }
|
|
522
|
+
* };
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
export interface RelayerCallbacksV2 {
|
|
526
|
+
/**
|
|
527
|
+
* Submits any relayer operation to the server.
|
|
528
|
+
*
|
|
529
|
+
* @remarks
|
|
530
|
+
* This single callback handles all operations:
|
|
531
|
+
* - EIP-712 signed operations (permissions, server trust, etc.)
|
|
532
|
+
* - Direct operations (file additions, grant storage)
|
|
533
|
+
*
|
|
534
|
+
* On your server, pass the entire request object to the SDK's
|
|
535
|
+
* `handleRelayerOperation` helper function.
|
|
536
|
+
*
|
|
537
|
+
* @param request - The unified request object.
|
|
538
|
+
* Check `type` field to determine operation variant.
|
|
539
|
+
* @returns Promise resolving to operation-specific response
|
|
540
|
+
*
|
|
541
|
+
* @example
|
|
542
|
+
* ```typescript
|
|
543
|
+
* async submit(request) {
|
|
544
|
+
* const response = await fetch('/api/relay', {
|
|
545
|
+
* method: 'POST',
|
|
546
|
+
* body: JSON.stringify(request)
|
|
547
|
+
* });
|
|
548
|
+
* return response.json();
|
|
549
|
+
* }
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
submit: (request: UnifiedRelayerRequest) => Promise<UnifiedRelayerResponse>;
|
|
553
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var runtimePermissions_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(runtimePermissions_exports);
|
|
17
|
+
//# sourceMappingURL=runtimePermissions.cjs.map
|