@opendatalabs/vana-sdk 2.3.0 → 3.0.1
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 +76 -92
- package/dist/auth/errors.cjs +54 -0
- package/dist/auth/errors.cjs.map +1 -0
- package/dist/auth/errors.d.ts +26 -0
- package/dist/auth/errors.js +28 -0
- package/dist/auth/errors.js.map +1 -0
- package/dist/auth/pkce.cjs +100 -0
- package/dist/auth/pkce.cjs.map +1 -0
- package/dist/auth/pkce.d.ts +55 -0
- package/dist/auth/pkce.js +71 -0
- package/dist/auth/pkce.js.map +1 -0
- package/dist/auth/token-store.cjs +59 -0
- package/dist/auth/token-store.cjs.map +1 -0
- package/dist/auth/token-store.d.ts +61 -0
- package/dist/auth/token-store.js +35 -0
- package/dist/auth/token-store.js.map +1 -0
- package/dist/auth/web3-signed-builder.cjs +70 -0
- package/dist/auth/web3-signed-builder.cjs.map +1 -0
- package/dist/auth/web3-signed-builder.d.ts +47 -0
- package/dist/auth/web3-signed-builder.js +45 -0
- package/dist/auth/web3-signed-builder.js.map +1 -0
- package/dist/auth/web3-signed.cjs +150 -0
- package/dist/auth/web3-signed.cjs.map +1 -0
- package/dist/auth/web3-signed.d.ts +59 -0
- package/dist/auth/web3-signed.js +129 -0
- package/dist/auth/web3-signed.js.map +1 -0
- package/dist/chains/definitions.cjs +2 -6
- package/dist/chains/definitions.cjs.map +1 -1
- package/dist/chains/definitions.d.ts +1 -7
- package/dist/chains/definitions.js +2 -6
- package/dist/chains/definitions.js.map +1 -1
- package/dist/config/chains.d.ts +18 -0
- package/dist/config/contracts.config.cjs +7 -95
- package/dist/config/contracts.config.cjs.map +1 -1
- package/dist/config/contracts.config.d.ts +0 -54
- package/dist/config/contracts.config.js +6 -93
- package/dist/config/contracts.config.js.map +1 -1
- package/dist/config/default-services.cjs +0 -10
- package/dist/config/default-services.cjs.map +1 -1
- package/dist/config/default-services.d.ts +1 -20
- package/dist/config/default-services.js +0 -9
- package/dist/config/default-services.js.map +1 -1
- package/dist/crypto/ecies/interface.cjs +2 -0
- package/dist/crypto/ecies/interface.cjs.map +1 -1
- package/dist/crypto/ecies/interface.js +2 -0
- package/dist/crypto/ecies/interface.js.map +1 -1
- package/dist/crypto/envelope/openpgp.cjs +59 -0
- package/dist/crypto/envelope/openpgp.cjs.map +1 -0
- package/dist/crypto/envelope/openpgp.d.ts +28 -0
- package/dist/crypto/envelope/openpgp.js +24 -0
- package/dist/crypto/envelope/openpgp.js.map +1 -0
- package/dist/crypto/keys/derive.cjs +65 -0
- package/dist/crypto/keys/derive.cjs.map +1 -0
- package/dist/crypto/keys/derive.d.ts +45 -0
- package/dist/crypto/keys/derive.js +38 -0
- package/dist/crypto/keys/derive.js.map +1 -0
- package/dist/errors.cjs +10 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.js +10 -0
- package/dist/errors.js.map +1 -1
- package/dist/generated/abi/index.cjs +2 -37
- package/dist/generated/abi/index.cjs.map +1 -1
- package/dist/generated/abi/index.d.ts +2683 -9296
- package/dist/generated/abi/index.js +2 -29
- package/dist/generated/abi/index.js.map +1 -1
- package/dist/generated/addresses.cjs +5 -107
- package/dist/generated/addresses.cjs.map +1 -1
- package/dist/generated/addresses.d.ts +5 -99
- package/dist/generated/addresses.js +5 -105
- package/dist/generated/addresses.js.map +1 -1
- package/dist/index.browser.d.ts +24 -140
- package/dist/index.browser.js +32258 -114
- package/dist/index.browser.js.map +7 -1
- package/dist/index.node.cjs +32980 -160
- package/dist/index.node.cjs.map +7 -1
- package/dist/index.node.d.ts +23 -210
- package/dist/index.node.js +32884 -133
- package/dist/index.node.js.map +7 -1
- package/dist/protocol/data-file.cjs +56 -0
- package/dist/protocol/data-file.cjs.map +1 -0
- package/dist/protocol/data-file.d.ts +20 -0
- package/dist/protocol/data-file.js +30 -0
- package/dist/protocol/data-file.js.map +1 -0
- package/dist/protocol/eip712.cjs +123 -0
- package/dist/protocol/eip712.cjs.map +1 -0
- package/dist/protocol/eip712.d.ts +117 -0
- package/dist/protocol/eip712.js +90 -0
- package/dist/protocol/eip712.js.map +1 -0
- package/dist/protocol/gateway.cjs +226 -0
- package/dist/protocol/gateway.cjs.map +1 -0
- package/dist/protocol/gateway.d.ts +120 -0
- package/dist/protocol/gateway.js +202 -0
- package/dist/protocol/gateway.js.map +1 -0
- package/dist/protocol/grants.cjs +146 -0
- package/dist/protocol/grants.cjs.map +1 -0
- package/dist/protocol/grants.d.ts +31 -0
- package/dist/protocol/grants.js +123 -0
- package/dist/protocol/grants.js.map +1 -0
- package/dist/protocol/scopes.cjs +78 -0
- package/dist/protocol/scopes.cjs.map +1 -0
- package/dist/protocol/scopes.d.ts +13 -0
- package/dist/protocol/scopes.js +50 -0
- package/dist/protocol/scopes.js.map +1 -0
- package/dist/{types/atomicStore.cjs → storage/default.cjs} +9 -8
- package/dist/storage/default.cjs.map +1 -0
- package/dist/storage/default.d.ts +4 -0
- package/dist/storage/default.js +8 -0
- package/dist/storage/default.js.map +1 -0
- package/dist/storage/index.cjs +11 -2
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.ts +9 -0
- package/dist/storage/index.js +7 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/providers/callback-storage.cjs +1 -0
- package/dist/storage/providers/callback-storage.cjs.map +1 -1
- package/dist/storage/providers/callback-storage.js +1 -0
- package/dist/storage/providers/callback-storage.js.map +1 -1
- package/dist/storage/providers/dropbox.cjs +1 -0
- package/dist/storage/providers/dropbox.cjs.map +1 -1
- package/dist/storage/providers/dropbox.js +1 -0
- package/dist/storage/providers/dropbox.js.map +1 -1
- package/dist/storage/providers/google-drive.cjs +1 -0
- package/dist/storage/providers/google-drive.cjs.map +1 -1
- package/dist/storage/providers/google-drive.js +1 -0
- package/dist/storage/providers/google-drive.js.map +1 -1
- package/dist/storage/providers/ipfs.cjs +1 -0
- package/dist/storage/providers/ipfs.cjs.map +1 -1
- package/dist/storage/providers/ipfs.js +1 -0
- package/dist/storage/providers/ipfs.js.map +1 -1
- package/dist/storage/providers/pinata.cjs +1 -0
- package/dist/storage/providers/pinata.cjs.map +1 -1
- package/dist/storage/providers/pinata.js +1 -0
- package/dist/storage/providers/pinata.js.map +1 -1
- package/dist/storage/providers/r2.cjs +376 -0
- package/dist/storage/providers/r2.cjs.map +1 -0
- package/dist/storage/providers/r2.d.ts +91 -0
- package/dist/storage/providers/r2.js +354 -0
- package/dist/storage/providers/r2.js.map +1 -0
- package/dist/storage/providers/vana-storage.cjs +251 -0
- package/dist/storage/providers/vana-storage.cjs.map +1 -0
- package/dist/storage/providers/vana-storage.d.ts +100 -0
- package/dist/storage/providers/vana-storage.js +231 -0
- package/dist/storage/providers/vana-storage.js.map +1 -0
- package/dist/types/config.cjs +0 -34
- package/dist/types/config.cjs.map +1 -1
- package/dist/types/config.d.ts +1 -607
- package/dist/types/config.js +0 -22
- package/dist/types/config.js.map +1 -1
- package/dist/types/contracts.cjs.map +1 -1
- package/dist/types/contracts.d.ts +1 -1
- package/dist/types/index.cjs +2 -33
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.ts +2 -33
- package/dist/types/index.js +1 -35
- package/dist/types/index.js.map +1 -1
- package/dist/types/ps-errors.cjs +91 -0
- package/dist/types/ps-errors.cjs.map +1 -0
- package/dist/types/ps-errors.d.ts +26 -0
- package/dist/types/ps-errors.js +66 -0
- package/dist/types/ps-errors.js.map +1 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +0 -29
- package/dist/types.js.map +1 -1
- package/package.json +7 -25
- package/dist/client/enhancedResponse.cjs +0 -164
- package/dist/client/enhancedResponse.cjs.map +0 -1
- package/dist/client/enhancedResponse.d.ts +0 -120
- package/dist/client/enhancedResponse.js +0 -138
- package/dist/client/enhancedResponse.js.map +0 -1
- package/dist/controllers/__tests__/data-consistency-integration.test.d.ts +0 -7
- package/dist/controllers/base.cjs +0 -116
- package/dist/controllers/base.cjs.map +0 -1
- package/dist/controllers/base.d.ts +0 -94
- package/dist/controllers/base.js +0 -92
- package/dist/controllers/base.js.map +0 -1
- package/dist/controllers/data.cjs +0 -2633
- package/dist/controllers/data.cjs.map +0 -1
- package/dist/controllers/data.d.ts +0 -1067
- package/dist/controllers/data.js +0 -2626
- package/dist/controllers/data.js.map +0 -1
- package/dist/controllers/operations.cjs +0 -430
- package/dist/controllers/operations.cjs.map +0 -1
- package/dist/controllers/operations.d.ts +0 -229
- package/dist/controllers/operations.js +0 -406
- package/dist/controllers/operations.js.map +0 -1
- package/dist/controllers/permissions.cjs +0 -4368
- package/dist/controllers/permissions.cjs.map +0 -1
- package/dist/controllers/permissions.d.ts +0 -1411
- package/dist/controllers/permissions.js +0 -4344
- package/dist/controllers/permissions.js.map +0 -1
- package/dist/controllers/protocol.cjs +0 -183
- package/dist/controllers/protocol.cjs.map +0 -1
- package/dist/controllers/protocol.d.ts +0 -138
- package/dist/controllers/protocol.js +0 -163
- package/dist/controllers/protocol.js.map +0 -1
- package/dist/controllers/schemas.cjs +0 -678
- package/dist/controllers/schemas.cjs.map +0 -1
- package/dist/controllers/schemas.d.ts +0 -293
- package/dist/controllers/schemas.js +0 -654
- package/dist/controllers/schemas.js.map +0 -1
- package/dist/controllers/server.cjs +0 -643
- package/dist/controllers/server.cjs.map +0 -1
- package/dist/controllers/server.d.ts +0 -322
- package/dist/controllers/server.js +0 -624
- package/dist/controllers/server.js.map +0 -1
- package/dist/controllers/staking.cjs +0 -626
- package/dist/controllers/staking.cjs.map +0 -1
- package/dist/controllers/staking.d.ts +0 -457
- package/dist/controllers/staking.js +0 -602
- package/dist/controllers/staking.js.map +0 -1
- package/dist/core/__tests__/pollingManager.test.d.ts +0 -4
- package/dist/core/apiClient.cjs +0 -378
- package/dist/core/apiClient.cjs.map +0 -1
- package/dist/core/apiClient.d.ts +0 -286
- package/dist/core/apiClient.js +0 -359
- package/dist/core/apiClient.js.map +0 -1
- package/dist/core/generics.cjs +0 -417
- package/dist/core/generics.cjs.map +0 -1
- package/dist/core/generics.d.ts +0 -205
- package/dist/core/generics.js +0 -386
- package/dist/core/generics.js.map +0 -1
- package/dist/core/health.cjs +0 -289
- package/dist/core/health.cjs.map +0 -1
- package/dist/core/health.d.ts +0 -143
- package/dist/core/health.js +0 -265
- package/dist/core/health.js.map +0 -1
- package/dist/core/inMemoryNonceManager.cjs +0 -138
- package/dist/core/inMemoryNonceManager.cjs.map +0 -1
- package/dist/core/inMemoryNonceManager.d.ts +0 -69
- package/dist/core/inMemoryNonceManager.js +0 -114
- package/dist/core/inMemoryNonceManager.js.map +0 -1
- package/dist/core/nonceManager.cjs +0 -304
- package/dist/core/nonceManager.cjs.map +0 -1
- package/dist/core/nonceManager.d.ts +0 -116
- package/dist/core/nonceManager.js +0 -280
- package/dist/core/nonceManager.js.map +0 -1
- package/dist/core/pollingManager.cjs +0 -292
- package/dist/core/pollingManager.cjs.map +0 -1
- package/dist/core/pollingManager.d.ts +0 -120
- package/dist/core/pollingManager.js +0 -268
- package/dist/core/pollingManager.js.map +0 -1
- package/dist/core.cjs +0 -781
- package/dist/core.cjs.map +0 -1
- package/dist/core.d.ts +0 -496
- package/dist/core.js +0 -756
- package/dist/core.js.map +0 -1
- package/dist/diagnostics.cjs +0 -37
- package/dist/diagnostics.cjs.map +0 -1
- package/dist/diagnostics.d.ts +0 -24
- package/dist/diagnostics.js +0 -13
- package/dist/diagnostics.js.map +0 -1
- package/dist/generated/abi/DLPPerformanceImplementation.cjs +0 -1202
- package/dist/generated/abi/DLPPerformanceImplementation.cjs.map +0 -1
- package/dist/generated/abi/DLPPerformanceImplementation.d.ts +0 -914
- package/dist/generated/abi/DLPPerformanceImplementation.js +0 -1178
- package/dist/generated/abi/DLPPerformanceImplementation.js.map +0 -1
- package/dist/generated/abi/DLPRewardDeployerImplementation.cjs +0 -1112
- package/dist/generated/abi/DLPRewardDeployerImplementation.cjs.map +0 -1
- package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +0 -840
- package/dist/generated/abi/DLPRewardDeployerImplementation.js +0 -1088
- package/dist/generated/abi/DLPRewardDeployerImplementation.js.map +0 -1
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.cjs +0 -612
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.cjs.map +0 -1
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.d.ts +0 -451
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.js +0 -588
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.js.map +0 -1
- package/dist/generated/abi/DLPRewardSwapImplementation.cjs +0 -939
- package/dist/generated/abi/DLPRewardSwapImplementation.cjs.map +0 -1
- package/dist/generated/abi/DLPRewardSwapImplementation.d.ts +0 -705
- package/dist/generated/abi/DLPRewardSwapImplementation.js +0 -915
- package/dist/generated/abi/DLPRewardSwapImplementation.js.map +0 -1
- package/dist/generated/abi/DLPRootImplementation.cjs +0 -1644
- package/dist/generated/abi/DLPRootImplementation.cjs.map +0 -1
- package/dist/generated/abi/DLPRootImplementation.d.ts +0 -1246
- package/dist/generated/abi/DLPRootImplementation.js +0 -1620
- package/dist/generated/abi/DLPRootImplementation.js.map +0 -1
- package/dist/generated/abi/DataLiquidityPoolImplementation.cjs +0 -985
- package/dist/generated/abi/DataLiquidityPoolImplementation.cjs.map +0 -1
- package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +0 -735
- package/dist/generated/abi/DataLiquidityPoolImplementation.js +0 -961
- package/dist/generated/abi/DataLiquidityPoolImplementation.js.map +0 -1
- package/dist/generated/abi/SwapHelperImplementation.cjs +0 -976
- package/dist/generated/abi/SwapHelperImplementation.cjs.map +0 -1
- package/dist/generated/abi/SwapHelperImplementation.d.ts +0 -728
- package/dist/generated/abi/SwapHelperImplementation.js +0 -952
- package/dist/generated/abi/SwapHelperImplementation.js.map +0 -1
- package/dist/generated/abi/TeePoolImplementation.cjs +0 -1313
- package/dist/generated/abi/TeePoolImplementation.cjs.map +0 -1
- package/dist/generated/abi/TeePoolImplementation.d.ts +0 -992
- package/dist/generated/abi/TeePoolImplementation.js +0 -1289
- package/dist/generated/abi/TeePoolImplementation.js.map +0 -1
- package/dist/generated/event-types.cjs +0 -17
- package/dist/generated/event-types.cjs.map +0 -1
- package/dist/generated/event-types.d.ts +0 -816
- package/dist/generated/event-types.js +0 -1
- package/dist/generated/event-types.js.map +0 -1
- package/dist/generated/eventRegistry.cjs +0 -4512
- package/dist/generated/eventRegistry.cjs.map +0 -1
- package/dist/generated/eventRegistry.d.ts +0 -14
- package/dist/generated/eventRegistry.js +0 -4487
- package/dist/generated/eventRegistry.js.map +0 -1
- package/dist/generated/server/server-exports.cjs +0 -45
- package/dist/generated/server/server-exports.cjs.map +0 -1
- package/dist/generated/server/server-exports.d.ts +0 -36
- package/dist/generated/server/server-exports.js +0 -19
- package/dist/generated/server/server-exports.js.map +0 -1
- package/dist/generated/server/server.cjs +0 -17
- package/dist/generated/server/server.cjs.map +0 -1
- package/dist/generated/server/server.d.ts +0 -907
- package/dist/generated/server/server.js +0 -1
- package/dist/generated/server/server.js.map +0 -1
- package/dist/generated/subgraph.cjs +0 -1440
- package/dist/generated/subgraph.cjs.map +0 -1
- package/dist/generated/subgraph.d.ts +0 -6113
- package/dist/generated/subgraph.js +0 -1404
- package/dist/generated/subgraph.js.map +0 -1
- package/dist/lib/__tests__/redisAtomicStore.test.d.ts +0 -1
- package/dist/lib/redisAtomicStore.cjs +0 -201
- package/dist/lib/redisAtomicStore.cjs.map +0 -1
- package/dist/lib/redisAtomicStore.d.ts +0 -120
- package/dist/lib/redisAtomicStore.js +0 -177
- package/dist/lib/redisAtomicStore.js.map +0 -1
- package/dist/server/relayerHandler.cjs +0 -452
- package/dist/server/relayerHandler.cjs.map +0 -1
- package/dist/server/relayerHandler.d.ts +0 -69
- package/dist/server/relayerHandler.js +0 -428
- package/dist/server/relayerHandler.js.map +0 -1
- package/dist/tests/abi.test.d.ts +0 -1
- package/dist/tests/chains-definitions.test.d.ts +0 -1
- package/dist/tests/core-encryption.test.d.ts +0 -1
- package/dist/tests/core-extended.test.d.ts +0 -1
- package/dist/tests/core-generics-coverage.test.d.ts +0 -1
- package/dist/tests/coverage-boost.test.d.ts +0 -1
- package/dist/tests/crypto-cross-platform-compatibility.test.d.ts +0 -1
- package/dist/tests/data-addfile-permissions-schema.test.d.ts +0 -1
- package/dist/tests/data-additional-methods.test.d.ts +0 -1
- package/dist/tests/data-controller-edge-cases.test.d.ts +0 -1
- package/dist/tests/data-ipfs-gateways.test.d.ts +0 -1
- package/dist/tests/data-relayer.test.d.ts +0 -1
- package/dist/tests/data-schema-validation.test.d.ts +0 -1
- package/dist/tests/data-simple-methods.test.d.ts +0 -1
- package/dist/tests/data-upload-owner-validation.test.d.ts +0 -1
- package/dist/tests/data.test.d.ts +0 -1
- package/dist/tests/demo-integration.test.d.ts +0 -1
- package/dist/tests/demo-trusted-server-integration.test.d.ts +0 -1
- package/dist/tests/download-relayer.test.d.ts +0 -1
- package/dist/tests/dual-mode-permissions.test.d.ts +0 -1
- package/dist/tests/dual-mode-trusted-servers.test.d.ts +0 -1
- package/dist/tests/encryption-correct-implementation.test.d.ts +0 -1
- package/dist/tests/encryption-coverage.test.d.ts +0 -1
- package/dist/tests/encryption-edge-cases.test.d.ts +0 -1
- package/dist/tests/encryption-utils-updated.test.d.ts +0 -1
- package/dist/tests/errors-coverage.test.d.ts +0 -1
- package/dist/tests/factories/mockFactory.d.ts +0 -316
- package/dist/tests/fakes/FakeStorageManager.d.ts +0 -200
- package/dist/tests/fakes/FakeStorageManager.test.d.ts +0 -1
- package/dist/tests/fakes/FakeWaitForTransactionEvents.d.ts +0 -170
- package/dist/tests/fakes/FakeWaitForTransactionEvents.test.d.ts +0 -1
- package/dist/tests/fakes/fake-pgp-port.d.ts +0 -13
- package/dist/tests/grantValidation-edge-cases.test.d.ts +0 -1
- package/dist/tests/grantValidation-unreachable-branch.test.d.ts +0 -1
- package/dist/tests/helper-methods.test.d.ts +0 -1
- package/dist/tests/helpers/typedMocks.d.ts +0 -64
- package/dist/tests/index-browser.test.d.ts +0 -1
- package/dist/tests/index-node.test.d.ts +0 -1
- package/dist/tests/index.test.d.ts +0 -1
- package/dist/tests/mocks/platformAdapter.d.ts +0 -12
- package/dist/tests/new-permissions-methods.test.d.ts +0 -1
- package/dist/tests/no-buffer-browser.test.d.ts +0 -1
- package/dist/tests/permissions-grantee.test.d.ts +0 -1
- package/dist/tests/permissions-revoke-relayer.test.d.ts +0 -1
- package/dist/tests/permissions-schema-validation.test.d.ts +0 -1
- package/dist/tests/permissions-server-files.test.d.ts +0 -1
- package/dist/tests/permissions-transaction-options.test.d.ts +0 -1
- package/dist/tests/permissions-trust-servers.test.d.ts +0 -1
- package/dist/tests/permissions.test.d.ts +0 -1
- package/dist/tests/personal.test.d.ts +0 -1
- package/dist/tests/platform-browser.test.d.ts +0 -1
- package/dist/tests/platform-crypto-expanded.test.d.ts +0 -1
- package/dist/tests/platform-crypto.test.d.ts +0 -1
- package/dist/tests/platform-index.test.d.ts +0 -1
- package/dist/tests/platform-node.test.d.ts +0 -1
- package/dist/tests/platform-shared-utils.test.d.ts +0 -1
- package/dist/tests/platform-updated.test.d.ts +0 -1
- package/dist/tests/protocol-additional-methods.test.d.ts +0 -1
- package/dist/tests/protocol.test.d.ts +0 -1
- package/dist/tests/read-only-mode.test.d.ts +0 -1
- package/dist/tests/relayer-integration.test.d.ts +0 -1
- package/dist/tests/relayer-unified.test.d.ts +0 -1
- package/dist/tests/schemas.test.d.ts +0 -1
- package/dist/tests/server-relayer-handler.test.d.ts +0 -1
- package/dist/tests/signatureFormatter.test.d.ts +0 -1
- package/dist/tests/staking.test.d.ts +0 -1
- package/dist/tests/trusted-server-queries.test.d.ts +0 -1
- package/dist/tests/typedDataConverter.test.d.ts +0 -1
- package/dist/tests/types-contracts.test.d.ts +0 -1
- package/dist/tests/types-data.test.d.ts +0 -1
- package/dist/tests/types-external-apis.test.d.ts +0 -1
- package/dist/tests/types-generics.test.d.ts +0 -1
- package/dist/tests/types-permissions.test.d.ts +0 -1
- package/dist/tests/types-upload-params.test.d.ts +0 -1
- package/dist/tests/types.test.d.ts +0 -1
- package/dist/tests/utils-formatters.test.d.ts +0 -1
- package/dist/tests/utils-grantFiles-edge-cases.test.d.ts +0 -1
- package/dist/tests/utils-grantFiles-validation.test.d.ts +0 -1
- package/dist/tests/utils-grantFiles.test.d.ts +0 -1
- package/dist/tests/utils-grantValidation-consolidated.test.d.ts +0 -1
- package/dist/tests/utils-grants.test.d.ts +0 -1
- package/dist/tests/utils-ipfs-additional.test.d.ts +0 -1
- package/dist/tests/utils-ipfs.test.d.ts +0 -4
- package/dist/tests/utils-schemaValidation.test.d.ts +0 -1
- package/dist/tests/vana.test.d.ts +0 -1
- package/dist/tests/wallet-crypto-compatibility.test.d.ts +0 -1
- package/dist/types/atomicStore.cjs.map +0 -1
- package/dist/types/atomicStore.d.ts +0 -236
- package/dist/types/atomicStore.js +0 -7
- package/dist/types/atomicStore.js.map +0 -1
- package/dist/types/blockchain.cjs +0 -17
- package/dist/types/blockchain.cjs.map +0 -1
- package/dist/types/blockchain.d.ts +0 -85
- package/dist/types/blockchain.js +0 -1
- package/dist/types/blockchain.js.map +0 -1
- package/dist/types/controller-context.cjs +0 -17
- package/dist/types/controller-context.cjs.map +0 -1
- package/dist/types/controller-context.d.ts +0 -68
- package/dist/types/controller-context.js +0 -1
- package/dist/types/controller-context.js.map +0 -1
- package/dist/types/data.cjs +0 -17
- package/dist/types/data.cjs.map +0 -1
- package/dist/types/data.d.ts +0 -763
- package/dist/types/data.js +0 -1
- package/dist/types/data.js.map +0 -1
- package/dist/types/external-apis.cjs +0 -61
- package/dist/types/external-apis.cjs.map +0 -1
- package/dist/types/external-apis.d.ts +0 -184
- package/dist/types/external-apis.js +0 -34
- package/dist/types/external-apis.js.map +0 -1
- package/dist/types/generics.cjs +0 -17
- package/dist/types/generics.cjs.map +0 -1
- package/dist/types/generics.d.ts +0 -518
- package/dist/types/generics.js +0 -1
- package/dist/types/generics.js.map +0 -1
- package/dist/types/operationStore.cjs +0 -17
- package/dist/types/operationStore.cjs.map +0 -1
- package/dist/types/operationStore.d.ts +0 -171
- package/dist/types/operationStore.js +0 -1
- package/dist/types/operationStore.js.map +0 -1
- package/dist/types/operations.cjs +0 -53
- package/dist/types/operations.cjs.map +0 -1
- package/dist/types/operations.d.ts +0 -204
- package/dist/types/operations.js +0 -26
- package/dist/types/operations.js.map +0 -1
- package/dist/types/options.cjs +0 -17
- package/dist/types/options.cjs.map +0 -1
- package/dist/types/options.d.ts +0 -308
- package/dist/types/options.js +0 -1
- package/dist/types/options.js.map +0 -1
- package/dist/types/permissions.cjs +0 -17
- package/dist/types/permissions.cjs.map +0 -1
- package/dist/types/permissions.d.ts +0 -955
- package/dist/types/permissions.js +0 -1
- package/dist/types/permissions.js.map +0 -1
- package/dist/types/personal.cjs +0 -17
- package/dist/types/personal.cjs.map +0 -1
- package/dist/types/personal.d.ts +0 -174
- package/dist/types/personal.js +0 -1
- package/dist/types/personal.js.map +0 -1
- package/dist/types/relayer.cjs +0 -17
- package/dist/types/relayer.cjs.map +0 -1
- package/dist/types/relayer.d.ts +0 -552
- package/dist/types/relayer.js +0 -1
- package/dist/types/relayer.js.map +0 -1
- package/dist/types/transactionResults.cjs +0 -17
- package/dist/types/transactionResults.cjs.map +0 -1
- package/dist/types/transactionResults.d.ts +0 -193
- package/dist/types/transactionResults.js +0 -1
- package/dist/types/transactionResults.js.map +0 -1
- package/dist/types/utils.cjs +0 -17
- package/dist/types/utils.cjs.map +0 -1
- package/dist/types/utils.d.ts +0 -771
- package/dist/types/utils.js +0 -1
- package/dist/types/utils.js.map +0 -1
- package/dist/utils/__tests__/chainQuery.test.d.ts +0 -1
- package/dist/utils/__tests__/parseTransaction.test.d.ts +0 -1
- package/dist/utils/__tests__/pojo-serialization.test.d.ts +0 -1
- package/dist/utils/__tests__/signatureCache.test.d.ts +0 -1
- package/dist/utils/__tests__/subgraphConsistency.test.d.ts +0 -4
- package/dist/utils/__tests__/subgraphPagination.test.d.ts +0 -4
- package/dist/utils/__tests__/transaction-edge-cases.test.d.ts +0 -1
- package/dist/utils/__tests__/transactionHelpers.test.d.ts +0 -1
- package/dist/utils/__tests__/urlResolver.test.d.ts +0 -4
- package/dist/utils/blockchain/registry.cjs +0 -81
- package/dist/utils/blockchain/registry.cjs.map +0 -1
- package/dist/utils/blockchain/registry.d.ts +0 -32
- package/dist/utils/blockchain/registry.js +0 -56
- package/dist/utils/blockchain/registry.js.map +0 -1
- package/dist/utils/blockchain/registry.test.d.ts +0 -1
- package/dist/utils/chainQuery.cjs +0 -107
- package/dist/utils/chainQuery.cjs.map +0 -1
- package/dist/utils/chainQuery.d.ts +0 -31
- package/dist/utils/chainQuery.js +0 -82
- package/dist/utils/chainQuery.js.map +0 -1
- package/dist/utils/download.cjs +0 -69
- package/dist/utils/download.cjs.map +0 -1
- package/dist/utils/download.d.ts +0 -40
- package/dist/utils/download.js +0 -45
- package/dist/utils/download.js.map +0 -1
- package/dist/utils/encryption.cjs +0 -176
- package/dist/utils/encryption.cjs.map +0 -1
- package/dist/utils/encryption.d.ts +0 -271
- package/dist/utils/encryption.js +0 -142
- package/dist/utils/encryption.js.map +0 -1
- package/dist/utils/formatters.cjs +0 -55
- package/dist/utils/formatters.cjs.map +0 -1
- package/dist/utils/formatters.d.ts +0 -118
- package/dist/utils/formatters.js +0 -28
- package/dist/utils/formatters.js.map +0 -1
- package/dist/utils/grantFiles.cjs +0 -181
- package/dist/utils/grantFiles.cjs.map +0 -1
- package/dist/utils/grantFiles.d.ts +0 -172
- package/dist/utils/grantFiles.js +0 -143
- package/dist/utils/grantFiles.js.map +0 -1
- package/dist/utils/grantValidation.cjs +0 -243
- package/dist/utils/grantValidation.cjs.map +0 -1
- package/dist/utils/grantValidation.d.ts +0 -226
- package/dist/utils/grantValidation.js +0 -201
- package/dist/utils/grantValidation.js.map +0 -1
- package/dist/utils/grants.cjs +0 -108
- package/dist/utils/grants.cjs.map +0 -1
- package/dist/utils/grants.d.ts +0 -148
- package/dist/utils/grants.js +0 -82
- package/dist/utils/grants.js.map +0 -1
- package/dist/utils/ipfs.cjs +0 -128
- package/dist/utils/ipfs.cjs.map +0 -1
- package/dist/utils/ipfs.d.ts +0 -88
- package/dist/utils/ipfs.js +0 -97
- package/dist/utils/ipfs.js.map +0 -1
- package/dist/utils/multicall.cjs +0 -233
- package/dist/utils/multicall.cjs.map +0 -1
- package/dist/utils/multicall.d.ts +0 -126
- package/dist/utils/multicall.js +0 -208
- package/dist/utils/multicall.js.map +0 -1
- package/dist/utils/parseTransactionPojo.cjs +0 -87
- package/dist/utils/parseTransactionPojo.cjs.map +0 -1
- package/dist/utils/parseTransactionPojo.d.ts +0 -31
- package/dist/utils/parseTransactionPojo.js +0 -63
- package/dist/utils/parseTransactionPojo.js.map +0 -1
- package/dist/utils/schemaValidation.cjs +0 -258
- package/dist/utils/schemaValidation.cjs.map +0 -1
- package/dist/utils/schemaValidation.d.ts +0 -168
- package/dist/utils/schemaValidation.js +0 -219
- package/dist/utils/schemaValidation.js.map +0 -1
- package/dist/utils/signatureCache.cjs +0 -192
- package/dist/utils/signatureCache.cjs.map +0 -1
- package/dist/utils/signatureCache.d.ts +0 -172
- package/dist/utils/signatureCache.js +0 -167
- package/dist/utils/signatureCache.js.map +0 -1
- package/dist/utils/signatureFormatter.cjs +0 -42
- package/dist/utils/signatureFormatter.cjs.map +0 -1
- package/dist/utils/signatureFormatter.d.ts +0 -36
- package/dist/utils/signatureFormatter.js +0 -18
- package/dist/utils/signatureFormatter.js.map +0 -1
- package/dist/utils/subgraphConsistency.cjs +0 -184
- package/dist/utils/subgraphConsistency.cjs.map +0 -1
- package/dist/utils/subgraphConsistency.d.ts +0 -65
- package/dist/utils/subgraphConsistency.js +0 -155
- package/dist/utils/subgraphConsistency.js.map +0 -1
- package/dist/utils/subgraphMetaCache.cjs +0 -101
- package/dist/utils/subgraphMetaCache.cjs.map +0 -1
- package/dist/utils/subgraphMetaCache.d.ts +0 -56
- package/dist/utils/subgraphMetaCache.js +0 -76
- package/dist/utils/subgraphMetaCache.js.map +0 -1
- package/dist/utils/subgraphPagination.cjs +0 -104
- package/dist/utils/subgraphPagination.cjs.map +0 -1
- package/dist/utils/subgraphPagination.d.ts +0 -78
- package/dist/utils/subgraphPagination.js +0 -78
- package/dist/utils/subgraphPagination.js.map +0 -1
- package/dist/utils/tests/multicall.test.d.ts +0 -1
- package/dist/utils/transactionHelpers.cjs +0 -54
- package/dist/utils/transactionHelpers.cjs.map +0 -1
- package/dist/utils/transactionHelpers.d.ts +0 -80
- package/dist/utils/transactionHelpers.js +0 -29
- package/dist/utils/transactionHelpers.js.map +0 -1
- package/dist/utils/typeGuards.cjs +0 -109
- package/dist/utils/typeGuards.cjs.map +0 -1
- package/dist/utils/typeGuards.d.ts +0 -138
- package/dist/utils/typeGuards.js +0 -74
- package/dist/utils/typeGuards.js.map +0 -1
- package/dist/utils/typedDataConverter.cjs +0 -43
- package/dist/utils/typedDataConverter.cjs.map +0 -1
- package/dist/utils/typedDataConverter.d.ts +0 -46
- package/dist/utils/typedDataConverter.js +0 -19
- package/dist/utils/typedDataConverter.js.map +0 -1
- package/dist/utils/urlResolver.cjs +0 -62
- package/dist/utils/urlResolver.cjs.map +0 -1
- package/dist/utils/urlResolver.d.ts +0 -56
- package/dist/utils/urlResolver.js +0 -37
- package/dist/utils/urlResolver.js.map +0 -1
- package/dist/utils/wallet.cjs +0 -63
- package/dist/utils/wallet.cjs.map +0 -1
- package/dist/utils/wallet.d.ts +0 -94
- package/dist/utils/wallet.js +0 -37
- package/dist/utils/wallet.js.map +0 -1
- package/dist/utils/withEvents.cjs +0 -44
- package/dist/utils/withEvents.cjs.map +0 -1
- package/dist/utils/withEvents.d.ts +0 -56
- package/dist/utils/withEvents.js +0 -18
- package/dist/utils/withEvents.js.map +0 -1
- /package/dist/{__tests__/waitForTransactionEvents.test.d.ts → auth/pkce.test.d.ts} +0 -0
- /package/dist/{client/__tests__/enhancedResponse.test.d.ts → auth/token-store.test.d.ts} +0 -0
- /package/dist/{controllers/__tests__/operations.processQueue.test.d.ts → auth/web3-signed.test.d.ts} +0 -0
- /package/dist/{controllers/__tests__/schemas-edge-cases.test.d.ts → crypto/envelope/openpgp.test.d.ts} +0 -0
- /package/dist/{controllers/data-error-handling.test.d.ts → crypto/keys/derive.test.d.ts} +0 -0
- /package/dist/{tests/errors.test.d.ts → errors.test.d.ts} +0 -0
- /package/dist/{controllers/server-additional.test.d.ts → protocol/data-file.test.d.ts} +0 -0
- /package/dist/{core/__tests__/health.test.d.ts → protocol/eip712.test.d.ts} +0 -0
- /package/dist/{core/__tests__/inMemoryNonceManager.test.d.ts → protocol/gateway.test.d.ts} +0 -0
- /package/dist/{core/__tests__/nonceManager.test.d.ts → protocol/grants.test.d.ts} +0 -0
- /package/dist/{core/core.test.d.ts → protocol/scopes.test.d.ts} +0 -0
- /package/dist/{core/tests/apiClient.test.d.ts → storage/tests/defaultStorage.test.d.ts} +0 -0
- /package/dist/{core/tests/client.test.d.ts → storage/tests/r2Storage.test.d.ts} +0 -0
- /package/dist/{core/tests/generics.test.d.ts → storage/tests/vanaStorage.test.d.ts} +0 -0
- /package/dist/{diagnostics.test.d.ts → types/ps-errors.test.d.ts} +0 -0
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Operation storage interfaces for queuing and managing asynchronous operations.
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import type { Hash, TransactionReceipt } from "viem";
|
|
7
|
-
import type { UnifiedRelayerRequest } from "./relayer";
|
|
8
|
-
/**
|
|
9
|
-
* The state of an asynchronous, relayed operation.
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* This is the data the application backend is responsible for persisting.
|
|
13
|
-
* It serves as a complete recovery log for a given operation.
|
|
14
|
-
*
|
|
15
|
-
* @category Operations
|
|
16
|
-
*/
|
|
17
|
-
export interface OperationState {
|
|
18
|
-
status: "pending" | "confirmed" | "failed";
|
|
19
|
-
transactionHash: Hash;
|
|
20
|
-
originalRequest: UnifiedRelayerRequest;
|
|
21
|
-
nonce?: number;
|
|
22
|
-
retryCount: number;
|
|
23
|
-
lastAttemptedGas: {
|
|
24
|
-
maxFeePerGas?: string;
|
|
25
|
-
maxPriorityFeePerGas?: string;
|
|
26
|
-
};
|
|
27
|
-
submittedAt: number;
|
|
28
|
-
finalReceipt?: TransactionReceipt;
|
|
29
|
-
error?: string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Simple storage interface for operation state tracking.
|
|
33
|
-
*
|
|
34
|
-
* @remarks
|
|
35
|
-
* This interface is used by the relayer handler to track operation state
|
|
36
|
-
* in a stateful mode. Implementations can use any backend storage system.
|
|
37
|
-
*
|
|
38
|
-
* @category Operations
|
|
39
|
-
*/
|
|
40
|
-
export interface IRelayerStateStore {
|
|
41
|
-
/**
|
|
42
|
-
* Gets the state of an operation.
|
|
43
|
-
*
|
|
44
|
-
* @param operationId - The operation ID
|
|
45
|
-
* @returns The operation state or null if not found
|
|
46
|
-
*/
|
|
47
|
-
get(operationId: string): Promise<OperationState | null>;
|
|
48
|
-
/**
|
|
49
|
-
* Sets the state of an operation.
|
|
50
|
-
*
|
|
51
|
-
* @param operationId - The operation ID
|
|
52
|
-
* @param state - The operation state to store
|
|
53
|
-
*/
|
|
54
|
-
set(operationId: string, state: OperationState): Promise<void>;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Represents a stored operation in the queue.
|
|
58
|
-
*/
|
|
59
|
-
export interface StoredOperation {
|
|
60
|
-
/** Unique identifier for the operation */
|
|
61
|
-
id: string;
|
|
62
|
-
/** Current status of the operation */
|
|
63
|
-
status: "queued" | "processing" | "submitted" | "completed" | "failed";
|
|
64
|
-
/** Serialized transaction or operation data */
|
|
65
|
-
data: string;
|
|
66
|
-
/** Number of retry attempts */
|
|
67
|
-
retryCount?: number;
|
|
68
|
-
/** Timestamp when the operation was created */
|
|
69
|
-
createdAt?: number;
|
|
70
|
-
/** Additional metadata */
|
|
71
|
-
metadata?: any;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Interface for operation storage backends.
|
|
75
|
-
*
|
|
76
|
-
* @remarks
|
|
77
|
-
* Implementations of this interface provide persistent storage for queued
|
|
78
|
-
* operations in a distributed relayer system. This allows operations to
|
|
79
|
-
* be processed asynchronously and recovered after failures.
|
|
80
|
-
*
|
|
81
|
-
* Common implementations include:
|
|
82
|
-
* - PostgreSQL for production environments
|
|
83
|
-
* - MongoDB for document-based storage
|
|
84
|
-
* - DynamoDB for serverless deployments
|
|
85
|
-
* - In-memory storage for testing
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```typescript
|
|
89
|
-
* class PostgresOperationStore implements IOperationStore {
|
|
90
|
-
* async storeOperation(operation) {
|
|
91
|
-
* await this.db.query(
|
|
92
|
-
* 'INSERT INTO operations (id, status, data) VALUES ($1, $2, $3)',
|
|
93
|
-
* [operation.id, 'queued', operation.data]
|
|
94
|
-
* );
|
|
95
|
-
* }
|
|
96
|
-
*
|
|
97
|
-
* async getQueuedOperations(options) {
|
|
98
|
-
* const result = await this.db.query(
|
|
99
|
-
* 'SELECT * FROM operations WHERE status = $1 LIMIT $2',
|
|
100
|
-
* ['queued', options.limit || 100]
|
|
101
|
-
* );
|
|
102
|
-
* return result.rows;
|
|
103
|
-
* }
|
|
104
|
-
* }
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
|
-
* @category Storage
|
|
108
|
-
*/
|
|
109
|
-
export interface IOperationStore {
|
|
110
|
-
/**
|
|
111
|
-
* Stores a new operation in the queue.
|
|
112
|
-
*
|
|
113
|
-
* @param operation - The operation to store
|
|
114
|
-
* @returns Promise that resolves when the operation is stored
|
|
115
|
-
*/
|
|
116
|
-
storeOperation(operation: {
|
|
117
|
-
id: string;
|
|
118
|
-
data: any;
|
|
119
|
-
metadata?: any;
|
|
120
|
-
}): Promise<void>;
|
|
121
|
-
/**
|
|
122
|
-
* Retrieves queued operations for processing.
|
|
123
|
-
*
|
|
124
|
-
* @param options - Query options
|
|
125
|
-
* @returns Promise resolving to an array of queued operations
|
|
126
|
-
*/
|
|
127
|
-
getQueuedOperations(options?: {
|
|
128
|
-
limit?: number;
|
|
129
|
-
}): Promise<StoredOperation[]>;
|
|
130
|
-
/**
|
|
131
|
-
* Updates the status of an operation.
|
|
132
|
-
*
|
|
133
|
-
* @param operationId - The ID of the operation to update
|
|
134
|
-
* @param status - The new status
|
|
135
|
-
* @param metadata - Optional metadata to store with the update
|
|
136
|
-
* @returns Promise that resolves when the status is updated
|
|
137
|
-
*/
|
|
138
|
-
updateStatus(operationId: string, status: string, metadata?: any): Promise<void>;
|
|
139
|
-
/**
|
|
140
|
-
* Gets operations currently being processed.
|
|
141
|
-
*
|
|
142
|
-
* @param options - Query options
|
|
143
|
-
* @returns Promise resolving to an array of processing operations
|
|
144
|
-
*/
|
|
145
|
-
getProcessingOperations?(options?: {
|
|
146
|
-
limit?: number;
|
|
147
|
-
}): Promise<StoredOperation[]>;
|
|
148
|
-
/**
|
|
149
|
-
* Gets failed operations.
|
|
150
|
-
*
|
|
151
|
-
* @param options - Query options
|
|
152
|
-
* @returns Promise resolving to an array of failed operations
|
|
153
|
-
*/
|
|
154
|
-
getFailedOperations?(options?: {
|
|
155
|
-
limit?: number;
|
|
156
|
-
}): Promise<StoredOperation[]>;
|
|
157
|
-
/**
|
|
158
|
-
* Gets the status of a specific operation.
|
|
159
|
-
*
|
|
160
|
-
* @param operationId - The ID of the operation to check
|
|
161
|
-
* @returns Promise resolving to the operation or null if not found
|
|
162
|
-
*/
|
|
163
|
-
getOperation?(operationId: string): Promise<StoredOperation | null>;
|
|
164
|
-
/**
|
|
165
|
-
* Deletes an operation from storage.
|
|
166
|
-
*
|
|
167
|
-
* @param operationId - The ID of the operation to delete
|
|
168
|
-
* @returns Promise that resolves when the operation is deleted
|
|
169
|
-
*/
|
|
170
|
-
deleteOperation?(operationId: string): Promise<void>;
|
|
171
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=operationStore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
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 __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var operations_exports = {};
|
|
20
|
-
__export(operations_exports, {
|
|
21
|
-
getOperationId: () => getOperationId,
|
|
22
|
-
getTransactionHash: () => getTransactionHash,
|
|
23
|
-
isOperation: () => isOperation,
|
|
24
|
-
isTransactionResult: () => isTransactionResult
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(operations_exports);
|
|
27
|
-
function isOperation(obj) {
|
|
28
|
-
return typeof obj === "object" && obj !== null && "kind" in obj && "id" in obj && "status" in obj && obj.kind === "OperationStatus" && typeof obj.id === "string" && typeof obj.status === "string";
|
|
29
|
-
}
|
|
30
|
-
function isTransactionResult(obj) {
|
|
31
|
-
if (typeof obj !== "object" || obj === null || !("hash" in obj)) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
const { hash } = obj;
|
|
35
|
-
return typeof hash === "string" && hash.startsWith("0x");
|
|
36
|
-
}
|
|
37
|
-
function getOperationId(opOrId) {
|
|
38
|
-
return typeof opOrId === "string" ? opOrId : opOrId.id;
|
|
39
|
-
}
|
|
40
|
-
function getTransactionHash(txOrHash) {
|
|
41
|
-
if (typeof txOrHash === "string") {
|
|
42
|
-
return txOrHash;
|
|
43
|
-
}
|
|
44
|
-
return txOrHash.hash;
|
|
45
|
-
}
|
|
46
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
-
0 && (module.exports = {
|
|
48
|
-
getOperationId,
|
|
49
|
-
getTransactionHash,
|
|
50
|
-
isOperation,
|
|
51
|
-
isTransactionResult
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=operations.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/operations.ts"],"sourcesContent":["import type { Hash, TransactionReceipt as ViemReceipt, Address } from \"viem\";\nimport type {\n GetOperationResponse,\n ArtifactInfo,\n} from \"../generated/server/server-exports\";\nimport type { Contract, Fn } from \"../generated/event-types\";\n\n// Re-export TransactionOptions from the new options module\nexport type { TransactionOptions } from \"./options\";\n\n/**\n * Represents an artifact generated by a server operation.\n *\n * @remarks\n * Artifacts are files generated during operations like Gemini agent analysis.\n * These can be downloaded separately using the artifact download API.\n * This type is imported directly from the server's OpenAPI schema.\n *\n * @category Operations\n */\nexport type Artifact = ArtifactInfo;\n\n/**\n * Represents a server-side operation status and result.\n *\n * @remarks\n * Operations track asynchronous server processes like data refinement or ML inference.\n * Poll operation status using `vana.server.waitForOperation()` until completion.\n * This type is now directly imported from the server's OpenAPI schema for type safety.\n *\n * @category Operations\n * @see {@link https://docs.vana.org/docs/operations | Operations Guide}\n */\nexport type Operation = GetOperationResponse;\n\n/**\n * Represents a submitted blockchain transaction as a self-describing POJO.\n *\n * @remarks\n * Transaction results MUST include contract and function for proper event parsing.\n * This strongly-typed design enables automatic event extraction without heuristics.\n * Use `vana.waitForTransactionEvents()` to retrieve typed events from the receipt.\n *\n * **Architecture:**\n * POJOs (Plain Old JavaScript Objects) ensure serialization safety and framework\n * independence. Contract and function fields enable deterministic event parsing.\n *\n * @category Operations\n * @example\n * ```typescript\n * const result: TransactionResult = {\n * hash: '0x123...',\n * from: '0x456...',\n * contract: 'DataRegistry',\n * fn: 'addFile',\n * chainId: 14800\n * };\n *\n * // Wait for events\n * const events = await vana.waitForTransactionEvents(result);\n * ```\n */\nexport interface TransactionResult<\n C extends Contract = Contract,\n F extends Fn<C> = Fn<C>,\n> {\n /** Transaction hash for tracking and confirmation */\n hash: Hash;\n /** Sender's wallet address */\n from: Address;\n /** Contract that was called (required for event parsing) */\n contract: C;\n /** Function that was called (required for event parsing) */\n fn: F;\n /** Network chain ID where transaction was submitted */\n chainId?: number;\n /** Transaction value in wei (for payable functions) */\n value?: bigint;\n /** Transaction sequence number for the sender */\n nonce?: number;\n /** Contract address (if different from standard deployment) */\n to?: Address;\n}\n\n/**\n * Extends viem's TransactionReceipt with Vana-specific event data.\n *\n * @remarks\n * Includes parsed event data when available after transaction confirmation.\n * Use this for detailed transaction analysis and event processing.\n *\n * @category Operations\n */\nexport interface TransactionReceipt extends ViemReceipt {\n /** Parsed event data if available */\n events?: unknown;\n}\n\n/**\n * Configures polling behavior for asynchronous operations.\n *\n * @remarks\n * Controls how frequently and how long to poll for operation completion.\n * Lower intervals provide faster updates but increase server load.\n *\n * @category Operations\n */\nexport interface PollingOptions {\n /** Polling interval in milliseconds (default: 500) */\n pollingInterval?: number;\n /** Maximum time to wait in milliseconds (default: 30000) */\n timeout?: number;\n}\n\n/**\n * Configures transaction confirmation waiting behavior.\n *\n * @remarks\n * Controls confirmation depth and timeout for transaction finality.\n * Higher confirmations provide more security against chain reorganizations.\n *\n * @category Operations\n */\nexport interface TransactionWaitOptions {\n /** Number of confirmations to wait for (default: 1) */\n confirmations?: number;\n /** Polling interval in milliseconds (default: 1000) */\n pollingInterval?: number;\n /** Maximum time to wait in milliseconds (default: 30000) */\n timeout?: number;\n}\n\n/**\n * Validates whether an object conforms to the Operation (GetOperationResponse) type.\n *\n * @remarks\n * Type guard for runtime validation of operation objects from external sources.\n * Use when deserializing operations from API responses or storage.\n * Validates against the server's OpenAPI schema structure.\n *\n * @param obj - The object to validate as an Operation\n * @returns `true` if the object has required Operation properties, `false` otherwise\n *\n * @example\n * ```typescript\n * const response = await fetch('/api/operation/123');\n * const data = await response.json();\n *\n * if (isOperation(data)) {\n * console.log(`Operation ${data.id}: ${data.status}`);\n * }\n * ```\n *\n * @category Operations\n */\nexport function isOperation(obj: unknown): obj is Operation {\n return (\n typeof obj === \"object\" &&\n obj !== null &&\n \"kind\" in obj &&\n \"id\" in obj &&\n \"status\" in obj &&\n (obj as Record<string, unknown>).kind === \"OperationStatus\" &&\n typeof (obj as Record<string, unknown>).id === \"string\" &&\n typeof (obj as Record<string, unknown>).status === \"string\"\n );\n}\n\n/**\n * Validates whether an object conforms to the TransactionResult interface.\n *\n * @remarks\n * Type guard for runtime validation of transaction results.\n * Checks for required hash field with proper `0x` prefix.\n *\n * @param obj - The object to validate as a TransactionResult\n * @returns `true` if the object has a valid transaction hash, `false` otherwise\n *\n * @example\n * ```typescript\n * if (isTransactionResult(result)) {\n * await vana.waitForTransactionEvents(result);\n * }\n * ```\n *\n * @category Operations\n */\nexport function isTransactionResult(obj: unknown): obj is TransactionResult {\n if (typeof obj !== \"object\" || obj === null || !(\"hash\" in obj)) {\n return false;\n }\n const { hash } = obj as Record<string, unknown>;\n return typeof hash === \"string\" && hash.startsWith(\"0x\");\n}\n\n/**\n * Extracts the operation ID from flexible input types.\n *\n * @remarks\n * Utility for handling both Operation objects and raw ID strings.\n * Enables flexible API design accepting either format.\n *\n * @param opOrId - An Operation object containing an `id` field or a raw operation ID string\n * @returns The operation ID string for use in API calls\n *\n * @example\n * ```typescript\n * // Works with both formats\n * await vana.server.getOperation(operation); // Operation object\n * await vana.server.getOperation('op-123'); // ID string\n * ```\n *\n * @category Operations\n */\nexport function getOperationId(opOrId: Operation | string): string {\n return typeof opOrId === \"string\" ? opOrId : opOrId.id;\n}\n\n/**\n * Extracts the transaction hash from flexible input types.\n *\n * @remarks\n * Utility for handling TransactionResult objects, hash objects, or raw hash strings.\n * Enables consistent hash extraction across different transaction representations.\n *\n * @param txOrHash - A TransactionResult object, any object with a `hash` field, or a raw hash string\n * @returns The transaction hash as a `0x`-prefixed string\n *\n * @example\n * ```typescript\n * // All these work\n * const hash1 = getTransactionHash(transactionResult);\n * const hash2 = getTransactionHash({ hash: '0x123...' });\n * const hash3 = getTransactionHash('0x123...');\n * ```\n *\n * @category Operations\n */\nexport function getTransactionHash(\n txOrHash: TransactionResult | { hash: Hash } | Hash,\n): Hash {\n if (typeof txOrHash === \"string\") {\n return txOrHash;\n }\n return txOrHash.hash;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2JO,SAAS,YAAY,KAAgC;AAC1D,SACE,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACV,QAAQ,OACR,YAAY,OACX,IAAgC,SAAS,qBAC1C,OAAQ,IAAgC,OAAO,YAC/C,OAAQ,IAAgC,WAAW;AAEvD;AAqBO,SAAS,oBAAoB,KAAwC;AAC1E,MAAI,OAAO,QAAQ,YAAY,QAAQ,QAAQ,EAAE,UAAU,MAAM;AAC/D,WAAO;AAAA,EACT;AACA,QAAM,EAAE,KAAK,IAAI;AACjB,SAAO,OAAO,SAAS,YAAY,KAAK,WAAW,IAAI;AACzD;AAqBO,SAAS,eAAe,QAAoC;AACjE,SAAO,OAAO,WAAW,WAAW,SAAS,OAAO;AACtD;AAsBO,SAAS,mBACd,UACM;AACN,MAAI,OAAO,aAAa,UAAU;AAChC,WAAO;AAAA,EACT;AACA,SAAO,SAAS;AAClB;","names":[]}
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import type { Hash, TransactionReceipt as ViemReceipt, Address } from "viem";
|
|
2
|
-
import type { GetOperationResponse, ArtifactInfo } from "../generated/server/server-exports";
|
|
3
|
-
import type { Contract, Fn } from "../generated/event-types";
|
|
4
|
-
export type { TransactionOptions } from "./options";
|
|
5
|
-
/**
|
|
6
|
-
* Represents an artifact generated by a server operation.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* Artifacts are files generated during operations like Gemini agent analysis.
|
|
10
|
-
* These can be downloaded separately using the artifact download API.
|
|
11
|
-
* This type is imported directly from the server's OpenAPI schema.
|
|
12
|
-
*
|
|
13
|
-
* @category Operations
|
|
14
|
-
*/
|
|
15
|
-
export type Artifact = ArtifactInfo;
|
|
16
|
-
/**
|
|
17
|
-
* Represents a server-side operation status and result.
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* Operations track asynchronous server processes like data refinement or ML inference.
|
|
21
|
-
* Poll operation status using `vana.server.waitForOperation()` until completion.
|
|
22
|
-
* This type is now directly imported from the server's OpenAPI schema for type safety.
|
|
23
|
-
*
|
|
24
|
-
* @category Operations
|
|
25
|
-
* @see {@link https://docs.vana.org/docs/operations | Operations Guide}
|
|
26
|
-
*/
|
|
27
|
-
export type Operation = GetOperationResponse;
|
|
28
|
-
/**
|
|
29
|
-
* Represents a submitted blockchain transaction as a self-describing POJO.
|
|
30
|
-
*
|
|
31
|
-
* @remarks
|
|
32
|
-
* Transaction results MUST include contract and function for proper event parsing.
|
|
33
|
-
* This strongly-typed design enables automatic event extraction without heuristics.
|
|
34
|
-
* Use `vana.waitForTransactionEvents()` to retrieve typed events from the receipt.
|
|
35
|
-
*
|
|
36
|
-
* **Architecture:**
|
|
37
|
-
* POJOs (Plain Old JavaScript Objects) ensure serialization safety and framework
|
|
38
|
-
* independence. Contract and function fields enable deterministic event parsing.
|
|
39
|
-
*
|
|
40
|
-
* @category Operations
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* const result: TransactionResult = {
|
|
44
|
-
* hash: '0x123...',
|
|
45
|
-
* from: '0x456...',
|
|
46
|
-
* contract: 'DataRegistry',
|
|
47
|
-
* fn: 'addFile',
|
|
48
|
-
* chainId: 14800
|
|
49
|
-
* };
|
|
50
|
-
*
|
|
51
|
-
* // Wait for events
|
|
52
|
-
* const events = await vana.waitForTransactionEvents(result);
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
export interface TransactionResult<C extends Contract = Contract, F extends Fn<C> = Fn<C>> {
|
|
56
|
-
/** Transaction hash for tracking and confirmation */
|
|
57
|
-
hash: Hash;
|
|
58
|
-
/** Sender's wallet address */
|
|
59
|
-
from: Address;
|
|
60
|
-
/** Contract that was called (required for event parsing) */
|
|
61
|
-
contract: C;
|
|
62
|
-
/** Function that was called (required for event parsing) */
|
|
63
|
-
fn: F;
|
|
64
|
-
/** Network chain ID where transaction was submitted */
|
|
65
|
-
chainId?: number;
|
|
66
|
-
/** Transaction value in wei (for payable functions) */
|
|
67
|
-
value?: bigint;
|
|
68
|
-
/** Transaction sequence number for the sender */
|
|
69
|
-
nonce?: number;
|
|
70
|
-
/** Contract address (if different from standard deployment) */
|
|
71
|
-
to?: Address;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Extends viem's TransactionReceipt with Vana-specific event data.
|
|
75
|
-
*
|
|
76
|
-
* @remarks
|
|
77
|
-
* Includes parsed event data when available after transaction confirmation.
|
|
78
|
-
* Use this for detailed transaction analysis and event processing.
|
|
79
|
-
*
|
|
80
|
-
* @category Operations
|
|
81
|
-
*/
|
|
82
|
-
export interface TransactionReceipt extends ViemReceipt {
|
|
83
|
-
/** Parsed event data if available */
|
|
84
|
-
events?: unknown;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Configures polling behavior for asynchronous operations.
|
|
88
|
-
*
|
|
89
|
-
* @remarks
|
|
90
|
-
* Controls how frequently and how long to poll for operation completion.
|
|
91
|
-
* Lower intervals provide faster updates but increase server load.
|
|
92
|
-
*
|
|
93
|
-
* @category Operations
|
|
94
|
-
*/
|
|
95
|
-
export interface PollingOptions {
|
|
96
|
-
/** Polling interval in milliseconds (default: 500) */
|
|
97
|
-
pollingInterval?: number;
|
|
98
|
-
/** Maximum time to wait in milliseconds (default: 30000) */
|
|
99
|
-
timeout?: number;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Configures transaction confirmation waiting behavior.
|
|
103
|
-
*
|
|
104
|
-
* @remarks
|
|
105
|
-
* Controls confirmation depth and timeout for transaction finality.
|
|
106
|
-
* Higher confirmations provide more security against chain reorganizations.
|
|
107
|
-
*
|
|
108
|
-
* @category Operations
|
|
109
|
-
*/
|
|
110
|
-
export interface TransactionWaitOptions {
|
|
111
|
-
/** Number of confirmations to wait for (default: 1) */
|
|
112
|
-
confirmations?: number;
|
|
113
|
-
/** Polling interval in milliseconds (default: 1000) */
|
|
114
|
-
pollingInterval?: number;
|
|
115
|
-
/** Maximum time to wait in milliseconds (default: 30000) */
|
|
116
|
-
timeout?: number;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Validates whether an object conforms to the Operation (GetOperationResponse) type.
|
|
120
|
-
*
|
|
121
|
-
* @remarks
|
|
122
|
-
* Type guard for runtime validation of operation objects from external sources.
|
|
123
|
-
* Use when deserializing operations from API responses or storage.
|
|
124
|
-
* Validates against the server's OpenAPI schema structure.
|
|
125
|
-
*
|
|
126
|
-
* @param obj - The object to validate as an Operation
|
|
127
|
-
* @returns `true` if the object has required Operation properties, `false` otherwise
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```typescript
|
|
131
|
-
* const response = await fetch('/api/operation/123');
|
|
132
|
-
* const data = await response.json();
|
|
133
|
-
*
|
|
134
|
-
* if (isOperation(data)) {
|
|
135
|
-
* console.log(`Operation ${data.id}: ${data.status}`);
|
|
136
|
-
* }
|
|
137
|
-
* ```
|
|
138
|
-
*
|
|
139
|
-
* @category Operations
|
|
140
|
-
*/
|
|
141
|
-
export declare function isOperation(obj: unknown): obj is Operation;
|
|
142
|
-
/**
|
|
143
|
-
* Validates whether an object conforms to the TransactionResult interface.
|
|
144
|
-
*
|
|
145
|
-
* @remarks
|
|
146
|
-
* Type guard for runtime validation of transaction results.
|
|
147
|
-
* Checks for required hash field with proper `0x` prefix.
|
|
148
|
-
*
|
|
149
|
-
* @param obj - The object to validate as a TransactionResult
|
|
150
|
-
* @returns `true` if the object has a valid transaction hash, `false` otherwise
|
|
151
|
-
*
|
|
152
|
-
* @example
|
|
153
|
-
* ```typescript
|
|
154
|
-
* if (isTransactionResult(result)) {
|
|
155
|
-
* await vana.waitForTransactionEvents(result);
|
|
156
|
-
* }
|
|
157
|
-
* ```
|
|
158
|
-
*
|
|
159
|
-
* @category Operations
|
|
160
|
-
*/
|
|
161
|
-
export declare function isTransactionResult(obj: unknown): obj is TransactionResult;
|
|
162
|
-
/**
|
|
163
|
-
* Extracts the operation ID from flexible input types.
|
|
164
|
-
*
|
|
165
|
-
* @remarks
|
|
166
|
-
* Utility for handling both Operation objects and raw ID strings.
|
|
167
|
-
* Enables flexible API design accepting either format.
|
|
168
|
-
*
|
|
169
|
-
* @param opOrId - An Operation object containing an `id` field or a raw operation ID string
|
|
170
|
-
* @returns The operation ID string for use in API calls
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* ```typescript
|
|
174
|
-
* // Works with both formats
|
|
175
|
-
* await vana.server.getOperation(operation); // Operation object
|
|
176
|
-
* await vana.server.getOperation('op-123'); // ID string
|
|
177
|
-
* ```
|
|
178
|
-
*
|
|
179
|
-
* @category Operations
|
|
180
|
-
*/
|
|
181
|
-
export declare function getOperationId(opOrId: Operation | string): string;
|
|
182
|
-
/**
|
|
183
|
-
* Extracts the transaction hash from flexible input types.
|
|
184
|
-
*
|
|
185
|
-
* @remarks
|
|
186
|
-
* Utility for handling TransactionResult objects, hash objects, or raw hash strings.
|
|
187
|
-
* Enables consistent hash extraction across different transaction representations.
|
|
188
|
-
*
|
|
189
|
-
* @param txOrHash - A TransactionResult object, any object with a `hash` field, or a raw hash string
|
|
190
|
-
* @returns The transaction hash as a `0x`-prefixed string
|
|
191
|
-
*
|
|
192
|
-
* @example
|
|
193
|
-
* ```typescript
|
|
194
|
-
* // All these work
|
|
195
|
-
* const hash1 = getTransactionHash(transactionResult);
|
|
196
|
-
* const hash2 = getTransactionHash({ hash: '0x123...' });
|
|
197
|
-
* const hash3 = getTransactionHash('0x123...');
|
|
198
|
-
* ```
|
|
199
|
-
*
|
|
200
|
-
* @category Operations
|
|
201
|
-
*/
|
|
202
|
-
export declare function getTransactionHash(txOrHash: TransactionResult | {
|
|
203
|
-
hash: Hash;
|
|
204
|
-
} | Hash): Hash;
|
package/dist/types/operations.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
function isOperation(obj) {
|
|
2
|
-
return typeof obj === "object" && obj !== null && "kind" in obj && "id" in obj && "status" in obj && obj.kind === "OperationStatus" && typeof obj.id === "string" && typeof obj.status === "string";
|
|
3
|
-
}
|
|
4
|
-
function isTransactionResult(obj) {
|
|
5
|
-
if (typeof obj !== "object" || obj === null || !("hash" in obj)) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
const { hash } = obj;
|
|
9
|
-
return typeof hash === "string" && hash.startsWith("0x");
|
|
10
|
-
}
|
|
11
|
-
function getOperationId(opOrId) {
|
|
12
|
-
return typeof opOrId === "string" ? opOrId : opOrId.id;
|
|
13
|
-
}
|
|
14
|
-
function getTransactionHash(txOrHash) {
|
|
15
|
-
if (typeof txOrHash === "string") {
|
|
16
|
-
return txOrHash;
|
|
17
|
-
}
|
|
18
|
-
return txOrHash.hash;
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
getOperationId,
|
|
22
|
-
getTransactionHash,
|
|
23
|
-
isOperation,
|
|
24
|
-
isTransactionResult
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=operations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/operations.ts"],"sourcesContent":["import type { Hash, TransactionReceipt as ViemReceipt, Address } from \"viem\";\nimport type {\n GetOperationResponse,\n ArtifactInfo,\n} from \"../generated/server/server-exports\";\nimport type { Contract, Fn } from \"../generated/event-types\";\n\n// Re-export TransactionOptions from the new options module\nexport type { TransactionOptions } from \"./options\";\n\n/**\n * Represents an artifact generated by a server operation.\n *\n * @remarks\n * Artifacts are files generated during operations like Gemini agent analysis.\n * These can be downloaded separately using the artifact download API.\n * This type is imported directly from the server's OpenAPI schema.\n *\n * @category Operations\n */\nexport type Artifact = ArtifactInfo;\n\n/**\n * Represents a server-side operation status and result.\n *\n * @remarks\n * Operations track asynchronous server processes like data refinement or ML inference.\n * Poll operation status using `vana.server.waitForOperation()` until completion.\n * This type is now directly imported from the server's OpenAPI schema for type safety.\n *\n * @category Operations\n * @see {@link https://docs.vana.org/docs/operations | Operations Guide}\n */\nexport type Operation = GetOperationResponse;\n\n/**\n * Represents a submitted blockchain transaction as a self-describing POJO.\n *\n * @remarks\n * Transaction results MUST include contract and function for proper event parsing.\n * This strongly-typed design enables automatic event extraction without heuristics.\n * Use `vana.waitForTransactionEvents()` to retrieve typed events from the receipt.\n *\n * **Architecture:**\n * POJOs (Plain Old JavaScript Objects) ensure serialization safety and framework\n * independence. Contract and function fields enable deterministic event parsing.\n *\n * @category Operations\n * @example\n * ```typescript\n * const result: TransactionResult = {\n * hash: '0x123...',\n * from: '0x456...',\n * contract: 'DataRegistry',\n * fn: 'addFile',\n * chainId: 14800\n * };\n *\n * // Wait for events\n * const events = await vana.waitForTransactionEvents(result);\n * ```\n */\nexport interface TransactionResult<\n C extends Contract = Contract,\n F extends Fn<C> = Fn<C>,\n> {\n /** Transaction hash for tracking and confirmation */\n hash: Hash;\n /** Sender's wallet address */\n from: Address;\n /** Contract that was called (required for event parsing) */\n contract: C;\n /** Function that was called (required for event parsing) */\n fn: F;\n /** Network chain ID where transaction was submitted */\n chainId?: number;\n /** Transaction value in wei (for payable functions) */\n value?: bigint;\n /** Transaction sequence number for the sender */\n nonce?: number;\n /** Contract address (if different from standard deployment) */\n to?: Address;\n}\n\n/**\n * Extends viem's TransactionReceipt with Vana-specific event data.\n *\n * @remarks\n * Includes parsed event data when available after transaction confirmation.\n * Use this for detailed transaction analysis and event processing.\n *\n * @category Operations\n */\nexport interface TransactionReceipt extends ViemReceipt {\n /** Parsed event data if available */\n events?: unknown;\n}\n\n/**\n * Configures polling behavior for asynchronous operations.\n *\n * @remarks\n * Controls how frequently and how long to poll for operation completion.\n * Lower intervals provide faster updates but increase server load.\n *\n * @category Operations\n */\nexport interface PollingOptions {\n /** Polling interval in milliseconds (default: 500) */\n pollingInterval?: number;\n /** Maximum time to wait in milliseconds (default: 30000) */\n timeout?: number;\n}\n\n/**\n * Configures transaction confirmation waiting behavior.\n *\n * @remarks\n * Controls confirmation depth and timeout for transaction finality.\n * Higher confirmations provide more security against chain reorganizations.\n *\n * @category Operations\n */\nexport interface TransactionWaitOptions {\n /** Number of confirmations to wait for (default: 1) */\n confirmations?: number;\n /** Polling interval in milliseconds (default: 1000) */\n pollingInterval?: number;\n /** Maximum time to wait in milliseconds (default: 30000) */\n timeout?: number;\n}\n\n/**\n * Validates whether an object conforms to the Operation (GetOperationResponse) type.\n *\n * @remarks\n * Type guard for runtime validation of operation objects from external sources.\n * Use when deserializing operations from API responses or storage.\n * Validates against the server's OpenAPI schema structure.\n *\n * @param obj - The object to validate as an Operation\n * @returns `true` if the object has required Operation properties, `false` otherwise\n *\n * @example\n * ```typescript\n * const response = await fetch('/api/operation/123');\n * const data = await response.json();\n *\n * if (isOperation(data)) {\n * console.log(`Operation ${data.id}: ${data.status}`);\n * }\n * ```\n *\n * @category Operations\n */\nexport function isOperation(obj: unknown): obj is Operation {\n return (\n typeof obj === \"object\" &&\n obj !== null &&\n \"kind\" in obj &&\n \"id\" in obj &&\n \"status\" in obj &&\n (obj as Record<string, unknown>).kind === \"OperationStatus\" &&\n typeof (obj as Record<string, unknown>).id === \"string\" &&\n typeof (obj as Record<string, unknown>).status === \"string\"\n );\n}\n\n/**\n * Validates whether an object conforms to the TransactionResult interface.\n *\n * @remarks\n * Type guard for runtime validation of transaction results.\n * Checks for required hash field with proper `0x` prefix.\n *\n * @param obj - The object to validate as a TransactionResult\n * @returns `true` if the object has a valid transaction hash, `false` otherwise\n *\n * @example\n * ```typescript\n * if (isTransactionResult(result)) {\n * await vana.waitForTransactionEvents(result);\n * }\n * ```\n *\n * @category Operations\n */\nexport function isTransactionResult(obj: unknown): obj is TransactionResult {\n if (typeof obj !== \"object\" || obj === null || !(\"hash\" in obj)) {\n return false;\n }\n const { hash } = obj as Record<string, unknown>;\n return typeof hash === \"string\" && hash.startsWith(\"0x\");\n}\n\n/**\n * Extracts the operation ID from flexible input types.\n *\n * @remarks\n * Utility for handling both Operation objects and raw ID strings.\n * Enables flexible API design accepting either format.\n *\n * @param opOrId - An Operation object containing an `id` field or a raw operation ID string\n * @returns The operation ID string for use in API calls\n *\n * @example\n * ```typescript\n * // Works with both formats\n * await vana.server.getOperation(operation); // Operation object\n * await vana.server.getOperation('op-123'); // ID string\n * ```\n *\n * @category Operations\n */\nexport function getOperationId(opOrId: Operation | string): string {\n return typeof opOrId === \"string\" ? opOrId : opOrId.id;\n}\n\n/**\n * Extracts the transaction hash from flexible input types.\n *\n * @remarks\n * Utility for handling TransactionResult objects, hash objects, or raw hash strings.\n * Enables consistent hash extraction across different transaction representations.\n *\n * @param txOrHash - A TransactionResult object, any object with a `hash` field, or a raw hash string\n * @returns The transaction hash as a `0x`-prefixed string\n *\n * @example\n * ```typescript\n * // All these work\n * const hash1 = getTransactionHash(transactionResult);\n * const hash2 = getTransactionHash({ hash: '0x123...' });\n * const hash3 = getTransactionHash('0x123...');\n * ```\n *\n * @category Operations\n */\nexport function getTransactionHash(\n txOrHash: TransactionResult | { hash: Hash } | Hash,\n): Hash {\n if (typeof txOrHash === \"string\") {\n return txOrHash;\n }\n return txOrHash.hash;\n}\n"],"mappings":"AA2JO,SAAS,YAAY,KAAgC;AAC1D,SACE,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACV,QAAQ,OACR,YAAY,OACX,IAAgC,SAAS,qBAC1C,OAAQ,IAAgC,OAAO,YAC/C,OAAQ,IAAgC,WAAW;AAEvD;AAqBO,SAAS,oBAAoB,KAAwC;AAC1E,MAAI,OAAO,QAAQ,YAAY,QAAQ,QAAQ,EAAE,UAAU,MAAM;AAC/D,WAAO;AAAA,EACT;AACA,QAAM,EAAE,KAAK,IAAI;AACjB,SAAO,OAAO,SAAS,YAAY,KAAK,WAAW,IAAI;AACzD;AAqBO,SAAS,eAAe,QAAoC;AACjE,SAAO,OAAO,WAAW,WAAW,SAAS,OAAO;AACtD;AAsBO,SAAS,mBACd,UACM;AACN,MAAI,OAAO,aAAa,UAAU;AAChC,WAAO;AAAA,EACT;AACA,SAAO,SAAS;AAClB;","names":[]}
|
package/dist/types/options.cjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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 options_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(options_exports);
|
|
17
|
-
//# sourceMappingURL=options.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/options.ts"],"sourcesContent":["/**\n * @file Standard option types for Vana SDK methods\n * @module vana-sdk/types/options\n */\n\n/**\n * Transaction options for blockchain write operations.\n *\n * @remarks\n * Aligned with viem's transaction parameters for consistency.\n * These options control gas pricing, limits, polling behavior, and other transaction-specific settings.\n *\n * @example\n * ```typescript\n * // Basic usage with gas options\n * await vana.data.upload(params, {\n * gas: 1000000n,\n * maxFeePerGas: 20000000000n\n * });\n *\n * // With status updates for long-running operations\n * await vana.permissions.grant({ grantee: '0x...' }, {\n * onStatusUpdate: (status) => {\n * if (status.type === 'queued') {\n * console.log(`Position in queue: ${status.position}`);\n * }\n * }\n * });\n *\n * // With cancellation support\n * const controller = new AbortController();\n * const promise = vana.permissions.grant({ grantee: '0x...' }, {\n * signal: controller.signal\n * });\n * // Cancel after 30 seconds\n * setTimeout(() => controller.abort(), 30000);\n * ```\n *\n * @category Options\n */\nexport interface TransactionOptions {\n /** Gas limit for the transaction */\n gas?: bigint;\n\n /** Gas price in wei (for legacy transactions) */\n gasPrice?: bigint;\n\n /** Maximum fee per gas in wei (EIP-1559) */\n maxFeePerGas?: bigint;\n\n /** Maximum priority fee per gas in wei (EIP-1559) */\n maxPriorityFeePerGas?: bigint;\n\n /** Transaction nonce override */\n nonce?: number;\n\n /** ETH value to send with transaction */\n value?: bigint;\n\n /**\n * AbortSignal for cancelling long-running operations.\n *\n * @remarks\n * Useful for cancelling pending transactions or polling operations.\n * When aborted, the operation will throw an error immediately.\n */\n signal?: AbortSignal;\n\n /**\n * Callback for receiving status updates during long-running operations.\n *\n * @remarks\n * Called whenever the operation status changes (e.g., from pending to queued).\n * Useful for showing progress in UI during multi-minute operations.\n *\n * @param status - The current operation status\n */\n onStatusUpdate?: (status: OperationStatus) => void;\n\n /**\n * Custom polling options for long-running operations.\n *\n * @remarks\n * Overrides default polling behavior for operations that use the relayer.\n * Generally not needed unless you have specific timing requirements.\n */\n pollingOptions?: {\n /** Total timeout in milliseconds (default: 300000 = 5 min) */\n timeout?: number;\n /** Initial polling interval in milliseconds (default: 1000) */\n initialInterval?: number;\n /** Maximum polling interval in milliseconds (default: 10000) */\n maxInterval?: number;\n };\n}\n\n/**\n * Represents the current status of a blockchain operation.\n *\n * @remarks\n * Used for status updates during long-running operations via the onStatusUpdate callback.\n * Provides detailed information about the operation's progress through its lifecycle.\n *\n * @category Options\n */\nexport type OperationStatus =\n | {\n /** Operation is pending, not yet processed */\n type: \"pending\";\n /** The operation ID for tracking */\n operationId: string;\n }\n | {\n /** Operation is queued for processing */\n type: \"queued\";\n /** Position in the processing queue */\n position?: number;\n /** Estimated wait time in seconds */\n estimatedWait?: number;\n }\n | {\n /** Operation is actively being processed */\n type: \"processing\";\n }\n | {\n /** Transaction has been submitted to blockchain */\n type: \"submitted\";\n /** The transaction hash */\n hash: `0x${string}`;\n }\n | {\n /** Transaction has been confirmed on-chain */\n type: \"confirmed\";\n /** The transaction hash */\n hash: `0x${string}`;\n /** The transaction receipt if available */\n receipt?: unknown;\n }\n | {\n /** Operation failed with an error */\n type: \"failed\";\n /** Error message describing the failure */\n error: string;\n /** Operation ID if available for recovery */\n operationId?: string;\n };\n\n/**\n * Source selection for data queries.\n *\n * @remarks\n * - `chain`: Query directly from blockchain (immediate consistency)\n * - `subgraph`: Query from indexed subgraph (may lag 15-60s)\n * - `auto`: SDK chooses optimal source (default)\n *\n * @category Options\n */\nexport type DataSource = \"chain\" | \"subgraph\" | \"auto\";\n\n/**\n * Consistency options for read operations.\n *\n * @remarks\n * Controls data freshness requirements and source selection.\n * Essential for read-after-write consistency when data must reflect recent transactions.\n *\n * @example\n * ```typescript\n * // Ensure data includes a recent transaction\n * const files = await vana.data.getUserFiles({ owner }, {\n * minBlock: receipt.blockNumber,\n * waitForSync: 30000 // Wait up to 30s\n * });\n * ```\n *\n * @category Options\n */\nexport interface ConsistencyOptions {\n /**\n * Minimum block number the data source must have indexed.\n *\n * @remarks\n * Operation will fail or wait (if waitForSync set) until source reaches this block.\n * Critical for ensuring recently created data is visible.\n */\n minBlock?: number;\n\n /**\n * Maximum milliseconds to wait for data source to sync to minBlock.\n *\n * @remarks\n * If not set, operation fails immediately when source is behind.\n * Useful for critical operations where waiting is preferable to failure.\n *\n * @default undefined (no waiting)\n */\n waitForSync?: number;\n\n /**\n * Explicitly select data source.\n *\n * @remarks\n * Useful for debugging or when specific consistency guarantees are needed.\n * Not all methods support all sources - unsupported selections will error.\n *\n * @default 'auto'\n */\n source?: DataSource;\n\n /**\n * AbortSignal for cancelling long-running operations.\n *\n * @remarks\n * Particularly useful with waitForSync to cancel polling operations.\n * Properly cleans up timers and pending requests when aborted.\n *\n * @example\n * ```typescript\n * const controller = new AbortController();\n * const promise = vana.data.getUserFiles(\n * { owner },\n * { waitForSync: 30000, signal: controller.signal }\n * );\n *\n * // Cancel after 5 seconds\n * setTimeout(() => controller.abort(), 5000);\n * ```\n */\n signal?: AbortSignal;\n}\n\n/**\n * Pagination options for list operations.\n *\n * @remarks\n * Controls result set size, ordering, and pagination.\n * By default returns first 100 items to prevent accidental large fetches.\n *\n * @example\n * ```typescript\n * // Get all files (explicit opt-in)\n * const allFiles = await vana.data.getUserFiles({ owner }, {\n * fetchAll: true\n * });\n *\n * // Get 10 most recent files\n * const recentFiles = await vana.data.getUserFiles({ owner }, {\n * limit: 10,\n * orderBy: 'addedAtBlock',\n * orderDirection: 'desc'\n * });\n * ```\n *\n * @category Options\n */\nexport interface PaginationOptions {\n /**\n * Maximum number of items to return.\n *\n * @remarks\n * Prevents accidental large fetches. Use fetchAll: true for unlimited.\n *\n * @default 100\n */\n limit?: number;\n\n /**\n * Number of items to skip (for manual pagination).\n *\n * @default 0\n */\n offset?: number;\n\n /**\n * Field to order results by.\n *\n * @remarks\n * Field names depend on the entity type.\n * Common: 'id', 'addedAtBlock', 'addedAtTimestamp'\n */\n orderBy?: string;\n\n /**\n * Sort direction for orderBy field.\n *\n * @default 'desc' for timestamp/block fields, 'asc' for others\n */\n orderDirection?: \"asc\" | \"desc\";\n\n /**\n * Explicitly fetch all available items.\n *\n * @remarks\n * Override safety limit. SDK will paginate internally to fetch all results.\n * Use with caution - can result in many API calls and large memory usage.\n *\n * @default false\n */\n fetchAll?: boolean;\n}\n\n/**\n * Combined options for read operations that return lists.\n *\n * @remarks\n * Convenience type combining consistency and pagination controls.\n *\n * @category Options\n */\nexport type ListOptions = ConsistencyOptions & PaginationOptions;\n\n/**\n * Combined options for write operations that may read data.\n *\n * @remarks\n * Some write operations need to read data (e.g., schema validation).\n * This type combines transaction and consistency options.\n *\n * @category Options\n */\nexport type WriteOptions = TransactionOptions & ConsistencyOptions;\n\n/**\n * Legacy transaction options type for backwards compatibility.\n *\n * @deprecated Use TransactionOptions instead. Will be removed in next major version.\n * @category Options\n */\nexport interface LegacyTransactionOptions {\n /** @deprecated Use `gas` instead */\n gasLimit?: bigint;\n gasPrice?: bigint;\n maxFeePerGas?: bigint;\n maxPriorityFeePerGas?: bigint;\n nonce?: number;\n value?: bigint;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|