@opendatalabs/vana-sdk 2.3.0 → 3.0.0
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 +125 -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 +104 -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 +23 -140
- package/dist/index.browser.js +32090 -114
- package/dist/index.browser.js.map +7 -1
- package/dist/index.node.cjs +32809 -160
- package/dist/index.node.cjs.map +7 -1
- package/dist/index.node.d.ts +22 -210
- package/dist/index.node.js +32716 -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/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 +66 -0
- package/dist/types/ps-errors.cjs.map +1 -0
- package/dist/types/ps-errors.d.ts +25 -0
- package/dist/types/ps-errors.js +41 -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/diagnostics.test.d.ts +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/scopes.test.d.ts} +0 -0
- /package/dist/{core/core.test.d.ts → storage/tests/defaultStorage.test.d.ts} +0 -0
- /package/dist/{core/tests/apiClient.test.d.ts → storage/tests/r2Storage.test.d.ts} +0 -0
- /package/dist/{core/tests/client.test.d.ts → storage/tests/vanaStorage.test.d.ts} +0 -0
- /package/dist/{core/tests/generics.test.d.ts → types/ps-errors.test.d.ts} +0 -0
package/dist/types/utils.d.ts
DELETED
|
@@ -1,771 +0,0 @@
|
|
|
1
|
-
import type { Address, Hash } from "viem";
|
|
2
|
-
/**
|
|
3
|
-
* Makes all properties in T optional except for those in K
|
|
4
|
-
*
|
|
5
|
-
* @remarks
|
|
6
|
-
* This utility type is useful when you want to create a variant of an interface
|
|
7
|
-
* where most properties are optional, but specific properties remain required.
|
|
8
|
-
* Commonly used for update operations where only certain fields must be provided.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* interface User {
|
|
13
|
-
* id: string;
|
|
14
|
-
* name: string;
|
|
15
|
-
* email: string;
|
|
16
|
-
* age: number;
|
|
17
|
-
* }
|
|
18
|
-
*
|
|
19
|
-
* // Only 'id' is required, all other properties are optional
|
|
20
|
-
* type UserUpdate = PartialExcept<User, 'id'>;
|
|
21
|
-
*
|
|
22
|
-
* const update: UserUpdate = {
|
|
23
|
-
* id: '123', // Required
|
|
24
|
-
* name: 'John' // Optional
|
|
25
|
-
* // email and age are also optional
|
|
26
|
-
* };
|
|
27
|
-
* ```
|
|
28
|
-
* @category Reference
|
|
29
|
-
*/
|
|
30
|
-
export type PartialExcept<T, K extends keyof T> = Partial<T> & Pick<T, K>;
|
|
31
|
-
/**
|
|
32
|
-
* Makes all properties in T required except for those in K
|
|
33
|
-
*
|
|
34
|
-
* @remarks
|
|
35
|
-
* This utility type is useful when you want to create a variant of an interface
|
|
36
|
-
* where most properties are required, but specific properties remain optional.
|
|
37
|
-
* Commonly used for creation operations where most fields are mandatory.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* interface Config {
|
|
42
|
-
* apiUrl: string;
|
|
43
|
-
* timeout?: number;
|
|
44
|
-
* retries?: number;
|
|
45
|
-
* debug?: boolean;
|
|
46
|
-
* }
|
|
47
|
-
*
|
|
48
|
-
* // All properties required except 'debug'
|
|
49
|
-
* type StrictConfig = RequiredExcept<Config, 'debug'>;
|
|
50
|
-
*
|
|
51
|
-
* const config: StrictConfig = {
|
|
52
|
-
* apiUrl: 'https://api.vana.com', // Required
|
|
53
|
-
* timeout: 5000, // Required (was optional, now required)
|
|
54
|
-
* retries: 3, // Required (was optional, now required)
|
|
55
|
-
* // debug remains optional
|
|
56
|
-
* };
|
|
57
|
-
* ```
|
|
58
|
-
* @category Reference
|
|
59
|
-
*/
|
|
60
|
-
export type RequiredExcept<T, K extends keyof T> = Required<T> & Partial<Pick<T, K>>;
|
|
61
|
-
/**
|
|
62
|
-
* Extracts the return type of a promise
|
|
63
|
-
*
|
|
64
|
-
* @remarks
|
|
65
|
-
* This utility type unwraps the type contained within a Promise.
|
|
66
|
-
* If the type is not a Promise, it returns the type unchanged.
|
|
67
|
-
* Note: TypeScript 4.5+ includes a built-in Awaited type with similar functionality.
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```typescript
|
|
71
|
-
* type AsyncString = Promise<string>;
|
|
72
|
-
* type SyncString = string;
|
|
73
|
-
*
|
|
74
|
-
* // Extracts 'string' from Promise<string>
|
|
75
|
-
* type Result1 = Awaited<AsyncString>; // string
|
|
76
|
-
*
|
|
77
|
-
* // Returns 'string' unchanged since it's not a Promise
|
|
78
|
-
* type Result2 = Awaited<SyncString>; // string
|
|
79
|
-
*
|
|
80
|
-
* // Practical usage with async functions
|
|
81
|
-
* async function fetchUser(): Promise<{ id: string; name: string }> {
|
|
82
|
-
* // ...
|
|
83
|
-
* }
|
|
84
|
-
*
|
|
85
|
-
* type User = Awaited<ReturnType<typeof fetchUser>>; // { id: string; name: string }
|
|
86
|
-
* ```
|
|
87
|
-
* @category Reference
|
|
88
|
-
*/
|
|
89
|
-
export type Awaited<T> = T extends Promise<infer U> ? U : T;
|
|
90
|
-
/**
|
|
91
|
-
* Creates a type that accepts either T or a Promise<T>
|
|
92
|
-
*
|
|
93
|
-
* @remarks
|
|
94
|
-
* This utility type is useful for functions that can work with both
|
|
95
|
-
* synchronous and asynchronous values. It allows flexible APIs that
|
|
96
|
-
* can accept immediate values or promises that resolve to those values.
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```typescript
|
|
100
|
-
* // Function that accepts either a value or a promise of that value
|
|
101
|
-
* async function processData(data: MaybePromise<string>): Promise<string> {
|
|
102
|
-
* // await works on both promises and regular values
|
|
103
|
-
* const resolved = await data;
|
|
104
|
-
* return resolved.toUpperCase();
|
|
105
|
-
* }
|
|
106
|
-
*
|
|
107
|
-
* // Both calls are valid:
|
|
108
|
-
* processData('hello'); // Synchronous value
|
|
109
|
-
* processData(Promise.resolve('world')); // Asynchronous value
|
|
110
|
-
*
|
|
111
|
-
* // Common use case in SDK callbacks
|
|
112
|
-
* interface StorageProvider {
|
|
113
|
-
* // Provider can implement sync or async file reading
|
|
114
|
-
* read(path: string): MaybePromise<Buffer>;
|
|
115
|
-
* }
|
|
116
|
-
* ```
|
|
117
|
-
* @category Reference
|
|
118
|
-
*/
|
|
119
|
-
export type MaybePromise<T> = T | Promise<T>;
|
|
120
|
-
/**
|
|
121
|
-
* Creates a type that accepts either T or an array of T
|
|
122
|
-
*
|
|
123
|
-
* @remarks
|
|
124
|
-
* This utility type is useful for functions that can accept either a single
|
|
125
|
-
* value or an array of values, providing a more flexible API. The implementation
|
|
126
|
-
* can normalize the input to always work with arrays internally.
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```typescript
|
|
130
|
-
* // Function that accepts either a single ID or multiple IDs
|
|
131
|
-
* function deleteItems(ids: MaybeArray<string>): void {
|
|
132
|
-
* // Normalize to array
|
|
133
|
-
* const idArray = Array.isArray(ids) ? ids : [ids];
|
|
134
|
-
* idArray.forEach(id => console.log(`Deleting ${id}`));
|
|
135
|
-
* }
|
|
136
|
-
*
|
|
137
|
-
* // Both calls are valid:
|
|
138
|
-
* deleteItems('item-1'); // Single item
|
|
139
|
-
* deleteItems(['item-1', 'item-2', 'item-3']); // Multiple items
|
|
140
|
-
*
|
|
141
|
-
* // Common use case in permissions
|
|
142
|
-
* interface GrantPermissionsParams {
|
|
143
|
-
* permissions: MaybeArray<Permission>;
|
|
144
|
-
* }
|
|
145
|
-
* ```
|
|
146
|
-
* @category Reference
|
|
147
|
-
*/
|
|
148
|
-
export type MaybeArray<T> = T | T[];
|
|
149
|
-
/**
|
|
150
|
-
* Pagination parameters for controlling result set size and navigation.
|
|
151
|
-
*
|
|
152
|
-
* Used across SDK methods that return lists of items to control how many items
|
|
153
|
-
* are returned and to navigate through large result sets efficiently.
|
|
154
|
-
*
|
|
155
|
-
* @category Reference
|
|
156
|
-
* @example
|
|
157
|
-
* ```typescript
|
|
158
|
-
* const pagination: PaginationParams = {
|
|
159
|
-
* limit: 20, // Return 20 items
|
|
160
|
-
* offset: 40, // Skip first 40 items (page 3)
|
|
161
|
-
* cursor: 'eyJpZCI6MTIzfQ==' // Or use cursor-based pagination
|
|
162
|
-
* };
|
|
163
|
-
*
|
|
164
|
-
* const files = await vana.data.getUserFiles({
|
|
165
|
-
* owner: userAddress,
|
|
166
|
-
* pagination
|
|
167
|
-
* });
|
|
168
|
-
* ```
|
|
169
|
-
*/
|
|
170
|
-
export interface PaginationParams {
|
|
171
|
-
/** Maximum number of items to return */
|
|
172
|
-
limit?: number;
|
|
173
|
-
/** Number of items to skip */
|
|
174
|
-
offset?: number;
|
|
175
|
-
/** Cursor for cursor-based pagination */
|
|
176
|
-
cursor?: string;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Pagination result containing items and metadata for navigating large datasets.
|
|
180
|
-
*
|
|
181
|
-
* @remarks
|
|
182
|
-
* This interface standardizes paginated responses across the SDK, providing
|
|
183
|
-
* consistent metadata for implementing pagination UI components and handling
|
|
184
|
-
* multi-page data fetching. Supports both offset-based and cursor-based pagination.
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
* ```typescript
|
|
188
|
-
* // Fetching paginated user files
|
|
189
|
-
* async function getAllUserFiles(userAddress: string): Promise<File[]> {
|
|
190
|
-
* const allFiles: File[] = [];
|
|
191
|
-
* let cursor: string | undefined;
|
|
192
|
-
*
|
|
193
|
-
* do {
|
|
194
|
-
* const result: PaginationResult<File> = await vana.data.getUserFiles({
|
|
195
|
-
* owner: userAddress,
|
|
196
|
-
* pagination: { limit: 50, cursor }
|
|
197
|
-
* });
|
|
198
|
-
*
|
|
199
|
-
* allFiles.push(...result.items);
|
|
200
|
-
* cursor = result.nextCursor;
|
|
201
|
-
*
|
|
202
|
-
* console.log(`Fetched ${result.count} of ${result.total} files`);
|
|
203
|
-
* } while (result.hasMore);
|
|
204
|
-
*
|
|
205
|
-
* return allFiles;
|
|
206
|
-
* }
|
|
207
|
-
* ```
|
|
208
|
-
* @category Reference
|
|
209
|
-
*/
|
|
210
|
-
export interface PaginationResult<T> {
|
|
211
|
-
/** Array of items */
|
|
212
|
-
items: T[];
|
|
213
|
-
/** Total number of items available */
|
|
214
|
-
total: number;
|
|
215
|
-
/** Number of items returned */
|
|
216
|
-
count: number;
|
|
217
|
-
/** Whether there are more items available */
|
|
218
|
-
hasMore: boolean;
|
|
219
|
-
/** Cursor for next page */
|
|
220
|
-
nextCursor?: string;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Block range parameters for filtering blockchain events and transactions.
|
|
224
|
-
*
|
|
225
|
-
* @remarks
|
|
226
|
-
* Used to specify a range of blocks when querying blockchain data.
|
|
227
|
-
* Both parameters are optional - omitting fromBlock starts from genesis,
|
|
228
|
-
* omitting toBlock goes to the latest block. Be cautious with large ranges
|
|
229
|
-
* as they may result in heavy RPC loads or timeouts.
|
|
230
|
-
*
|
|
231
|
-
* @example
|
|
232
|
-
* ```typescript
|
|
233
|
-
* // Get events from the last 1000 blocks
|
|
234
|
-
* const currentBlock = await vana.protocol.getBlockNumber();
|
|
235
|
-
* const events = await vana.protocol.getEvents({
|
|
236
|
-
* blockRange: {
|
|
237
|
-
* fromBlock: currentBlock - 1000n,
|
|
238
|
-
* toBlock: currentBlock
|
|
239
|
-
* }
|
|
240
|
-
* });
|
|
241
|
-
*
|
|
242
|
-
* // Get all historical events (use with caution)
|
|
243
|
-
* const allEvents = await vana.protocol.getEvents({
|
|
244
|
-
* blockRange: {
|
|
245
|
-
* fromBlock: 0n
|
|
246
|
-
* // toBlock omitted = up to latest
|
|
247
|
-
* }
|
|
248
|
-
* });
|
|
249
|
-
* ```
|
|
250
|
-
* @category Reference
|
|
251
|
-
*/
|
|
252
|
-
export interface BlockRange {
|
|
253
|
-
/** Starting block number */
|
|
254
|
-
fromBlock?: bigint;
|
|
255
|
-
/** Ending block number */
|
|
256
|
-
toBlock?: bigint;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Transaction receipt with additional metadata for tracking transaction results.
|
|
260
|
-
*
|
|
261
|
-
* @remarks
|
|
262
|
-
* Provides comprehensive information about executed transactions including
|
|
263
|
-
* gas usage, success status, and emitted events. Use the logs array to
|
|
264
|
-
* decode events emitted by smart contracts during transaction execution.
|
|
265
|
-
* The receipt is available after a transaction is mined and included in a block.
|
|
266
|
-
*
|
|
267
|
-
* @example
|
|
268
|
-
* ```typescript
|
|
269
|
-
* // Execute transaction and wait for receipt
|
|
270
|
-
* const receipt = await vana.permissions.grant({
|
|
271
|
-
* grantee: '0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36',
|
|
272
|
-
* dataId: 123
|
|
273
|
-
* });
|
|
274
|
-
*
|
|
275
|
-
* // Check transaction success
|
|
276
|
-
* if (receipt.status === 'success') {
|
|
277
|
-
* console.log(`Gas used: ${receipt.gasUsed}`);
|
|
278
|
-
* console.log(`Block: ${receipt.blockNumber}`);
|
|
279
|
-
*
|
|
280
|
-
* // Decode events from logs
|
|
281
|
-
* receipt.logs.forEach(log => {
|
|
282
|
-
* if (log.topics[0] === PERMISSION_GRANTED_TOPIC) {
|
|
283
|
-
* console.log('Permission granted event detected');
|
|
284
|
-
* }
|
|
285
|
-
* });
|
|
286
|
-
* } else {
|
|
287
|
-
* console.error('Transaction reverted');
|
|
288
|
-
* }
|
|
289
|
-
* ```
|
|
290
|
-
* @category Reference
|
|
291
|
-
*/
|
|
292
|
-
export interface TransactionReceipt {
|
|
293
|
-
/** Transaction hash */
|
|
294
|
-
transactionHash: Hash;
|
|
295
|
-
/** Block number */
|
|
296
|
-
blockNumber: bigint;
|
|
297
|
-
/** Block hash */
|
|
298
|
-
blockHash: Hash;
|
|
299
|
-
/** Gas used */
|
|
300
|
-
gasUsed: bigint;
|
|
301
|
-
/** Transaction status */
|
|
302
|
-
status: "success" | "reverted";
|
|
303
|
-
/** Contract address if contract deployment */
|
|
304
|
-
contractAddress?: Address;
|
|
305
|
-
/** Event logs */
|
|
306
|
-
logs: Array<{
|
|
307
|
-
address: Address;
|
|
308
|
-
topics: Hash[];
|
|
309
|
-
data: string;
|
|
310
|
-
}>;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Response wrapper for API results providing consistent error handling.
|
|
314
|
-
*
|
|
315
|
-
* @remarks
|
|
316
|
-
* Standardizes API responses across the SDK, making it easy to handle
|
|
317
|
-
* both successful and failed requests. The generic type parameter T
|
|
318
|
-
* represents the expected data type for successful responses. Check
|
|
319
|
-
* the success flag before accessing data to ensure type safety.
|
|
320
|
-
*
|
|
321
|
-
* @example
|
|
322
|
-
* ```typescript
|
|
323
|
-
* // Handling API responses
|
|
324
|
-
* async function fetchUserData(userId: string): Promise<User | null> {
|
|
325
|
-
* const response: ApiResponse<User> = await api.getUser(userId);
|
|
326
|
-
*
|
|
327
|
-
* if (response.success) {
|
|
328
|
-
* console.log('User fetched:', response.data.name);
|
|
329
|
-
* // Access metadata if available
|
|
330
|
-
* if (response.metadata?.cached) {
|
|
331
|
-
* console.log('Data was cached');
|
|
332
|
-
* }
|
|
333
|
-
* return response.data;
|
|
334
|
-
* } else {
|
|
335
|
-
* console.error('Failed to fetch user:', response.error);
|
|
336
|
-
* return null;
|
|
337
|
-
* }
|
|
338
|
-
* }
|
|
339
|
-
*
|
|
340
|
-
* // Type-safe error handling
|
|
341
|
-
* interface UserData {
|
|
342
|
-
* id: string;
|
|
343
|
-
* name: string;
|
|
344
|
-
* }
|
|
345
|
-
*
|
|
346
|
-
* const result: ApiResponse<UserData> = await api.call('/users/123');
|
|
347
|
-
* if (result.success) {
|
|
348
|
-
* // TypeScript knows result.data is UserData here
|
|
349
|
-
* console.log(result.data.name);
|
|
350
|
-
* }
|
|
351
|
-
* ```
|
|
352
|
-
* @category Reference
|
|
353
|
-
*/
|
|
354
|
-
export interface ApiResponse<T> {
|
|
355
|
-
/** Response data */
|
|
356
|
-
data: T;
|
|
357
|
-
/** Success status */
|
|
358
|
-
success: boolean;
|
|
359
|
-
/** Error message if not successful */
|
|
360
|
-
error?: string;
|
|
361
|
-
/** Additional metadata */
|
|
362
|
-
metadata?: Record<string, unknown>;
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Retry configuration for handling transient failures with exponential backoff.
|
|
366
|
-
*
|
|
367
|
-
* @remarks
|
|
368
|
-
* Configures automatic retry behavior for operations that may fail due to
|
|
369
|
-
* temporary issues like network problems or rate limits. Supports exponential
|
|
370
|
-
* backoff to avoid overwhelming services. The shouldRetry function allows
|
|
371
|
-
* custom logic to determine which errors warrant a retry attempt.
|
|
372
|
-
*
|
|
373
|
-
* @example
|
|
374
|
-
* ```typescript
|
|
375
|
-
* // Simple retry configuration
|
|
376
|
-
* const basicRetry: RetryConfig = {
|
|
377
|
-
* attempts: 3,
|
|
378
|
-
* delay: 1000 // 1 second between retries
|
|
379
|
-
* };
|
|
380
|
-
*
|
|
381
|
-
* // Exponential backoff configuration
|
|
382
|
-
* const exponentialRetry: RetryConfig = {
|
|
383
|
-
* attempts: 5,
|
|
384
|
-
* delay: 1000,
|
|
385
|
-
* backoffMultiplier: 2, // Double delay each time
|
|
386
|
-
* maxDelay: 30000, // Cap at 30 seconds
|
|
387
|
-
* shouldRetry: (error) => {
|
|
388
|
-
* // Only retry network and timeout errors
|
|
389
|
-
* return error.name === 'NetworkError' ||
|
|
390
|
-
* error.message.includes('timeout');
|
|
391
|
-
* }
|
|
392
|
-
* };
|
|
393
|
-
*
|
|
394
|
-
* // Usage with SDK
|
|
395
|
-
* const vana = new Vana({
|
|
396
|
-
* retryConfig: exponentialRetry
|
|
397
|
-
* });
|
|
398
|
-
* ```
|
|
399
|
-
* @category Reference
|
|
400
|
-
*/
|
|
401
|
-
export interface RetryConfig {
|
|
402
|
-
/** Number of retry attempts */
|
|
403
|
-
attempts: number;
|
|
404
|
-
/** Delay between retries in milliseconds */
|
|
405
|
-
delay: number;
|
|
406
|
-
/** Backoff multiplier */
|
|
407
|
-
backoffMultiplier?: number;
|
|
408
|
-
/** Maximum delay in milliseconds */
|
|
409
|
-
maxDelay?: number;
|
|
410
|
-
/** Function to determine if error should be retried */
|
|
411
|
-
shouldRetry?: (error: Error) => boolean;
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Cache configuration for optimizing repeated data fetches.
|
|
415
|
-
*
|
|
416
|
-
* @remarks
|
|
417
|
-
* Configures in-memory caching behavior to reduce redundant API calls and
|
|
418
|
-
* improve performance. The cache automatically evicts expired entries based
|
|
419
|
-
* on TTL and removes least-recently-used items when maxSize is reached.
|
|
420
|
-
* Use appropriate TTL values based on your data freshness requirements.
|
|
421
|
-
*
|
|
422
|
-
* @example
|
|
423
|
-
* ```typescript
|
|
424
|
-
* // Short-lived cache for frequently changing data
|
|
425
|
-
* const userCache: CacheConfig = {
|
|
426
|
-
* ttl: 60000, // 1 minute
|
|
427
|
-
* maxSize: 100, // Store up to 100 users
|
|
428
|
-
* prefix: 'user:' // Cache keys like 'user:123'
|
|
429
|
-
* };
|
|
430
|
-
*
|
|
431
|
-
* // Long-lived cache for stable data
|
|
432
|
-
* const schemaCache: CacheConfig = {
|
|
433
|
-
* ttl: 3600000, // 1 hour
|
|
434
|
-
* maxSize: 1000, // Store up to 1000 schemas
|
|
435
|
-
* prefix: 'schema:'
|
|
436
|
-
* };
|
|
437
|
-
*
|
|
438
|
-
* // Disable caching by setting TTL to 0
|
|
439
|
-
* const noCache: CacheConfig = {
|
|
440
|
-
* ttl: 0 // No caching
|
|
441
|
-
* };
|
|
442
|
-
* ```
|
|
443
|
-
* @category Reference
|
|
444
|
-
*/
|
|
445
|
-
export interface CacheConfig {
|
|
446
|
-
/** Cache TTL in milliseconds */
|
|
447
|
-
ttl: number;
|
|
448
|
-
/** Maximum cache size */
|
|
449
|
-
maxSize?: number;
|
|
450
|
-
/** Cache key prefix */
|
|
451
|
-
prefix?: string;
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Validation result for data integrity checks and schema validation.
|
|
455
|
-
*
|
|
456
|
-
* @remarks
|
|
457
|
-
* Provides detailed feedback about validation outcomes, distinguishing between
|
|
458
|
-
* errors (which prevent processing) and warnings (which indicate potential issues).
|
|
459
|
-
* Used throughout the SDK for validating permissions, file formats, schemas,
|
|
460
|
-
* and API parameters before operations.
|
|
461
|
-
*
|
|
462
|
-
* @example
|
|
463
|
-
* ```typescript
|
|
464
|
-
* // Validating user input
|
|
465
|
-
* function validateFileUpload(file: File): ValidationResult {
|
|
466
|
-
* const errors: string[] = [];
|
|
467
|
-
* const warnings: string[] = [];
|
|
468
|
-
*
|
|
469
|
-
* // Check file size
|
|
470
|
-
* if (file.size > 100 * 1024 * 1024) {
|
|
471
|
-
* errors.push('File size exceeds 100MB limit');
|
|
472
|
-
* } else if (file.size > 50 * 1024 * 1024) {
|
|
473
|
-
* warnings.push('Large file may take time to upload');
|
|
474
|
-
* }
|
|
475
|
-
*
|
|
476
|
-
* // Check file type
|
|
477
|
-
* if (!file.type.startsWith('image/')) {
|
|
478
|
-
* errors.push('Only image files are allowed');
|
|
479
|
-
* }
|
|
480
|
-
*
|
|
481
|
-
* return {
|
|
482
|
-
* valid: errors.length === 0,
|
|
483
|
-
* errors,
|
|
484
|
-
* warnings
|
|
485
|
-
* };
|
|
486
|
-
* }
|
|
487
|
-
*
|
|
488
|
-
* // Using validation result
|
|
489
|
-
* const result = validateFileUpload(file);
|
|
490
|
-
* if (!result.valid) {
|
|
491
|
-
* console.error('Validation failed:', result.errors.join(', '));
|
|
492
|
-
* } else {
|
|
493
|
-
* if (result.warnings.length > 0) {
|
|
494
|
-
* console.warn('Warnings:', result.warnings.join(', '));
|
|
495
|
-
* }
|
|
496
|
-
* // Proceed with upload
|
|
497
|
-
* }
|
|
498
|
-
* ```
|
|
499
|
-
* @category Reference
|
|
500
|
-
*/
|
|
501
|
-
export interface ValidationResult {
|
|
502
|
-
/** Whether validation passed */
|
|
503
|
-
valid: boolean;
|
|
504
|
-
/** Validation errors */
|
|
505
|
-
errors: string[];
|
|
506
|
-
/** Validation warnings */
|
|
507
|
-
warnings: string[];
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* Status information for health checks and service monitoring.
|
|
511
|
-
*
|
|
512
|
-
* @remarks
|
|
513
|
-
* Used to report the health status of various SDK components including
|
|
514
|
-
* storage providers, RPC connections, and personal servers. The details
|
|
515
|
-
* field can contain provider-specific information for debugging.
|
|
516
|
-
* Timestamps use Unix epoch milliseconds.
|
|
517
|
-
*
|
|
518
|
-
* @example
|
|
519
|
-
* ```typescript
|
|
520
|
-
* // Checking storage provider health
|
|
521
|
-
* const status: StatusInfo = await storage.getStatus();
|
|
522
|
-
*
|
|
523
|
-
* if (!status.healthy) {
|
|
524
|
-
* console.error(`Storage unhealthy: ${status.message}`);
|
|
525
|
-
* // Check how long the issue has persisted
|
|
526
|
-
* const downtime = Date.now() - status.lastCheck;
|
|
527
|
-
* if (downtime > 300000) { // 5 minutes
|
|
528
|
-
* // Switch to backup provider
|
|
529
|
-
* }
|
|
530
|
-
* }
|
|
531
|
-
*
|
|
532
|
-
* // Detailed status with custom fields
|
|
533
|
-
* const serverStatus: StatusInfo = {
|
|
534
|
-
* healthy: true,
|
|
535
|
-
* message: 'All systems operational',
|
|
536
|
-
* lastCheck: Date.now(),
|
|
537
|
-
* details: {
|
|
538
|
-
* uptime: 3600000, // 1 hour
|
|
539
|
-
* requestsServed: 1234,
|
|
540
|
-
* avgResponseTime: 145, // ms
|
|
541
|
-
* activeConnections: 23
|
|
542
|
-
* }
|
|
543
|
-
* };
|
|
544
|
-
* ```
|
|
545
|
-
* @category Reference
|
|
546
|
-
*/
|
|
547
|
-
export interface StatusInfo {
|
|
548
|
-
/** Whether the service is healthy */
|
|
549
|
-
healthy: boolean;
|
|
550
|
-
/** Status message */
|
|
551
|
-
message?: string;
|
|
552
|
-
/** Last check timestamp */
|
|
553
|
-
lastCheck: number;
|
|
554
|
-
/** Additional status details */
|
|
555
|
-
details?: Record<string, unknown>;
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Rate limit information for API throttling and quota management.
|
|
559
|
-
*
|
|
560
|
-
* @remarks
|
|
561
|
-
* Provides visibility into rate limiting status to help applications
|
|
562
|
-
* implement appropriate backoff strategies. Rate limits protect services
|
|
563
|
-
* from overload and ensure fair resource usage. Use this information
|
|
564
|
-
* to pace requests and avoid hitting limits.
|
|
565
|
-
*
|
|
566
|
-
* @example
|
|
567
|
-
* ```typescript
|
|
568
|
-
* // Check rate limit before making requests
|
|
569
|
-
* const rateLimit: RateLimitInfo = await api.getRateLimit();
|
|
570
|
-
*
|
|
571
|
-
* console.log(`Requests: ${rateLimit.requests}/${rateLimit.limit}`);
|
|
572
|
-
* console.log(`Resets in: ${rateLimit.resetTime} seconds`);
|
|
573
|
-
*
|
|
574
|
-
* // Implement backoff if approaching limit
|
|
575
|
-
* if (rateLimit.requests >= rateLimit.limit * 0.9) {
|
|
576
|
-
* console.warn('Approaching rate limit, slowing down');
|
|
577
|
-
* await new Promise(resolve =>
|
|
578
|
-
* setTimeout(resolve, rateLimit.resetTime * 1000)
|
|
579
|
-
* );
|
|
580
|
-
* }
|
|
581
|
-
*
|
|
582
|
-
* // Calculate requests per second allowed
|
|
583
|
-
* const rps = rateLimit.limit / rateLimit.window;
|
|
584
|
-
* console.log(`Max ${rps} requests per second allowed`);
|
|
585
|
-
* ```
|
|
586
|
-
* @category Reference
|
|
587
|
-
*/
|
|
588
|
-
export interface RateLimitInfo {
|
|
589
|
-
/** Current request count */
|
|
590
|
-
requests: number;
|
|
591
|
-
/** Maximum requests allowed */
|
|
592
|
-
limit: number;
|
|
593
|
-
/** Time window in seconds */
|
|
594
|
-
window: number;
|
|
595
|
-
/** Time until reset in seconds */
|
|
596
|
-
resetTime: number;
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* File upload progress tracking for user feedback and monitoring.
|
|
600
|
-
*
|
|
601
|
-
* @remarks
|
|
602
|
-
* Provides real-time progress information during file uploads, enabling
|
|
603
|
-
* applications to show progress bars and estimated completion times.
|
|
604
|
-
* The speed calculation is typically based on a rolling average to
|
|
605
|
-
* smooth out network fluctuations.
|
|
606
|
-
*
|
|
607
|
-
* @example
|
|
608
|
-
* ```typescript
|
|
609
|
-
* // Upload with progress tracking
|
|
610
|
-
* await vana.data.upload(file, {
|
|
611
|
-
* onProgress: (progress: UploadProgress) => {
|
|
612
|
-
* // Update progress bar
|
|
613
|
-
* progressBar.style.width = `${progress.percentage}%`;
|
|
614
|
-
*
|
|
615
|
-
* // Show upload speed
|
|
616
|
-
* const speedMBps = (progress.speed / 1024 / 1024).toFixed(2);
|
|
617
|
-
* speedDisplay.textContent = `${speedMBps} MB/s`;
|
|
618
|
-
*
|
|
619
|
-
* // Show time remaining
|
|
620
|
-
* const minutes = Math.floor(progress.estimatedTimeRemaining / 60);
|
|
621
|
-
* const seconds = progress.estimatedTimeRemaining % 60;
|
|
622
|
-
* timeDisplay.textContent = `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
|
623
|
-
*
|
|
624
|
-
* // Log progress milestones
|
|
625
|
-
* if (progress.percentage === 25 ||
|
|
626
|
-
* progress.percentage === 50 ||
|
|
627
|
-
* progress.percentage === 75) {
|
|
628
|
-
* console.log(`Upload ${progress.percentage}% complete`);
|
|
629
|
-
* }
|
|
630
|
-
* }
|
|
631
|
-
* });
|
|
632
|
-
* ```
|
|
633
|
-
* @category Reference
|
|
634
|
-
*/
|
|
635
|
-
export interface UploadProgress {
|
|
636
|
-
/** Bytes uploaded */
|
|
637
|
-
loaded: number;
|
|
638
|
-
/** Total bytes to upload */
|
|
639
|
-
total: number;
|
|
640
|
-
/** Upload percentage (0-100) */
|
|
641
|
-
percentage: number;
|
|
642
|
-
/** Upload speed in bytes per second */
|
|
643
|
-
speed: number;
|
|
644
|
-
/** Estimated time remaining in seconds */
|
|
645
|
-
estimatedTimeRemaining: number;
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* Network information for blockchain connectivity and monitoring.
|
|
649
|
-
*
|
|
650
|
-
* @remarks
|
|
651
|
-
* Provides comprehensive details about the connected blockchain network,
|
|
652
|
-
* including configuration URLs and real-time status. Use this information
|
|
653
|
-
* to verify network connectivity, display network details to users, and
|
|
654
|
-
* construct explorer links for transactions.
|
|
655
|
-
*
|
|
656
|
-
* @example
|
|
657
|
-
* ```typescript
|
|
658
|
-
* // Get current network info
|
|
659
|
-
* const network: NetworkInfo = await vana.protocol.getNetworkInfo();
|
|
660
|
-
*
|
|
661
|
-
* console.log(`Connected to: ${network.chainName} (ID: ${network.chainId})`);
|
|
662
|
-
* console.log(`Current block: ${network.currentBlock}`);
|
|
663
|
-
*
|
|
664
|
-
* // Check network health
|
|
665
|
-
* if (network.status !== 'healthy') {
|
|
666
|
-
* console.warn(`Network ${network.status}: consider switching RPC`);
|
|
667
|
-
* }
|
|
668
|
-
*
|
|
669
|
-
* // Generate explorer link for transaction
|
|
670
|
-
* function getExplorerLink(txHash: string): string {
|
|
671
|
-
* if (!network.explorerUrl) {
|
|
672
|
-
* return `Transaction: ${txHash}`;
|
|
673
|
-
* }
|
|
674
|
-
* return `${network.explorerUrl}/tx/${txHash}`;
|
|
675
|
-
* }
|
|
676
|
-
*
|
|
677
|
-
* // Verify expected network
|
|
678
|
-
* const EXPECTED_CHAIN_ID = 1337; // Vana testnet
|
|
679
|
-
* if (network.chainId !== EXPECTED_CHAIN_ID) {
|
|
680
|
-
* throw new Error(`Wrong network! Expected ${EXPECTED_CHAIN_ID}, got ${network.chainId}`);
|
|
681
|
-
* }
|
|
682
|
-
* ```
|
|
683
|
-
* @category Reference
|
|
684
|
-
*/
|
|
685
|
-
export interface NetworkInfo {
|
|
686
|
-
/** Chain ID */
|
|
687
|
-
chainId: number;
|
|
688
|
-
/** Chain name */
|
|
689
|
-
chainName: string;
|
|
690
|
-
/** RPC URL */
|
|
691
|
-
rpcUrl: string;
|
|
692
|
-
/** Block explorer URL */
|
|
693
|
-
explorerUrl?: string;
|
|
694
|
-
/** Current block number */
|
|
695
|
-
currentBlock: bigint;
|
|
696
|
-
/** Network status */
|
|
697
|
-
status: "healthy" | "degraded" | "down";
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* Gas estimate information for transaction cost prediction.
|
|
701
|
-
*
|
|
702
|
-
* @remarks
|
|
703
|
-
* Provides detailed gas pricing estimates to help users understand transaction
|
|
704
|
-
* costs before execution. Supports both legacy (gasPrice) and EIP-1559
|
|
705
|
-
* (maxFeePerGas) pricing models. The estimatedCost is calculated based on
|
|
706
|
-
* current network conditions and may vary by the time of actual execution.
|
|
707
|
-
*
|
|
708
|
-
* @example
|
|
709
|
-
* ```typescript
|
|
710
|
-
* // Get gas estimate before transaction
|
|
711
|
-
* const estimate: GasEstimate = await vana.permissions.estimateGas({
|
|
712
|
-
* grantee: '0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36',
|
|
713
|
-
* dataId: 123
|
|
714
|
-
* });
|
|
715
|
-
*
|
|
716
|
-
* // Convert to human-readable format
|
|
717
|
-
* const costInEth = Number(estimate.estimatedCost) / 1e18;
|
|
718
|
-
* console.log(`Estimated cost: ${costInEth.toFixed(6)} ETH`);
|
|
719
|
-
*
|
|
720
|
-
* // Check if user has sufficient balance
|
|
721
|
-
* const balance = await vana.protocol.getBalance(userAddress);
|
|
722
|
-
* if (balance < estimate.estimatedCost) {
|
|
723
|
-
* throw new Error(`Insufficient balance. Need ${costInEth} ETH`);
|
|
724
|
-
* }
|
|
725
|
-
*
|
|
726
|
-
* // Use estimate for transaction with buffer
|
|
727
|
-
* await vana.permissions.grant(params, {
|
|
728
|
-
* gasLimit: estimate.gasLimit * 110n / 100n, // 10% buffer
|
|
729
|
-
* maxFeePerGas: estimate.maxFeePerGas,
|
|
730
|
-
* maxPriorityFeePerGas: estimate.maxPriorityFeePerGas
|
|
731
|
-
* });
|
|
732
|
-
* ```
|
|
733
|
-
* @category Reference
|
|
734
|
-
*/
|
|
735
|
-
export interface GasEstimate {
|
|
736
|
-
/** Gas limit */
|
|
737
|
-
gasLimit: bigint;
|
|
738
|
-
/** Gas price */
|
|
739
|
-
gasPrice: bigint;
|
|
740
|
-
/** Max fee per gas */
|
|
741
|
-
maxFeePerGas?: bigint;
|
|
742
|
-
/** Max priority fee per gas */
|
|
743
|
-
maxPriorityFeePerGas?: bigint;
|
|
744
|
-
/** Estimated cost in wei */
|
|
745
|
-
estimatedCost: bigint;
|
|
746
|
-
}
|
|
747
|
-
/**
|
|
748
|
-
* Time range parameters for filtering operations by time period.
|
|
749
|
-
*
|
|
750
|
-
* Used in various SDK methods to specify date/time ranges for queries,
|
|
751
|
-
* analytics, and data filtering operations. Times are specified as Unix timestamps.
|
|
752
|
-
*
|
|
753
|
-
* @category Reference
|
|
754
|
-
* @example
|
|
755
|
-
* ```typescript
|
|
756
|
-
* const lastWeek: TimeRange = {
|
|
757
|
-
* from: Date.now() - (7 * 24 * 60 * 60 * 1000), // 7 days ago
|
|
758
|
-
* to: Date.now()
|
|
759
|
-
* };
|
|
760
|
-
*
|
|
761
|
-
* const permissions = await vana.permissions.getUserPermissions({
|
|
762
|
-
* timeRange: lastWeek
|
|
763
|
-
* });
|
|
764
|
-
* ```
|
|
765
|
-
*/
|
|
766
|
-
export interface TimeRange {
|
|
767
|
-
/** Start time (Unix timestamp) */
|
|
768
|
-
from?: number;
|
|
769
|
-
/** End time (Unix timestamp) */
|
|
770
|
-
to?: number;
|
|
771
|
-
}
|