@opendatalabs/vana-sdk 0.1.0-alpha.7ee7635 → 0.1.0-alpha.8117ac2
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/dist/__tests__/waitForTransactionEvents.test.d.ts +1 -0
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +36 -2
- package/dist/browser.js.map +1 -1
- package/dist/chains/definitions.cjs +9 -6
- package/dist/chains/definitions.cjs.map +1 -1
- package/dist/chains/definitions.d.ts +9 -11
- package/dist/chains/definitions.js +9 -6
- package/dist/chains/definitions.js.map +1 -1
- package/dist/chains/index.cjs.map +1 -1
- package/dist/chains/index.d.ts +34 -2
- package/dist/chains/index.js.map +1 -1
- package/dist/chains.browser.d.ts +8 -2
- package/dist/chains.d.ts +8 -2
- package/dist/chains.node.d.ts +8 -2
- package/dist/config/addresses.d.ts +8 -45
- package/dist/config/chains.cjs.map +1 -1
- package/dist/config/chains.d.ts +108 -13
- package/dist/config/chains.js.map +1 -1
- package/dist/config/default-services.cjs +60 -0
- package/dist/config/default-services.cjs.map +1 -0
- package/dist/config/default-services.d.ts +46 -0
- package/dist/config/default-services.js +33 -0
- package/dist/config/default-services.js.map +1 -0
- package/dist/config/default-services.test.d.ts +1 -0
- package/dist/config/features.d.ts +1 -3
- package/dist/config/tests/addresses.test.d.ts +1 -0
- package/dist/contracts/contractController.cjs +3 -3
- package/dist/contracts/contractController.cjs.map +1 -1
- package/dist/contracts/contractController.d.ts +77 -59
- package/dist/contracts/contractController.js +4 -7
- package/dist/contracts/contractController.js.map +1 -1
- package/dist/contracts/tests/contractController.test.d.ts +1 -0
- package/dist/controllers/__tests__/data-consistency-integration.test.d.ts +7 -0
- package/dist/controllers/__tests__/schemas-edge-cases.test.d.ts +1 -0
- package/dist/controllers/base.cjs +116 -0
- package/dist/controllers/base.cjs.map +1 -0
- package/dist/controllers/base.d.ts +94 -0
- package/dist/controllers/base.js +92 -0
- package/dist/controllers/base.js.map +1 -0
- package/dist/controllers/data-error-handling.test.d.ts +1 -0
- package/dist/controllers/data.cjs +699 -373
- package/dist/controllers/data.cjs.map +1 -1
- package/dist/controllers/data.d.ts +368 -228
- package/dist/controllers/data.js +712 -376
- package/dist/controllers/data.js.map +1 -1
- package/dist/controllers/permissions.cjs +688 -489
- package/dist/controllers/permissions.cjs.map +1 -1
- package/dist/controllers/permissions.d.ts +98 -165
- package/dist/controllers/permissions.js +688 -489
- package/dist/controllers/permissions.js.map +1 -1
- package/dist/controllers/protocol.cjs +15 -11
- package/dist/controllers/protocol.cjs.map +1 -1
- package/dist/controllers/protocol.d.ts +34 -84
- package/dist/controllers/protocol.js +15 -14
- package/dist/controllers/protocol.js.map +1 -1
- package/dist/controllers/schemas.cjs +57 -52
- package/dist/controllers/schemas.cjs.map +1 -1
- package/dist/controllers/schemas.d.ts +55 -61
- package/dist/controllers/schemas.js +57 -52
- package/dist/controllers/schemas.js.map +1 -1
- package/dist/controllers/server-additional.test.d.ts +1 -0
- package/dist/controllers/server.cjs +32 -25
- package/dist/controllers/server.cjs.map +1 -1
- package/dist/controllers/server.d.ts +53 -58
- package/dist/controllers/server.js +32 -25
- package/dist/controllers/server.js.map +1 -1
- package/dist/core/apiClient.cjs +68 -15
- package/dist/core/apiClient.cjs.map +1 -1
- package/dist/core/apiClient.d.ts +137 -16
- package/dist/core/apiClient.js +72 -22
- package/dist/core/apiClient.js.map +1 -1
- package/dist/core/client.cjs +7 -7
- package/dist/core/client.cjs.map +1 -1
- package/dist/core/client.d.ts +6 -9
- package/dist/core/client.js +7 -7
- package/dist/core/client.js.map +1 -1
- package/dist/core/core.test.d.ts +1 -0
- package/dist/core/generics.cjs +41 -12
- package/dist/core/generics.cjs.map +1 -1
- package/dist/core/generics.d.ts +104 -19
- package/dist/core/generics.js +52 -32
- package/dist/core/generics.js.map +1 -1
- package/dist/core/tests/apiClient.test.d.ts +1 -0
- package/dist/core/tests/client.test.d.ts +1 -0
- package/dist/core/tests/generics.test.d.ts +1 -0
- package/dist/core.cjs +115 -47
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +24 -74
- package/dist/core.js +137 -72
- package/dist/core.js.map +1 -1
- package/dist/crypto/ecies/__tests__/base.test.d.ts +4 -0
- package/dist/crypto/ecies/__tests__/compatibility.test.d.ts +8 -0
- package/dist/crypto/ecies/__tests__/constants.test.d.ts +4 -0
- package/dist/crypto/ecies/__tests__/native-parity.test.d.ts +7 -0
- package/dist/crypto/ecies/__tests__/normalization.test.d.ts +1 -0
- package/dist/crypto/ecies/__tests__/test-vectors.d.ts +2 -4
- package/dist/crypto/ecies/base.cjs +4 -3
- package/dist/crypto/ecies/base.cjs.map +1 -1
- package/dist/crypto/ecies/base.d.ts +2 -5
- package/dist/crypto/ecies/base.js +12 -15
- package/dist/crypto/ecies/base.js.map +1 -1
- package/dist/crypto/ecies/browser.cjs +2 -1
- package/dist/crypto/ecies/browser.cjs.map +1 -1
- package/dist/crypto/ecies/browser.d.ts +2 -7
- package/dist/crypto/ecies/browser.js +2 -1
- package/dist/crypto/ecies/browser.js.map +1 -1
- package/dist/crypto/ecies/constants.d.ts +7 -9
- package/dist/crypto/ecies/index.d.ts +8 -1
- package/dist/crypto/ecies/interface.cjs +4 -5
- package/dist/crypto/ecies/interface.cjs.map +1 -1
- package/dist/crypto/ecies/interface.d.ts +9 -11
- package/dist/crypto/ecies/interface.js +4 -5
- package/dist/crypto/ecies/interface.js.map +1 -1
- package/dist/crypto/ecies/node.cjs +3 -2
- package/dist/crypto/ecies/node.cjs.map +1 -1
- package/dist/crypto/ecies/node.d.ts +2 -7
- package/dist/crypto/ecies/node.js +11 -16
- package/dist/crypto/ecies/node.js.map +1 -1
- package/dist/crypto/ecies/utils.cjs +2 -41
- package/dist/crypto/ecies/utils.cjs.map +1 -1
- package/dist/crypto/ecies/utils.d.ts +3 -40
- package/dist/crypto/ecies/utils.js +1 -35
- package/dist/crypto/ecies/utils.js.map +1 -1
- package/dist/crypto/services/WalletKeyEncryptionService.cjs +2 -2
- package/dist/crypto/services/WalletKeyEncryptionService.cjs.map +1 -1
- package/dist/crypto/services/WalletKeyEncryptionService.d.ts +3 -7
- package/dist/crypto/services/WalletKeyEncryptionService.js +5 -9
- package/dist/crypto/services/WalletKeyEncryptionService.js.map +1 -1
- package/dist/crypto/services/WalletKeyEncryptionService.test.d.ts +1 -0
- package/dist/diagnostics.d.ts +1 -3
- package/dist/diagnostics.test.d.ts +1 -0
- package/dist/errors.cjs +16 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +53 -15
- package/dist/errors.js +18 -6
- package/dist/errors.js.map +1 -1
- package/dist/generated/abi/ComputeEngineImplementation.d.ts +2 -3
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs.map +1 -1
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.d.ts +2 -3
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.js.map +1 -1
- package/dist/generated/abi/DATFactoryImplementation.d.ts +2 -3
- package/dist/generated/abi/DATImplementation.d.ts +2 -3
- package/dist/generated/abi/DATPausableImplementation.d.ts +2 -3
- package/dist/generated/abi/DATVotesImplementation.d.ts +2 -3
- package/dist/generated/abi/DLPPerformanceImplementation.d.ts +2 -3
- package/dist/generated/abi/DLPRegistryImplementation.d.ts +2 -3
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.d.ts +2 -3
- package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +2 -3
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.d.ts +2 -3
- package/dist/generated/abi/DLPRewardSwapImplementation.d.ts +2 -3
- package/dist/generated/abi/DLPRootImplementation.d.ts +1 -3
- package/dist/generated/abi/DLPTreasuryImplementation.d.ts +2 -3
- package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +1 -3
- package/dist/generated/abi/DataPortabilityGranteesImplementation.d.ts +2 -3
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.ts +2 -3
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.js.map +1 -1
- package/dist/generated/abi/DataPortabilityServersImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataPortabilityServersImplementation.d.ts +2 -3
- package/dist/generated/abi/DataPortabilityServersImplementation.js.map +1 -1
- package/dist/generated/abi/DataRefinerRegistryImplementation.d.ts +2 -3
- package/dist/generated/abi/DataRegistryImplementation.d.ts +2 -3
- package/dist/generated/abi/QueryEngineImplementation.d.ts +2 -3
- package/dist/generated/abi/SwapHelperImplementation.d.ts +2 -3
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.d.ts +2 -3
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.d.ts +2 -3
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.d.ts +2 -3
- package/dist/generated/abi/TeePoolImplementation.d.ts +2 -3
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.d.ts +2 -3
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.d.ts +2 -3
- package/dist/generated/abi/TeePoolPhalaImplementation.d.ts +2 -3
- package/dist/generated/abi/VanaEpochImplementation.d.ts +2 -3
- package/dist/generated/abi/VanaPoolEntityImplementation.d.ts +2 -3
- package/dist/generated/abi/VanaPoolStakingImplementation.d.ts +2 -3
- package/dist/generated/abi/VanaPoolTreasuryImplementation.d.ts +2 -3
- package/dist/generated/abi/index.d.ts +37 -39
- package/dist/generated/event-types.d.ts +9 -10
- package/dist/generated/eventRegistry.d.ts +3 -7
- package/dist/generated/server/server-exports.d.ts +19 -21
- package/dist/generated/server/server.cjs.map +1 -1
- package/dist/generated/server/server.d.ts +113 -87
- package/dist/generated/subgraph.cjs +797 -32
- package/dist/generated/subgraph.cjs.map +1 -1
- package/dist/generated/subgraph.d.ts +464 -332
- package/dist/generated/subgraph.js +792 -32
- package/dist/generated/subgraph.js.map +1 -1
- package/dist/index.browser.d.ts +47 -96
- package/dist/index.browser.js +12 -0
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.node.cjs +14 -3
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +203 -87
- package/dist/index.node.js +14 -2
- package/dist/index.node.js.map +1 -1
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +42 -2
- package/dist/node.js.map +1 -1
- package/dist/platform/browser-only.d.ts +5 -8
- package/dist/platform/browser-only.test.d.ts +1 -0
- package/dist/platform/browser-safe.d.ts +6 -9
- package/dist/platform/browser-safe.test.d.ts +1 -0
- package/dist/platform/browser.cjs +167 -8
- package/dist/platform/browser.cjs.map +1 -1
- package/dist/platform/browser.d.ts +235 -18
- package/dist/platform/browser.js +179 -29
- package/dist/platform/browser.js.map +1 -1
- package/dist/platform/browser.test.d.ts +1 -0
- package/dist/platform/index.d.ts +11 -5
- package/dist/platform/interface.cjs.map +1 -1
- package/dist/platform/interface.d.ts +289 -98
- package/dist/platform/node.cjs +163 -2
- package/dist/platform/node.cjs.map +1 -1
- package/dist/platform/node.d.ts +72 -13
- package/dist/platform/node.js +175 -21
- package/dist/platform/node.js.map +1 -1
- package/dist/platform/ports/openpgp-port.cjs +74 -0
- package/dist/platform/ports/openpgp-port.cjs.map +1 -0
- package/dist/platform/ports/openpgp-port.d.ts +13 -0
- package/dist/platform/ports/openpgp-port.js +59 -0
- package/dist/platform/ports/openpgp-port.js.map +1 -0
- package/dist/platform/ports/pgp-port.cjs +17 -0
- package/dist/platform/ports/pgp-port.cjs.map +1 -0
- package/dist/platform/ports/pgp-port.d.ts +35 -0
- package/dist/platform/ports/pgp-port.js +1 -0
- package/dist/platform/ports/pgp-port.js.map +1 -0
- package/dist/platform/shared/error-utils.d.ts +2 -4
- package/dist/platform/shared/pgp-utils.cjs +2 -2
- package/dist/platform/shared/pgp-utils.cjs.map +1 -1
- package/dist/platform/shared/pgp-utils.d.ts +3 -5
- package/dist/platform/shared/pgp-utils.js +2 -2
- package/dist/platform/shared/pgp-utils.js.map +1 -1
- package/dist/platform/shared/stream-utils.d.ts +1 -3
- package/dist/platform/utils.d.ts +6 -10
- package/dist/platform/utils.test.d.ts +1 -0
- package/dist/platform.browser.d.ts +9 -4
- package/dist/platform.d.ts +11 -5
- package/dist/platform.node.d.ts +10 -5
- package/dist/server/relayerHandler.cjs +337 -0
- package/dist/server/relayerHandler.cjs.map +1 -0
- package/dist/server/relayerHandler.d.ts +38 -0
- package/dist/server/relayerHandler.js +313 -0
- package/dist/server/relayerHandler.js.map +1 -0
- package/dist/storage/index.d.ts +56 -10
- package/dist/storage/manager.cjs +110 -27
- package/dist/storage/manager.cjs.map +1 -1
- package/dist/storage/manager.d.ts +121 -30
- package/dist/storage/manager.js +113 -37
- package/dist/storage/manager.js.map +1 -1
- package/dist/storage/providers/callback-storage.cjs +89 -18
- package/dist/storage/providers/callback-storage.cjs.map +1 -1
- package/dist/storage/providers/callback-storage.d.ts +111 -28
- package/dist/storage/providers/callback-storage.js +89 -18
- package/dist/storage/providers/callback-storage.js.map +1 -1
- package/dist/storage/providers/google-drive.cjs +2 -2
- package/dist/storage/providers/google-drive.cjs.map +1 -1
- package/dist/storage/providers/google-drive.d.ts +3 -7
- package/dist/storage/providers/google-drive.js +4 -7
- package/dist/storage/providers/google-drive.js.map +1 -1
- package/dist/storage/providers/google-drive.test.d.ts +1 -0
- package/dist/storage/providers/ipfs.cjs +5 -5
- package/dist/storage/providers/ipfs.cjs.map +1 -1
- package/dist/storage/providers/ipfs.d.ts +3 -6
- package/dist/storage/providers/ipfs.js +7 -10
- package/dist/storage/providers/ipfs.js.map +1 -1
- package/dist/storage/providers/pinata.cjs +6 -6
- package/dist/storage/providers/pinata.cjs.map +1 -1
- package/dist/storage/providers/pinata.d.ts +17 -22
- package/dist/storage/providers/pinata.js +8 -11
- package/dist/storage/providers/pinata.js.map +1 -1
- package/dist/storage/tests/callbackStorage.test.d.ts +1 -0
- package/dist/storage/tests/googleDriveStorage.test.d.ts +1 -0
- package/dist/storage/tests/ipfsStorage.test.d.ts +1 -0
- package/dist/storage/tests/pinataStorage.test.d.ts +1 -0
- package/dist/storage/tests/storageManager.test.d.ts +1 -0
- package/dist/tests/abi.test.d.ts +1 -0
- package/dist/tests/chains-definitions.test.d.ts +1 -0
- package/dist/tests/core-encryption.test.d.ts +1 -0
- package/dist/tests/core-extended.test.d.ts +1 -0
- package/dist/tests/core-generics-coverage.test.d.ts +1 -0
- package/dist/tests/coverage-boost.test.d.ts +1 -0
- package/dist/tests/crypto-cross-platform-compatibility.test.d.ts +1 -0
- package/dist/tests/data-addfile-permissions-schema.test.d.ts +1 -0
- package/dist/tests/data-additional-methods.test.d.ts +1 -0
- package/dist/tests/data-controller-edge-cases.test.d.ts +1 -0
- package/dist/tests/data-ipfs-gateways.test.d.ts +1 -0
- package/dist/tests/data-relayer.test.d.ts +1 -0
- package/dist/tests/data-schema-validation.test.d.ts +1 -0
- package/dist/tests/data-simple-methods.test.d.ts +1 -0
- package/dist/tests/data.test.d.ts +1 -0
- package/dist/tests/demo-integration.test.d.ts +1 -0
- package/dist/tests/demo-trusted-server-integration.test.d.ts +1 -0
- package/dist/tests/download-relayer.test.d.ts +1 -0
- package/dist/tests/dual-mode-permissions.test.d.ts +1 -0
- package/dist/tests/dual-mode-trusted-servers.test.d.ts +1 -0
- package/dist/tests/encryption-correct-implementation.test.d.ts +1 -0
- package/dist/tests/encryption-coverage.test.d.ts +1 -0
- package/dist/tests/encryption-edge-cases.test.d.ts +1 -0
- package/dist/tests/encryption-utils-updated.test.d.ts +1 -0
- package/dist/tests/errors-coverage.test.d.ts +1 -0
- package/dist/tests/errors.test.d.ts +1 -0
- package/dist/tests/factories/mockFactory.d.ts +316 -0
- package/dist/tests/fakes/FakeStorageManager.d.ts +200 -0
- package/dist/tests/fakes/FakeStorageManager.test.d.ts +1 -0
- package/dist/tests/fakes/FakeWaitForTransactionEvents.d.ts +170 -0
- package/dist/tests/fakes/FakeWaitForTransactionEvents.test.d.ts +1 -0
- package/dist/tests/fakes/fake-pgp-port.d.ts +13 -0
- package/dist/tests/grantValidation-edge-cases.test.d.ts +1 -0
- package/dist/tests/grantValidation-unreachable-branch.test.d.ts +1 -0
- package/dist/tests/helper-methods.test.d.ts +1 -0
- package/dist/tests/helpers/platformTestHelpers.d.ts +106 -0
- package/dist/tests/helpers/typedMocks.d.ts +64 -0
- package/dist/tests/index-browser.test.d.ts +1 -0
- package/dist/tests/index-node.test.d.ts +1 -0
- package/dist/tests/index.test.d.ts +1 -0
- package/dist/tests/mocks/platformAdapter.d.ts +12 -0
- package/dist/tests/new-permissions-methods.test.d.ts +1 -0
- package/dist/tests/no-buffer-browser.test.d.ts +1 -0
- package/dist/tests/permissions-grantee.test.d.ts +1 -0
- package/dist/tests/permissions-revoke-relayer.test.d.ts +1 -0
- package/dist/tests/permissions-schema-validation.test.d.ts +1 -0
- package/dist/tests/permissions-server-files.test.d.ts +1 -0
- package/dist/tests/permissions-transaction-options.test.d.ts +1 -0
- package/dist/tests/permissions-trust-servers.test.d.ts +1 -0
- package/dist/tests/permissions.test.d.ts +1 -0
- package/dist/tests/personal.test.d.ts +1 -0
- package/dist/tests/platform-browser.test.d.ts +1 -0
- package/dist/tests/platform-crypto-expanded.test.d.ts +1 -0
- package/dist/tests/platform-crypto.test.d.ts +1 -0
- package/dist/tests/platform-index.test.d.ts +1 -0
- package/dist/tests/platform-node.test.d.ts +1 -0
- package/dist/tests/platform-shared-utils.test.d.ts +1 -0
- package/dist/tests/platform-updated.test.d.ts +1 -0
- package/dist/tests/protocol-additional-methods.test.d.ts +1 -0
- package/dist/tests/protocol.test.d.ts +1 -0
- package/dist/tests/read-only-mode.test.d.ts +1 -0
- package/dist/tests/relayer-integration.test.d.ts +1 -0
- package/dist/tests/relayer-unified.test.d.ts +1 -0
- package/dist/tests/schemas.test.d.ts +1 -0
- package/dist/tests/server-relayer-handler.test.d.ts +1 -0
- package/dist/tests/setup.d.ts +7 -0
- package/dist/tests/signatureFormatter.test.d.ts +1 -0
- package/dist/tests/trusted-server-queries.test.d.ts +1 -0
- package/dist/tests/typedDataConverter.test.d.ts +1 -0
- package/dist/tests/types-contracts.test.d.ts +1 -0
- package/dist/tests/types-data.test.d.ts +1 -0
- package/dist/tests/types-external-apis.test.d.ts +1 -0
- package/dist/tests/types-generics.test.d.ts +1 -0
- package/dist/tests/types-permissions.test.d.ts +1 -0
- package/dist/tests/types-upload-params.test.d.ts +1 -0
- package/dist/tests/types.test.d.ts +1 -0
- package/dist/tests/utils-formatters.test.d.ts +1 -0
- package/dist/tests/utils-grantFiles-edge-cases.test.d.ts +1 -0
- package/dist/tests/utils-grantFiles-validation.test.d.ts +1 -0
- package/dist/tests/utils-grantFiles.test.d.ts +1 -0
- package/dist/tests/utils-grantValidation-consolidated.test.d.ts +1 -0
- package/dist/tests/utils-grants.test.d.ts +1 -0
- package/dist/tests/utils-ipfs-additional.test.d.ts +1 -0
- package/dist/tests/utils-ipfs.test.d.ts +4 -0
- package/dist/tests/utils-schemaValidation.test.d.ts +1 -0
- package/dist/tests/vana.test.d.ts +1 -0
- package/dist/tests/wallet-crypto-compatibility.test.d.ts +1 -0
- package/dist/types/blockchain.cjs.map +1 -1
- package/dist/types/blockchain.d.ts +46 -13
- package/dist/types/chains-additional.test.d.ts +1 -0
- package/dist/types/chains.cjs.map +1 -1
- package/dist/types/chains.d.ts +80 -16
- package/dist/types/chains.js.map +1 -1
- package/dist/types/config.cjs +10 -0
- package/dist/types/config.cjs.map +1 -1
- package/dist/types/config.d.ts +236 -242
- package/dist/types/config.js +8 -0
- package/dist/types/config.js.map +1 -1
- package/dist/types/contracts.cjs.map +1 -1
- package/dist/types/contracts.d.ts +79 -18
- package/dist/types/controller-context.cjs.map +1 -1
- package/dist/types/controller-context.d.ts +17 -21
- package/dist/types/data.cjs.map +1 -1
- package/dist/types/data.d.ts +111 -49
- package/dist/types/external-apis.d.ts +10 -12
- package/dist/types/generics.cjs.map +1 -1
- package/dist/types/generics.d.ts +116 -48
- package/dist/types/index.cjs +5 -4
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.ts +47 -22
- package/dist/types/index.js +9 -2
- package/dist/types/index.js.map +1 -1
- package/dist/types/operations.cjs +2 -2
- package/dist/types/operations.cjs.map +1 -1
- package/dist/types/operations.d.ts +178 -32
- package/dist/types/operations.js +2 -2
- package/dist/types/operations.js.map +1 -1
- package/dist/types/options.cjs +17 -0
- package/dist/types/options.cjs.map +1 -0
- package/dist/types/options.d.ts +213 -0
- package/dist/types/options.js +1 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/permissions.cjs.map +1 -1
- package/dist/types/permissions.d.ts +72 -78
- package/dist/types/personal.cjs.map +1 -1
- package/dist/types/personal.d.ts +137 -22
- package/dist/types/relayer.cjs.map +1 -1
- package/dist/types/relayer.d.ts +293 -50
- package/dist/types/storage.cjs.map +1 -1
- package/dist/types/storage.d.ts +15 -29
- package/dist/types/storage.js +2 -5
- package/dist/types/storage.js.map +1 -1
- package/dist/types/transactionResults.d.ts +16 -18
- package/dist/types/utils.cjs.map +1 -1
- package/dist/types/utils.d.ts +20 -68
- package/dist/types.d.ts +4 -28
- package/dist/utils/__tests__/parseTransaction.test.d.ts +1 -0
- package/dist/utils/__tests__/pojo-serialization.test.d.ts +1 -0
- package/dist/utils/__tests__/signatureCache.test.d.ts +1 -0
- package/dist/utils/__tests__/subgraphConsistency.test.d.ts +4 -0
- package/dist/utils/__tests__/subgraphPagination.test.d.ts +4 -0
- package/dist/utils/__tests__/transaction-edge-cases.test.d.ts +1 -0
- package/dist/utils/__tests__/transactionHelpers.test.d.ts +1 -0
- package/dist/utils/__tests__/urlResolver.test.d.ts +4 -0
- package/dist/utils/blockchain/registry.cjs +2 -2
- package/dist/utils/blockchain/registry.cjs.map +1 -1
- package/dist/utils/blockchain/registry.d.ts +6 -8
- package/dist/utils/blockchain/registry.js +2 -2
- package/dist/utils/blockchain/registry.js.map +1 -1
- package/dist/utils/blockchain/registry.test.d.ts +1 -0
- package/dist/utils/chainQuery.cjs +107 -0
- package/dist/utils/chainQuery.cjs.map +1 -0
- package/dist/utils/chainQuery.d.ts +31 -0
- package/dist/utils/chainQuery.js +82 -0
- package/dist/utils/chainQuery.js.map +1 -0
- package/dist/utils/crypto-utils.cjs +0 -12
- package/dist/utils/crypto-utils.cjs.map +1 -1
- package/dist/utils/crypto-utils.d.ts +9 -27
- package/dist/utils/crypto-utils.js +0 -11
- package/dist/utils/crypto-utils.js.map +1 -1
- package/dist/utils/crypto-utils.test.d.ts +1 -0
- package/dist/utils/download.cjs +3 -3
- package/dist/utils/download.cjs.map +1 -1
- package/dist/utils/download.d.ts +13 -14
- package/dist/utils/download.js +2 -2
- package/dist/utils/download.js.map +1 -1
- package/dist/utils/encoding.cjs +1 -1
- package/dist/utils/encoding.cjs.map +1 -1
- package/dist/utils/encoding.d.ts +4 -6
- package/dist/utils/encoding.js +1 -1
- package/dist/utils/encoding.js.map +1 -1
- package/dist/utils/encoding.test.d.ts +1 -0
- package/dist/utils/encryption.cjs +16 -10
- package/dist/utils/encryption.cjs.map +1 -1
- package/dist/utils/encryption.d.ts +13 -17
- package/dist/utils/encryption.js +16 -10
- package/dist/utils/encryption.js.map +1 -1
- package/dist/utils/formatters.cjs +4 -2
- package/dist/utils/formatters.cjs.map +1 -1
- package/dist/utils/formatters.d.ts +4 -6
- package/dist/utils/formatters.js +4 -2
- package/dist/utils/formatters.js.map +1 -1
- package/dist/utils/grantFiles.cjs +7 -4
- package/dist/utils/grantFiles.cjs.map +1 -1
- package/dist/utils/grantFiles.d.ts +16 -30
- package/dist/utils/grantFiles.js +7 -4
- package/dist/utils/grantFiles.js.map +1 -1
- package/dist/utils/grantValidation.cjs +1 -1
- package/dist/utils/grantValidation.cjs.map +1 -1
- package/dist/utils/grantValidation.d.ts +109 -33
- package/dist/utils/grantValidation.js +1 -1
- package/dist/utils/grantValidation.js.map +1 -1
- package/dist/utils/grants.cjs +1 -1
- package/dist/utils/grants.cjs.map +1 -1
- package/dist/utils/grants.d.ts +101 -23
- package/dist/utils/grants.js +1 -1
- package/dist/utils/grants.js.map +1 -1
- package/dist/utils/ipfs.cjs +2 -4
- package/dist/utils/ipfs.cjs.map +1 -1
- package/dist/utils/ipfs.d.ts +8 -10
- package/dist/utils/ipfs.js +2 -4
- package/dist/utils/ipfs.js.map +1 -1
- package/dist/utils/lazy-import.cjs +4 -6
- package/dist/utils/lazy-import.cjs.map +1 -1
- package/dist/utils/lazy-import.d.ts +33 -10
- package/dist/utils/lazy-import.js +4 -6
- package/dist/utils/lazy-import.js.map +1 -1
- package/dist/utils/multicall.cjs +4 -2
- package/dist/utils/multicall.cjs.map +1 -1
- package/dist/utils/multicall.d.ts +5 -8
- package/dist/utils/multicall.js +4 -2
- package/dist/utils/multicall.js.map +1 -1
- package/dist/utils/parseTransactionPojo.cjs.map +1 -1
- package/dist/utils/parseTransactionPojo.d.ts +4 -10
- package/dist/utils/parseTransactionPojo.js.map +1 -1
- package/dist/utils/schemaValidation.cjs +5 -5
- package/dist/utils/schemaValidation.cjs.map +1 -1
- package/dist/utils/schemaValidation.d.ts +8 -12
- package/dist/utils/schemaValidation.js +7 -10
- package/dist/utils/schemaValidation.js.map +1 -1
- package/dist/utils/signatureCache.cjs +9 -4
- package/dist/utils/signatureCache.cjs.map +1 -1
- package/dist/utils/signatureCache.d.ts +53 -15
- package/dist/utils/signatureCache.js +12 -10
- package/dist/utils/signatureCache.js.map +1 -1
- package/dist/utils/signatureFormatter.cjs +6 -9
- package/dist/utils/signatureFormatter.cjs.map +1 -1
- package/dist/utils/signatureFormatter.d.ts +2 -5
- package/dist/utils/signatureFormatter.js +6 -9
- package/dist/utils/signatureFormatter.js.map +1 -1
- package/dist/utils/subgraphConsistency.cjs +184 -0
- package/dist/utils/subgraphConsistency.cjs.map +1 -0
- package/dist/utils/subgraphConsistency.d.ts +65 -0
- package/dist/utils/subgraphConsistency.js +155 -0
- package/dist/utils/subgraphConsistency.js.map +1 -0
- package/dist/utils/subgraphMetaCache.cjs +101 -0
- package/dist/utils/subgraphMetaCache.cjs.map +1 -0
- package/dist/utils/subgraphMetaCache.d.ts +56 -0
- package/dist/utils/subgraphMetaCache.js +76 -0
- package/dist/utils/subgraphMetaCache.js.map +1 -0
- package/dist/utils/subgraphPagination.cjs +104 -0
- package/dist/utils/subgraphPagination.cjs.map +1 -0
- package/dist/utils/subgraphPagination.d.ts +78 -0
- package/dist/utils/subgraphPagination.js +78 -0
- package/dist/utils/subgraphPagination.js.map +1 -0
- package/dist/utils/tests/multicall.test.d.ts +1 -0
- package/dist/utils/transactionHelpers.cjs.map +1 -1
- package/dist/utils/transactionHelpers.d.ts +17 -23
- package/dist/utils/transactionHelpers.js.map +1 -1
- package/dist/utils/typeGuards.cjs +109 -0
- package/dist/utils/typeGuards.cjs.map +1 -0
- package/dist/utils/typeGuards.d.ts +138 -0
- package/dist/utils/typeGuards.js +74 -0
- package/dist/utils/typeGuards.js.map +1 -0
- package/dist/utils/typedDataConverter.cjs.map +1 -1
- package/dist/utils/typedDataConverter.d.ts +42 -9
- package/dist/utils/typedDataConverter.js.map +1 -1
- package/dist/utils/urlResolver.cjs +8 -1
- package/dist/utils/urlResolver.cjs.map +1 -1
- package/dist/utils/urlResolver.d.ts +24 -8
- package/dist/utils/urlResolver.js +9 -2
- package/dist/utils/urlResolver.js.map +1 -1
- package/dist/utils/wallet.cjs +63 -0
- package/dist/utils/wallet.cjs.map +1 -0
- package/dist/utils/wallet.d.ts +94 -0
- package/dist/utils/wallet.js +37 -0
- package/dist/utils/wallet.js.map +1 -0
- package/dist/utils/withEvents.cjs.map +1 -1
- package/dist/utils/withEvents.d.ts +5 -12
- package/dist/utils/withEvents.js.map +1 -1
- package/package.json +24 -16
- package/dist/browser.d.cts +0 -2
- package/dist/chains/definitions.d.cts +0 -53
- package/dist/chains/index.d.cts +0 -2
- package/dist/chains.browser.cjs +0 -37
- package/dist/chains.browser.cjs.map +0 -1
- package/dist/chains.browser.d.cts +0 -2
- package/dist/chains.d.cts +0 -2
- package/dist/chains.node.d.cts +0 -2
- package/dist/config/addresses.d.cts +0 -401
- package/dist/config/chains.d.cts +0 -85
- package/dist/config/features.d.cts +0 -64
- package/dist/contracts/contractController.d.cts +0 -117
- package/dist/controllers/data.d.cts +0 -915
- package/dist/controllers/permissions.d.cts +0 -1383
- package/dist/controllers/protocol.d.cts +0 -188
- package/dist/controllers/schemas.d.cts +0 -260
- package/dist/controllers/server.d.cts +0 -230
- package/dist/core/apiClient.d.cts +0 -165
- package/dist/core/client.d.cts +0 -92
- package/dist/core/generics.d.cts +0 -120
- package/dist/core.d.cts +0 -493
- package/dist/crypto/ecies/__tests__/test-vectors.d.cts +0 -40
- package/dist/crypto/ecies/base.d.cts +0 -143
- package/dist/crypto/ecies/browser.d.cts +0 -48
- package/dist/crypto/ecies/constants.d.cts +0 -122
- package/dist/crypto/ecies/index.d.cts +0 -1
- package/dist/crypto/ecies/interface.d.cts +0 -176
- package/dist/crypto/ecies/node.d.cts +0 -50
- package/dist/crypto/ecies/test-vectors/eccrypto-vectors.d.cts +0 -76
- package/dist/crypto/ecies/test-vectors/eccrypto-vectors.d.ts +0 -76
- package/dist/crypto/ecies/utils.d.cts +0 -67
- package/dist/crypto/services/WalletKeyEncryptionService.d.cts +0 -92
- package/dist/diagnostics.d.cts +0 -26
- package/dist/errors.d.cts +0 -350
- package/dist/generated/abi/ComputeEngineImplementation.d.cts +0 -996
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.d.cts +0 -545
- package/dist/generated/abi/DATFactoryImplementation.d.cts +0 -661
- package/dist/generated/abi/DATImplementation.d.cts +0 -693
- package/dist/generated/abi/DATPausableImplementation.d.cts +0 -1145
- package/dist/generated/abi/DATVotesImplementation.d.cts +0 -1095
- package/dist/generated/abi/DLPPerformanceImplementation.d.cts +0 -883
- package/dist/generated/abi/DLPRegistryImplementation.d.cts +0 -1123
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.d.cts +0 -452
- package/dist/generated/abi/DLPRewardDeployerImplementation.d.cts +0 -714
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.d.cts +0 -452
- package/dist/generated/abi/DLPRewardSwapImplementation.d.cts +0 -706
- package/dist/generated/abi/DLPRootImplementation.d.cts +0 -1248
- package/dist/generated/abi/DLPTreasuryImplementation.d.cts +0 -452
- package/dist/generated/abi/DataLiquidityPoolImplementation.d.cts +0 -737
- package/dist/generated/abi/DataPortabilityGranteesImplementation.d.cts +0 -661
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.cts +0 -989
- package/dist/generated/abi/DataPortabilityServersImplementation.d.cts +0 -1086
- package/dist/generated/abi/DataRefinerRegistryImplementation.d.cts +0 -737
- package/dist/generated/abi/DataRegistryImplementation.d.cts +0 -1014
- package/dist/generated/abi/QueryEngineImplementation.d.cts +0 -1001
- package/dist/generated/abi/SwapHelperImplementation.d.cts +0 -764
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.d.cts +0 -701
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.d.cts +0 -701
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.d.cts +0 -701
- package/dist/generated/abi/TeePoolImplementation.d.cts +0 -993
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.d.cts +0 -701
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.d.cts +0 -701
- package/dist/generated/abi/TeePoolPhalaImplementation.d.cts +0 -993
- package/dist/generated/abi/VanaEpochImplementation.d.cts +0 -900
- package/dist/generated/abi/VanaPoolEntityImplementation.d.cts +0 -934
- package/dist/generated/abi/VanaPoolStakingImplementation.d.cts +0 -693
- package/dist/generated/abi/VanaPoolTreasuryImplementation.d.cts +0 -394
- package/dist/generated/abi/index.d.cts +0 -26547
- package/dist/generated/event-types.d.cts +0 -855
- package/dist/generated/eventRegistry.d.cts +0 -18
- package/dist/generated/server/server-exports.d.cts +0 -21
- package/dist/generated/server/server.d.cts +0 -512
- package/dist/generated/subgraph.d.cts +0 -5981
- package/dist/index.browser.cjs +0 -151
- package/dist/index.browser.cjs.map +0 -1
- package/dist/index.browser.d.cts +0 -201
- package/dist/index.d.cts +0 -2
- package/dist/index.node.d.cts +0 -87
- package/dist/node.d.cts +0 -2
- package/dist/platform/browser-only.d.cts +0 -25
- package/dist/platform/browser-safe.d.cts +0 -32
- package/dist/platform/browser.d.cts +0 -74
- package/dist/platform/index.d.cts +0 -5
- package/dist/platform/interface.d.cts +0 -218
- package/dist/platform/node.d.cts +0 -27
- package/dist/platform/shared/error-utils.d.cts +0 -25
- package/dist/platform/shared/pgp-utils.d.cts +0 -61
- package/dist/platform/shared/stream-utils.d.cts +0 -16
- package/dist/platform/utils.d.cts +0 -53
- package/dist/platform.browser.cjs +0 -41
- package/dist/platform.browser.cjs.map +0 -1
- package/dist/platform.browser.d.cts +0 -4
- package/dist/platform.d.cts +0 -5
- package/dist/platform.node.d.cts +0 -5
- package/dist/schemas/dataSchema.schema.d.cts +0 -88
- package/dist/schemas/dataSchema.schema.d.ts +0 -88
- package/dist/schemas/grantFile.schema.d.cts +0 -57
- package/dist/schemas/grantFile.schema.d.ts +0 -57
- package/dist/server/handler.cjs +0 -101
- package/dist/server/handler.cjs.map +0 -1
- package/dist/server/handler.d.cts +0 -306
- package/dist/server/handler.d.ts +0 -306
- package/dist/server/handler.js +0 -77
- package/dist/server/handler.js.map +0 -1
- package/dist/storage/index.d.cts +0 -10
- package/dist/storage/manager.d.cts +0 -150
- package/dist/storage/providers/callback-storage.d.cts +0 -100
- package/dist/storage/providers/google-drive.d.cts +0 -156
- package/dist/storage/providers/ipfs.d.cts +0 -163
- package/dist/storage/providers/pinata.d.cts +0 -173
- package/dist/types/blockchain.d.cts +0 -52
- package/dist/types/chains.d.cts +0 -34
- package/dist/types/config.d.cts +0 -726
- package/dist/types/contracts.d.cts +0 -68
- package/dist/types/controller-context.d.cts +0 -71
- package/dist/types/data.d.cts +0 -694
- package/dist/types/eccrypto-js.d.d.cts +0 -13
- package/dist/types/eccrypto-js.d.d.ts +0 -13
- package/dist/types/external-apis.d.cts +0 -186
- package/dist/types/generics.d.cts +0 -450
- package/dist/types/index.d.cts +0 -22
- package/dist/types/operations.d.cts +0 -116
- package/dist/types/permissions.d.cts +0 -957
- package/dist/types/personal.d.cts +0 -40
- package/dist/types/relayer.d.cts +0 -284
- package/dist/types/storage.d.cts +0 -131
- package/dist/types/transactionResults.d.cts +0 -195
- package/dist/types/utils.d.cts +0 -819
- package/dist/types.d.cts +0 -54
- package/dist/utils/blockchain/registry.d.cts +0 -34
- package/dist/utils/crypto-utils.d.cts +0 -118
- package/dist/utils/download.d.cts +0 -41
- package/dist/utils/encoding.d.cts +0 -54
- package/dist/utils/encryption.d.cts +0 -275
- package/dist/utils/formatters.d.cts +0 -120
- package/dist/utils/grantFiles.d.cts +0 -186
- package/dist/utils/grantValidation.d.cts +0 -150
- package/dist/utils/grants.d.cts +0 -70
- package/dist/utils/ipfs.d.cts +0 -90
- package/dist/utils/lazy-import.d.cts +0 -20
- package/dist/utils/multicall.d.cts +0 -129
- package/dist/utils/parseTransactionPojo.d.cts +0 -37
- package/dist/utils/schemaValidation.d.cts +0 -172
- package/dist/utils/signatureCache.d.cts +0 -134
- package/dist/utils/signatureFormatter.d.cts +0 -39
- package/dist/utils/transactionHelpers.d.cts +0 -86
- package/dist/utils/typedDataConverter.d.cts +0 -13
- package/dist/utils/urlResolver.d.cts +0 -40
- package/dist/utils/withEvents.d.cts +0 -63
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Port interface for PGP operations
|
|
3
|
+
*
|
|
4
|
+
* This interface abstracts away the complexity of the underlying PGP library
|
|
5
|
+
* and provides a clean, testable API for PGP operations.
|
|
6
|
+
*/
|
|
7
|
+
export interface PgpKeyPairOptions {
|
|
8
|
+
name?: string;
|
|
9
|
+
email?: string;
|
|
10
|
+
passphrase?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PgpKeyPair {
|
|
13
|
+
publicKey: string;
|
|
14
|
+
privateKey: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PgpEncryptInput {
|
|
17
|
+
text: string;
|
|
18
|
+
publicKeyArmored: string;
|
|
19
|
+
}
|
|
20
|
+
export interface PgpDecryptInput {
|
|
21
|
+
messageArmored: string;
|
|
22
|
+
privateKeyArmored: string;
|
|
23
|
+
passphrase?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface PgpResult {
|
|
26
|
+
data: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Clean interface for PGP operations
|
|
30
|
+
*/
|
|
31
|
+
export interface PgpPort {
|
|
32
|
+
encrypt(input: PgpEncryptInput): Promise<PgpResult>;
|
|
33
|
+
decrypt(input: PgpDecryptInput): Promise<PgpResult>;
|
|
34
|
+
generateKeyPair(options?: PgpKeyPairOptions): Promise<PgpKeyPair>;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=pgp-port.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* @param error The original error that occurred
|
|
13
13
|
* @returns Wrapped error with consistent format
|
|
14
14
|
*/
|
|
15
|
-
declare function wrapCryptoError(operation: string, error: unknown): Error;
|
|
15
|
+
export declare function wrapCryptoError(operation: string, error: unknown): Error;
|
|
16
16
|
/**
|
|
17
17
|
* Validate encrypted data structure has required fields
|
|
18
18
|
* Ensures encrypted data objects contain the expected properties
|
|
@@ -20,6 +20,4 @@ declare function wrapCryptoError(operation: string, error: unknown): Error;
|
|
|
20
20
|
* @param data The data structure to validate
|
|
21
21
|
* @throws Error if data structure is invalid
|
|
22
22
|
*/
|
|
23
|
-
declare function validateEncryptedDataStructure(data: unknown): void;
|
|
24
|
-
|
|
25
|
-
export { validateEncryptedDataStructure, wrapCryptoError };
|
|
23
|
+
export declare function validateEncryptedDataStructure(data: unknown): void;
|
|
@@ -31,8 +31,8 @@ const STANDARD_PGP_CONFIG = {
|
|
|
31
31
|
};
|
|
32
32
|
function processPGPKeyOptions(options) {
|
|
33
33
|
return {
|
|
34
|
-
name: options?.name
|
|
35
|
-
email: options?.email
|
|
34
|
+
name: options?.name ?? "Vana User",
|
|
35
|
+
email: options?.email ?? "user@vana.org",
|
|
36
36
|
passphrase: options?.passphrase
|
|
37
37
|
};
|
|
38
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/platform/shared/pgp-utils.ts"],"sourcesContent":["/**\n * Shared PGP utilities for platform adapters\n *\n * IMPORTANT: This module contains NO IMPORTS to avoid affecting bundle loading.\n * All functions are pure utilities that can be safely shared across platforms.\n */\n\n/**\n * Standard OpenPGP configuration for consistent behavior across platforms\n * Uses enum values instead of importing openpgp to avoid loading issues\n */\nexport const STANDARD_PGP_CONFIG = {\n preferredCompressionAlgorithm: 2, // zlib (openpgp.enums.compression.zlib)\n preferredSymmetricAlgorithm: 7, // aes256 (openpgp.enums.symmetric.aes256)\n} as const;\n\n/**\n * Process PGP key generation options with sensible defaults\n *\n * @param options - Optional key generation parameters\n * @param options.name - The name for the PGP key (defaults to \"Vana User\")\n * @param options.email - The email for the PGP key (defaults to \"user@vana.org\")\n * @param options.passphrase - Optional passphrase to protect the private key\n * @returns Processed options with defaults applied\n */\nexport function processPGPKeyOptions(options?: {\n name?: string;\n email?: string;\n passphrase?: string;\n}) {\n return {\n name: options?.name
|
|
1
|
+
{"version":3,"sources":["../../../src/platform/shared/pgp-utils.ts"],"sourcesContent":["/**\n * Shared PGP utilities for platform adapters\n *\n * IMPORTANT: This module contains NO IMPORTS to avoid affecting bundle loading.\n * All functions are pure utilities that can be safely shared across platforms.\n */\n\n/**\n * Standard OpenPGP configuration for consistent behavior across platforms\n * Uses enum values instead of importing openpgp to avoid loading issues\n */\nexport const STANDARD_PGP_CONFIG = {\n preferredCompressionAlgorithm: 2, // zlib (openpgp.enums.compression.zlib)\n preferredSymmetricAlgorithm: 7, // aes256 (openpgp.enums.symmetric.aes256)\n} as const;\n\n/**\n * Process PGP key generation options with sensible defaults\n *\n * @param options - Optional key generation parameters\n * @param options.name - The name for the PGP key (defaults to \"Vana User\")\n * @param options.email - The email for the PGP key (defaults to \"user@vana.org\")\n * @param options.passphrase - Optional passphrase to protect the private key\n * @returns Processed options with defaults applied\n */\nexport function processPGPKeyOptions(options?: {\n name?: string;\n email?: string;\n passphrase?: string;\n}) {\n return {\n name: options?.name ?? \"Vana User\",\n email: options?.email ?? \"user@vana.org\",\n passphrase: options?.passphrase,\n };\n}\n\n/**\n * Get standard PGP key generation parameters\n * Combines default values with standard configuration\n *\n * @param options - Optional key generation parameters\n * @param options.name - The name for the PGP key (defaults to \"Vana User\")\n * @param options.email - The email for the PGP key (defaults to \"user@vana.org\")\n * @param options.passphrase - Optional passphrase to protect the private key\n * @returns Complete key generation parameters object\n */\nexport function getPGPKeyGenParams(options?: {\n name?: string;\n email?: string;\n passphrase?: string;\n}) {\n const { name, email, passphrase } = processPGPKeyOptions(options);\n\n return {\n type: \"rsa\" as const,\n rsaBits: 2048,\n userIDs: [{ name, email }],\n passphrase,\n config: STANDARD_PGP_CONFIG,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWO,MAAM,sBAAsB;AAAA,EACjC,+BAA+B;AAAA;AAAA,EAC/B,6BAA6B;AAAA;AAC/B;AAWO,SAAS,qBAAqB,SAIlC;AACD,SAAO;AAAA,IACL,MAAM,SAAS,QAAQ;AAAA,IACvB,OAAO,SAAS,SAAS;AAAA,IACzB,YAAY,SAAS;AAAA,EACvB;AACF;AAYO,SAAS,mBAAmB,SAIhC;AACD,QAAM,EAAE,MAAM,OAAO,WAAW,IAAI,qBAAqB,OAAO;AAEhE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;AAAA,IACzB;AAAA,IACA,QAAQ;AAAA,EACV;AACF;","names":[]}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Standard OpenPGP configuration for consistent behavior across platforms
|
|
9
9
|
* Uses enum values instead of importing openpgp to avoid loading issues
|
|
10
10
|
*/
|
|
11
|
-
declare const STANDARD_PGP_CONFIG: {
|
|
11
|
+
export declare const STANDARD_PGP_CONFIG: {
|
|
12
12
|
readonly preferredCompressionAlgorithm: 2;
|
|
13
13
|
readonly preferredSymmetricAlgorithm: 7;
|
|
14
14
|
};
|
|
@@ -21,7 +21,7 @@ declare const STANDARD_PGP_CONFIG: {
|
|
|
21
21
|
* @param options.passphrase - Optional passphrase to protect the private key
|
|
22
22
|
* @returns Processed options with defaults applied
|
|
23
23
|
*/
|
|
24
|
-
declare function processPGPKeyOptions(options?: {
|
|
24
|
+
export declare function processPGPKeyOptions(options?: {
|
|
25
25
|
name?: string;
|
|
26
26
|
email?: string;
|
|
27
27
|
passphrase?: string;
|
|
@@ -40,7 +40,7 @@ declare function processPGPKeyOptions(options?: {
|
|
|
40
40
|
* @param options.passphrase - Optional passphrase to protect the private key
|
|
41
41
|
* @returns Complete key generation parameters object
|
|
42
42
|
*/
|
|
43
|
-
declare function getPGPKeyGenParams(options?: {
|
|
43
|
+
export declare function getPGPKeyGenParams(options?: {
|
|
44
44
|
name?: string;
|
|
45
45
|
email?: string;
|
|
46
46
|
passphrase?: string;
|
|
@@ -57,5 +57,3 @@ declare function getPGPKeyGenParams(options?: {
|
|
|
57
57
|
readonly preferredSymmetricAlgorithm: 7;
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
|
-
|
|
61
|
-
export { STANDARD_PGP_CONFIG, getPGPKeyGenParams, processPGPKeyOptions };
|
|
@@ -6,8 +6,8 @@ const STANDARD_PGP_CONFIG = {
|
|
|
6
6
|
};
|
|
7
7
|
function processPGPKeyOptions(options) {
|
|
8
8
|
return {
|
|
9
|
-
name: options?.name
|
|
10
|
-
email: options?.email
|
|
9
|
+
name: options?.name ?? "Vana User",
|
|
10
|
+
email: options?.email ?? "user@vana.org",
|
|
11
11
|
passphrase: options?.passphrase
|
|
12
12
|
};
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/platform/shared/pgp-utils.ts"],"sourcesContent":["/**\n * Shared PGP utilities for platform adapters\n *\n * IMPORTANT: This module contains NO IMPORTS to avoid affecting bundle loading.\n * All functions are pure utilities that can be safely shared across platforms.\n */\n\n/**\n * Standard OpenPGP configuration for consistent behavior across platforms\n * Uses enum values instead of importing openpgp to avoid loading issues\n */\nexport const STANDARD_PGP_CONFIG = {\n preferredCompressionAlgorithm: 2, // zlib (openpgp.enums.compression.zlib)\n preferredSymmetricAlgorithm: 7, // aes256 (openpgp.enums.symmetric.aes256)\n} as const;\n\n/**\n * Process PGP key generation options with sensible defaults\n *\n * @param options - Optional key generation parameters\n * @param options.name - The name for the PGP key (defaults to \"Vana User\")\n * @param options.email - The email for the PGP key (defaults to \"user@vana.org\")\n * @param options.passphrase - Optional passphrase to protect the private key\n * @returns Processed options with defaults applied\n */\nexport function processPGPKeyOptions(options?: {\n name?: string;\n email?: string;\n passphrase?: string;\n}) {\n return {\n name: options?.name
|
|
1
|
+
{"version":3,"sources":["../../../src/platform/shared/pgp-utils.ts"],"sourcesContent":["/**\n * Shared PGP utilities for platform adapters\n *\n * IMPORTANT: This module contains NO IMPORTS to avoid affecting bundle loading.\n * All functions are pure utilities that can be safely shared across platforms.\n */\n\n/**\n * Standard OpenPGP configuration for consistent behavior across platforms\n * Uses enum values instead of importing openpgp to avoid loading issues\n */\nexport const STANDARD_PGP_CONFIG = {\n preferredCompressionAlgorithm: 2, // zlib (openpgp.enums.compression.zlib)\n preferredSymmetricAlgorithm: 7, // aes256 (openpgp.enums.symmetric.aes256)\n} as const;\n\n/**\n * Process PGP key generation options with sensible defaults\n *\n * @param options - Optional key generation parameters\n * @param options.name - The name for the PGP key (defaults to \"Vana User\")\n * @param options.email - The email for the PGP key (defaults to \"user@vana.org\")\n * @param options.passphrase - Optional passphrase to protect the private key\n * @returns Processed options with defaults applied\n */\nexport function processPGPKeyOptions(options?: {\n name?: string;\n email?: string;\n passphrase?: string;\n}) {\n return {\n name: options?.name ?? \"Vana User\",\n email: options?.email ?? \"user@vana.org\",\n passphrase: options?.passphrase,\n };\n}\n\n/**\n * Get standard PGP key generation parameters\n * Combines default values with standard configuration\n *\n * @param options - Optional key generation parameters\n * @param options.name - The name for the PGP key (defaults to \"Vana User\")\n * @param options.email - The email for the PGP key (defaults to \"user@vana.org\")\n * @param options.passphrase - Optional passphrase to protect the private key\n * @returns Complete key generation parameters object\n */\nexport function getPGPKeyGenParams(options?: {\n name?: string;\n email?: string;\n passphrase?: string;\n}) {\n const { name, email, passphrase } = processPGPKeyOptions(options);\n\n return {\n type: \"rsa\" as const,\n rsaBits: 2048,\n userIDs: [{ name, email }],\n passphrase,\n config: STANDARD_PGP_CONFIG,\n };\n}\n"],"mappings":"AAWO,MAAM,sBAAsB;AAAA,EACjC,+BAA+B;AAAA;AAAA,EAC/B,6BAA6B;AAAA;AAC/B;AAWO,SAAS,qBAAqB,SAIlC;AACD,SAAO;AAAA,IACL,MAAM,SAAS,QAAQ;AAAA,IACvB,OAAO,SAAS,SAAS;AAAA,IACzB,YAAY,SAAS;AAAA,EACvB;AACF;AAYO,SAAS,mBAAmB,SAIhC;AACD,QAAM,EAAE,MAAM,OAAO,WAAW,IAAI,qBAAqB,OAAO;AAEhE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;AAAA,IACzB;AAAA,IACA,QAAQ;AAAA,EACV;AACF;","names":[]}
|
|
@@ -11,6 +11,4 @@
|
|
|
11
11
|
* @param stream The ReadableStream to convert
|
|
12
12
|
* @returns Promise resolving to Uint8Array containing all stream data
|
|
13
13
|
*/
|
|
14
|
-
declare function streamToUint8Array(stream: ReadableStream<Uint8Array>): Promise<Uint8Array>;
|
|
15
|
-
|
|
16
|
-
export { streamToUint8Array };
|
|
14
|
+
export declare function streamToUint8Array(stream: ReadableStream<Uint8Array>): Promise<Uint8Array>;
|
package/dist/platform/utils.d.ts
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
import { PlatformType, VanaPlatformAdapter } from './interface.js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Platform detection and adapter utilities
|
|
5
3
|
*
|
|
6
4
|
* This module provides utilities for detecting the current runtime environment
|
|
7
5
|
* and creating appropriate platform adapters automatically.
|
|
8
6
|
*/
|
|
9
|
-
|
|
7
|
+
import type { VanaPlatformAdapter, PlatformType } from "./interface";
|
|
10
8
|
/**
|
|
11
9
|
* Detects the current runtime environment
|
|
12
10
|
*
|
|
13
11
|
* @returns The detected platform type
|
|
14
12
|
*/
|
|
15
|
-
declare function detectPlatform(): PlatformType;
|
|
13
|
+
export declare function detectPlatform(): PlatformType;
|
|
16
14
|
/**
|
|
17
15
|
* Creates the appropriate platform adapter based on the current environment
|
|
18
16
|
*
|
|
19
17
|
* @returns A platform adapter instance for the current environment
|
|
20
18
|
* @throws {Error} If platform adapters cannot be imported or created
|
|
21
19
|
*/
|
|
22
|
-
declare function createPlatformAdapter(): Promise<VanaPlatformAdapter>;
|
|
20
|
+
export declare function createPlatformAdapter(): Promise<VanaPlatformAdapter>;
|
|
23
21
|
/**
|
|
24
22
|
* Creates a platform adapter for a specific platform type
|
|
25
23
|
*
|
|
@@ -27,20 +25,20 @@ declare function createPlatformAdapter(): Promise<VanaPlatformAdapter>;
|
|
|
27
25
|
* @returns A platform adapter instance for the specified platform
|
|
28
26
|
* @throws {Error} If platform adapters cannot be imported or created
|
|
29
27
|
*/
|
|
30
|
-
declare function createPlatformAdapterFor(platformType: PlatformType): Promise<VanaPlatformAdapter>;
|
|
28
|
+
export declare function createPlatformAdapterFor(platformType: PlatformType): Promise<VanaPlatformAdapter>;
|
|
31
29
|
/**
|
|
32
30
|
* Checks if the current environment supports the given platform adapter
|
|
33
31
|
*
|
|
34
32
|
* @param platformType - The platform type to check
|
|
35
33
|
* @returns True if the platform is supported, false otherwise
|
|
36
34
|
*/
|
|
37
|
-
declare function isPlatformSupported(platformType: PlatformType): boolean;
|
|
35
|
+
export declare function isPlatformSupported(platformType: PlatformType): boolean;
|
|
38
36
|
/**
|
|
39
37
|
* Gets platform-specific capabilities
|
|
40
38
|
*
|
|
41
39
|
* @returns Object describing available platform capabilities
|
|
42
40
|
*/
|
|
43
|
-
declare function getPlatformCapabilities(): {
|
|
41
|
+
export declare function getPlatformCapabilities(): {
|
|
44
42
|
platform: PlatformType;
|
|
45
43
|
crypto: {
|
|
46
44
|
webCrypto: false | SubtleCrypto;
|
|
@@ -49,5 +47,3 @@ declare function getPlatformCapabilities(): {
|
|
|
49
47
|
fetch: boolean;
|
|
50
48
|
streams: boolean;
|
|
51
49
|
};
|
|
52
|
-
|
|
53
|
-
export { createPlatformAdapter, createPlatformAdapterFor, detectPlatform, getPlatformCapabilities, isPlatformSupported };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Browser-specific platform adapters entry point
|
|
3
|
+
*
|
|
4
|
+
* This module provides browser-safe platform utilities without Node.js dependencies.
|
|
5
|
+
*/
|
|
6
|
+
export { BrowserPlatformAdapter } from "./platform/browser";
|
|
7
|
+
export type { VanaPlatformAdapter } from "./platform/interface";
|
|
8
|
+
export { createBrowserPlatformAdapter, createPlatformAdapterSafe, } from "./platform/browser-only";
|
|
9
|
+
export { detectPlatform, isPlatformSupported, getPlatformCapabilities, } from "./platform/utils";
|
package/dist/platform.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Platform adapters entry point
|
|
3
|
+
*
|
|
4
|
+
* This module provides platform-specific utilities for different environments.
|
|
5
|
+
* Use this when you need platform detection or adapter creation.
|
|
6
|
+
*/
|
|
7
|
+
export { BrowserPlatformAdapter } from "./platform/browser";
|
|
8
|
+
export { NodePlatformAdapter } from "./platform/node";
|
|
9
|
+
export type { VanaPlatformAdapter } from "./platform/interface";
|
|
10
|
+
export { detectPlatform, createPlatformAdapter, createPlatformAdapterFor, isPlatformSupported, getPlatformCapabilities, } from "./platform/utils";
|
|
11
|
+
export { createNodePlatformAdapter, createBrowserPlatformAdapter, createPlatformAdapterSafe, } from "./platform/browser-safe";
|
package/dist/platform.node.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Node.js-specific platform adapters entry point
|
|
3
|
+
*
|
|
4
|
+
* This module provides full platform utilities including Node.js support.
|
|
5
|
+
*/
|
|
6
|
+
export { BrowserPlatformAdapter } from "./platform/browser";
|
|
7
|
+
export { NodePlatformAdapter } from "./platform/node";
|
|
8
|
+
export type { VanaPlatformAdapter } from "./platform/interface";
|
|
9
|
+
export { detectPlatform, createPlatformAdapter, createPlatformAdapterFor, isPlatformSupported, getPlatformCapabilities, } from "./platform/utils";
|
|
10
|
+
export { createNodePlatformAdapter, createBrowserPlatformAdapter, createPlatformAdapterSafe, } from "./platform/browser-safe";
|
|
@@ -0,0 +1,337 @@
|
|
|
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 relayerHandler_exports = {};
|
|
20
|
+
__export(relayerHandler_exports, {
|
|
21
|
+
handleRelayerOperation: () => handleRelayerOperation
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(relayerHandler_exports);
|
|
24
|
+
var import_uuid = require("uuid");
|
|
25
|
+
var import_errors = require("../errors");
|
|
26
|
+
var import_viem = require("viem");
|
|
27
|
+
async function handleRelayerOperation(sdk, request, options) {
|
|
28
|
+
const store = sdk.operationStore;
|
|
29
|
+
if (store) {
|
|
30
|
+
if (request.type === "status_check") {
|
|
31
|
+
const state = await store.get(request.operationId);
|
|
32
|
+
if (!state) return { type: "error", error: "Operation not found" };
|
|
33
|
+
if (state.status === "confirmed")
|
|
34
|
+
return {
|
|
35
|
+
type: "confirmed",
|
|
36
|
+
hash: state.transactionHash,
|
|
37
|
+
receipt: state.finalReceipt
|
|
38
|
+
};
|
|
39
|
+
if (state.status === "failed")
|
|
40
|
+
return { type: "error", error: state.error ?? "Operation failed" };
|
|
41
|
+
if (state.status === "pending") {
|
|
42
|
+
try {
|
|
43
|
+
const publicClient = sdk.publicClient;
|
|
44
|
+
if (publicClient) {
|
|
45
|
+
let receipt;
|
|
46
|
+
try {
|
|
47
|
+
receipt = await publicClient.getTransactionReceipt({
|
|
48
|
+
hash: state.transactionHash
|
|
49
|
+
});
|
|
50
|
+
} catch (receiptError) {
|
|
51
|
+
if (receiptError?.name !== "TransactionReceiptNotFoundError") {
|
|
52
|
+
console.warn(
|
|
53
|
+
`\u26A0\uFE0F [Relayer] Unexpected error checking receipt:`,
|
|
54
|
+
receiptError?.message ?? receiptError
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
receipt = null;
|
|
58
|
+
}
|
|
59
|
+
if (receipt) {
|
|
60
|
+
const updatedState = {
|
|
61
|
+
...state,
|
|
62
|
+
status: receipt.status === "success" ? "confirmed" : "failed",
|
|
63
|
+
finalReceipt: receipt,
|
|
64
|
+
...receipt.status !== "success" && {
|
|
65
|
+
error: "Transaction reverted on chain"
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
await store.set(request.operationId, updatedState);
|
|
69
|
+
if (receipt.status === "success") {
|
|
70
|
+
return {
|
|
71
|
+
type: "confirmed",
|
|
72
|
+
hash: state.transactionHash,
|
|
73
|
+
receipt
|
|
74
|
+
};
|
|
75
|
+
} else {
|
|
76
|
+
return {
|
|
77
|
+
type: "error",
|
|
78
|
+
error: "Transaction reverted on chain"
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
console.warn(
|
|
84
|
+
"\u26A0\uFE0F [Relayer] No public client available for status checking"
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error(
|
|
89
|
+
`\u274C [Relayer] Unexpected error in status check:`,
|
|
90
|
+
error
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return { type: "pending", operationId: request.operationId };
|
|
95
|
+
}
|
|
96
|
+
const operationId = (0, import_uuid.v4)();
|
|
97
|
+
try {
|
|
98
|
+
const txResult = await routeAndExecuteRequest(sdk, request, options);
|
|
99
|
+
if ("hash" in txResult) {
|
|
100
|
+
await store.set(operationId, {
|
|
101
|
+
status: "pending",
|
|
102
|
+
transactionHash: txResult.hash,
|
|
103
|
+
originalRequest: request,
|
|
104
|
+
nonce: options?.nonce,
|
|
105
|
+
retryCount: 0,
|
|
106
|
+
lastAttemptedGas: {
|
|
107
|
+
maxFeePerGas: options?.maxFeePerGas?.toString(),
|
|
108
|
+
maxPriorityFeePerGas: options?.maxPriorityFeePerGas?.toString()
|
|
109
|
+
},
|
|
110
|
+
submittedAt: Date.now()
|
|
111
|
+
});
|
|
112
|
+
return { type: "pending", operationId };
|
|
113
|
+
} else {
|
|
114
|
+
return { type: "direct", result: txResult };
|
|
115
|
+
}
|
|
116
|
+
} catch (e) {
|
|
117
|
+
const error = e instanceof Error ? e : new Error("Unknown error during operation submission");
|
|
118
|
+
return { type: "error", error: error.message };
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
if (request.type === "status_check") {
|
|
122
|
+
return {
|
|
123
|
+
type: "error",
|
|
124
|
+
error: "Stateless relayer does not support operation status checks."
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
const txResult = await routeAndExecuteRequest(sdk, request, options);
|
|
129
|
+
if ("hash" in txResult) {
|
|
130
|
+
return { type: "submitted", hash: txResult.hash };
|
|
131
|
+
} else {
|
|
132
|
+
return { type: "direct", result: txResult };
|
|
133
|
+
}
|
|
134
|
+
} catch (e) {
|
|
135
|
+
const error = e instanceof Error ? e : new Error("Unknown error during operation submission");
|
|
136
|
+
return { type: "error", error: error.message };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async function routeAndExecuteRequest(sdk, request, options) {
|
|
141
|
+
if (request.type === "signed") {
|
|
142
|
+
const { typedData, signature, expectedUserAddress } = request;
|
|
143
|
+
let recoveredAddress;
|
|
144
|
+
try {
|
|
145
|
+
recoveredAddress = await (0, import_viem.recoverTypedDataAddress)({
|
|
146
|
+
domain: {
|
|
147
|
+
...typedData.domain,
|
|
148
|
+
chainId: typedData.domain.chainId ? BigInt(typedData.domain.chainId) : void 0
|
|
149
|
+
},
|
|
150
|
+
types: typedData.types,
|
|
151
|
+
primaryType: typedData.primaryType,
|
|
152
|
+
message: typedData.message,
|
|
153
|
+
signature
|
|
154
|
+
});
|
|
155
|
+
} catch (error) {
|
|
156
|
+
throw new import_errors.SignatureError(
|
|
157
|
+
`Signature verification failed: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
if (expectedUserAddress) {
|
|
161
|
+
const normalizedExpected = (0, import_viem.getAddress)(expectedUserAddress);
|
|
162
|
+
const normalizedSigner = (0, import_viem.getAddress)(recoveredAddress);
|
|
163
|
+
if (normalizedSigner !== normalizedExpected) {
|
|
164
|
+
throw new import_errors.SignatureError(
|
|
165
|
+
`Security verification failed: Recovered signer address (${normalizedSigner}) does not match expected user address (${normalizedExpected})`
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return await routeSignedOperation(sdk, typedData, signature, options);
|
|
170
|
+
} else if (request.type === "direct") {
|
|
171
|
+
return await handleDirectOperation(sdk, request, options);
|
|
172
|
+
}
|
|
173
|
+
throw new Error("Invalid request type for execution");
|
|
174
|
+
}
|
|
175
|
+
async function routeSignedOperation(sdk, typedData, signature, options) {
|
|
176
|
+
const validPrimaryTypes = [
|
|
177
|
+
"Permission",
|
|
178
|
+
"RevokePermission",
|
|
179
|
+
"TrustServer",
|
|
180
|
+
"AddServer",
|
|
181
|
+
"UntrustServer",
|
|
182
|
+
"ServerFilesAndPermission"
|
|
183
|
+
];
|
|
184
|
+
if (!validPrimaryTypes.includes(typedData.primaryType)) {
|
|
185
|
+
throw new Error(
|
|
186
|
+
`Unsupported operation type: ${typedData.primaryType}. Supported types: ${validPrimaryTypes.join(", ")}`
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
const primaryType = typedData.primaryType;
|
|
190
|
+
switch (primaryType) {
|
|
191
|
+
case "Permission":
|
|
192
|
+
return sdk.permissions.submitSignedGrant(
|
|
193
|
+
{
|
|
194
|
+
...typedData,
|
|
195
|
+
primaryType: "Permission"
|
|
196
|
+
},
|
|
197
|
+
signature,
|
|
198
|
+
options
|
|
199
|
+
);
|
|
200
|
+
case "RevokePermission":
|
|
201
|
+
return sdk.permissions.submitSignedRevoke(
|
|
202
|
+
{
|
|
203
|
+
...typedData,
|
|
204
|
+
primaryType: "RevokePermission"
|
|
205
|
+
},
|
|
206
|
+
signature,
|
|
207
|
+
options
|
|
208
|
+
);
|
|
209
|
+
case "TrustServer":
|
|
210
|
+
return sdk.permissions.submitSignedTrustServer(
|
|
211
|
+
{
|
|
212
|
+
...typedData,
|
|
213
|
+
primaryType: "TrustServer"
|
|
214
|
+
},
|
|
215
|
+
signature,
|
|
216
|
+
options
|
|
217
|
+
);
|
|
218
|
+
case "AddServer":
|
|
219
|
+
return sdk.permissions.submitSignedAddAndTrustServer(
|
|
220
|
+
{
|
|
221
|
+
...typedData,
|
|
222
|
+
primaryType: "AddServer"
|
|
223
|
+
},
|
|
224
|
+
signature,
|
|
225
|
+
options
|
|
226
|
+
);
|
|
227
|
+
case "UntrustServer":
|
|
228
|
+
return sdk.permissions.submitSignedUntrustServer(
|
|
229
|
+
{
|
|
230
|
+
...typedData,
|
|
231
|
+
primaryType: "UntrustServer"
|
|
232
|
+
},
|
|
233
|
+
signature,
|
|
234
|
+
options
|
|
235
|
+
);
|
|
236
|
+
case "ServerFilesAndPermission":
|
|
237
|
+
return sdk.permissions.submitSignedAddServerFilesAndPermissions(
|
|
238
|
+
{
|
|
239
|
+
...typedData,
|
|
240
|
+
primaryType: "ServerFilesAndPermission"
|
|
241
|
+
},
|
|
242
|
+
signature,
|
|
243
|
+
options
|
|
244
|
+
);
|
|
245
|
+
// TODO: RegisterGrantee with signature is not supported until
|
|
246
|
+
// DataPortabilityGrantees contract adds registerGranteeWithSignature function
|
|
247
|
+
// case "RegisterGrantee":
|
|
248
|
+
// return sdk.permissions.submitSignedRegisterGrantee(...);
|
|
249
|
+
default:
|
|
250
|
+
throw new Error(
|
|
251
|
+
`Unsupported operation type: ${typedData.primaryType}. Supported types: Permission, RevokePermission, TrustServer, AddServer, UntrustServer, ServerFilesAndPermission`
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
async function handleDirectOperation(sdk, request, options) {
|
|
256
|
+
switch (request.operation) {
|
|
257
|
+
case "submitFileAddition": {
|
|
258
|
+
const { url, userAddress } = request.params;
|
|
259
|
+
const result = await sdk.data.addFileWithPermissions(
|
|
260
|
+
url,
|
|
261
|
+
userAddress,
|
|
262
|
+
[],
|
|
263
|
+
// No permissions
|
|
264
|
+
options
|
|
265
|
+
);
|
|
266
|
+
return result;
|
|
267
|
+
}
|
|
268
|
+
case "submitFileAdditionWithPermissions": {
|
|
269
|
+
const { url, userAddress, permissions } = request.params;
|
|
270
|
+
const result = await sdk.data.addFileWithPermissions(
|
|
271
|
+
url,
|
|
272
|
+
userAddress,
|
|
273
|
+
permissions,
|
|
274
|
+
options
|
|
275
|
+
);
|
|
276
|
+
return result;
|
|
277
|
+
}
|
|
278
|
+
case "submitFileAdditionComplete": {
|
|
279
|
+
const { url, userAddress, permissions, schemaId, ownerAddress } = request.params;
|
|
280
|
+
const txResult = await sdk.data.addFileWithEncryptedPermissionsAndSchema(
|
|
281
|
+
url,
|
|
282
|
+
ownerAddress ?? userAddress,
|
|
283
|
+
permissions,
|
|
284
|
+
// Already in correct format with encrypted 'key' field
|
|
285
|
+
schemaId,
|
|
286
|
+
options
|
|
287
|
+
);
|
|
288
|
+
const eventResult = await sdk.waitForTransactionEvents(txResult);
|
|
289
|
+
const fileAddedEvent = eventResult.expectedEvents?.FileAdded;
|
|
290
|
+
if (!fileAddedEvent || !fileAddedEvent.fileId) {
|
|
291
|
+
console.error("Event result:", eventResult);
|
|
292
|
+
throw new Error("FileAdded event not found in transaction");
|
|
293
|
+
}
|
|
294
|
+
const fileId = Number(fileAddedEvent.fileId);
|
|
295
|
+
return {
|
|
296
|
+
fileId,
|
|
297
|
+
transactionHash: txResult.hash
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
case "storeGrantFile": {
|
|
301
|
+
const grantFile = request.params;
|
|
302
|
+
const dataController = sdk.data;
|
|
303
|
+
const context = dataController.context;
|
|
304
|
+
if (!context?.storageManager) {
|
|
305
|
+
throw new Error(
|
|
306
|
+
"Storage configuration is required for storing grant files"
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
const blob = new Blob([JSON.stringify(grantFile)], {
|
|
310
|
+
type: "application/json"
|
|
311
|
+
});
|
|
312
|
+
const uploadResult = await context.storageManager.upload(
|
|
313
|
+
blob,
|
|
314
|
+
`grant-${Date.now()}.json`
|
|
315
|
+
);
|
|
316
|
+
return { url: uploadResult.url };
|
|
317
|
+
}
|
|
318
|
+
case "submitRegisterGrantee": {
|
|
319
|
+
const { owner, granteeAddress, publicKey } = request.params;
|
|
320
|
+
const result = await sdk.permissions.submitRegisterGrantee({
|
|
321
|
+
owner,
|
|
322
|
+
granteeAddress,
|
|
323
|
+
publicKey
|
|
324
|
+
});
|
|
325
|
+
return result;
|
|
326
|
+
}
|
|
327
|
+
default: {
|
|
328
|
+
const exhaustiveCheck = request;
|
|
329
|
+
return exhaustiveCheck;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
334
|
+
0 && (module.exports = {
|
|
335
|
+
handleRelayerOperation
|
|
336
|
+
});
|
|
337
|
+
//# sourceMappingURL=relayerHandler.cjs.map
|