@opendatalabs/vana-sdk 0.1.0-alpha.7e4db82 → 0.1.0-alpha.7ee7635
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 +98 -36
- package/dist/browser.cjs +29 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +2 -0
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +5 -0
- package/dist/browser.js.map +1 -0
- package/dist/chains/definitions.cjs +92 -0
- package/dist/chains/definitions.cjs.map +1 -0
- package/dist/chains/definitions.d.cts +53 -0
- package/dist/chains/definitions.d.ts +53 -0
- package/dist/chains/definitions.js +64 -0
- package/dist/chains/definitions.js.map +1 -0
- package/dist/chains/index.cjs +37 -0
- package/dist/chains/index.cjs.map +1 -0
- package/dist/chains/index.d.cts +2 -0
- package/dist/chains/index.d.ts +2 -0
- package/dist/chains/index.js +15 -0
- package/dist/chains/index.js.map +1 -0
- package/dist/chains.browser.cjs +6 -65
- package/dist/chains.browser.cjs.map +1 -1
- package/dist/chains.browser.d.cts +2 -53
- package/dist/chains.browser.d.ts +2 -53
- package/dist/chains.browser.js +7 -57
- package/dist/chains.browser.js.map +1 -1
- package/dist/chains.cjs +6 -65
- package/dist/chains.cjs.map +1 -1
- package/dist/chains.d.cts +1 -1
- package/dist/chains.d.ts +1 -1
- package/dist/chains.js +7 -57
- package/dist/chains.js.map +1 -1
- package/dist/chains.node.cjs +6 -65
- package/dist/chains.node.cjs.map +1 -1
- package/dist/chains.node.d.cts +1 -1
- package/dist/chains.node.d.ts +1 -1
- package/dist/chains.node.js +7 -57
- package/dist/chains.node.js.map +1 -1
- package/dist/config/addresses.cjs +325 -0
- package/dist/config/addresses.cjs.map +1 -0
- package/dist/config/addresses.d.cts +401 -0
- package/dist/config/addresses.d.ts +401 -0
- package/dist/config/addresses.js +295 -0
- package/dist/config/addresses.js.map +1 -0
- package/dist/config/chains.cjs +93 -0
- package/dist/config/chains.cjs.map +1 -0
- package/dist/config/chains.d.cts +85 -0
- package/dist/config/chains.d.ts +85 -0
- package/dist/config/chains.js +67 -0
- package/dist/config/chains.js.map +1 -0
- package/dist/config/features.cjs +52 -0
- package/dist/config/features.cjs.map +1 -0
- package/dist/config/features.d.cts +64 -0
- package/dist/config/features.d.ts +64 -0
- package/dist/config/features.js +28 -0
- package/dist/config/features.js.map +1 -0
- package/dist/contracts/contractController.cjs +126 -0
- package/dist/contracts/contractController.cjs.map +1 -0
- package/dist/contracts/contractController.d.cts +117 -0
- package/dist/contracts/contractController.d.ts +117 -0
- package/dist/contracts/contractController.js +103 -0
- package/dist/contracts/contractController.js.map +1 -0
- package/dist/controllers/data.cjs +2251 -0
- package/dist/controllers/data.cjs.map +1 -0
- package/dist/controllers/data.d.cts +915 -0
- package/dist/controllers/data.d.ts +915 -0
- package/dist/controllers/data.js +2234 -0
- package/dist/controllers/data.js.map +1 -0
- package/dist/controllers/permissions.cjs +3949 -0
- package/dist/controllers/permissions.cjs.map +1 -0
- package/dist/controllers/permissions.d.cts +1383 -0
- package/dist/controllers/permissions.d.ts +1383 -0
- package/dist/controllers/permissions.js +3925 -0
- package/dist/controllers/permissions.js.map +1 -0
- package/dist/controllers/protocol.cjs +179 -0
- package/dist/controllers/protocol.cjs.map +1 -0
- package/dist/controllers/protocol.d.cts +188 -0
- package/dist/controllers/protocol.d.ts +188 -0
- package/dist/controllers/protocol.js +162 -0
- package/dist/controllers/protocol.js.map +1 -0
- package/dist/controllers/schemas.cjs +606 -0
- package/dist/controllers/schemas.cjs.map +1 -0
- package/dist/controllers/schemas.d.cts +260 -0
- package/dist/controllers/schemas.d.ts +260 -0
- package/dist/controllers/schemas.js +582 -0
- package/dist/controllers/schemas.js.map +1 -0
- package/dist/controllers/server.cjs +427 -0
- package/dist/controllers/server.cjs.map +1 -0
- package/dist/controllers/server.d.cts +230 -0
- package/dist/controllers/server.d.ts +230 -0
- package/dist/controllers/server.js +408 -0
- package/dist/controllers/server.js.map +1 -0
- package/dist/core/apiClient.cjs +325 -0
- package/dist/core/apiClient.cjs.map +1 -0
- package/dist/core/apiClient.d.cts +165 -0
- package/dist/core/apiClient.d.ts +165 -0
- package/dist/core/apiClient.js +309 -0
- package/dist/core/apiClient.js.map +1 -0
- package/dist/core/client.cjs +70 -0
- package/dist/core/client.cjs.map +1 -0
- package/dist/core/client.d.cts +92 -0
- package/dist/core/client.d.ts +92 -0
- package/dist/core/client.js +47 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/generics.cjs +388 -0
- package/dist/core/generics.cjs.map +1 -0
- package/dist/core/generics.d.cts +120 -0
- package/dist/core/generics.d.ts +120 -0
- package/dist/core/generics.js +366 -0
- package/dist/core/generics.js.map +1 -0
- package/dist/core.cjs +658 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +493 -0
- package/dist/core.d.ts +493 -0
- package/dist/core.js +636 -0
- package/dist/core.js.map +1 -0
- package/dist/crypto/ecies/__tests__/test-vectors.cjs +102 -0
- package/dist/crypto/ecies/__tests__/test-vectors.cjs.map +1 -0
- package/dist/crypto/ecies/__tests__/test-vectors.d.cts +40 -0
- package/dist/crypto/ecies/__tests__/test-vectors.d.ts +40 -0
- package/dist/crypto/ecies/__tests__/test-vectors.js +77 -0
- package/dist/crypto/ecies/__tests__/test-vectors.js.map +1 -0
- package/dist/crypto/ecies/base.cjs +231 -0
- package/dist/crypto/ecies/base.cjs.map +1 -0
- package/dist/crypto/ecies/base.d.cts +143 -0
- package/dist/crypto/ecies/base.d.ts +143 -0
- package/dist/crypto/ecies/base.js +211 -0
- package/dist/crypto/ecies/base.js.map +1 -0
- package/dist/crypto/ecies/browser.cjs +164 -0
- package/dist/crypto/ecies/browser.cjs.map +1 -0
- package/dist/crypto/ecies/browser.d.cts +48 -0
- package/dist/crypto/ecies/browser.d.ts +48 -0
- package/dist/crypto/ecies/browser.js +130 -0
- package/dist/crypto/ecies/browser.js.map +1 -0
- package/dist/crypto/ecies/constants.cjs +131 -0
- package/dist/crypto/ecies/constants.cjs.map +1 -0
- package/dist/crypto/ecies/constants.d.cts +122 -0
- package/dist/crypto/ecies/constants.d.ts +122 -0
- package/dist/crypto/ecies/constants.js +101 -0
- package/dist/crypto/ecies/constants.js.map +1 -0
- package/dist/crypto/ecies/index.cjs +35 -0
- package/dist/crypto/ecies/index.cjs.map +1 -0
- package/dist/crypto/ecies/index.d.cts +1 -0
- package/dist/crypto/ecies/index.d.ts +1 -0
- package/dist/crypto/ecies/index.js +13 -0
- package/dist/crypto/ecies/index.js.map +1 -0
- package/dist/crypto/ecies/interface.cjs +88 -0
- package/dist/crypto/ecies/interface.cjs.map +1 -0
- package/dist/crypto/ecies/interface.d.cts +176 -0
- package/dist/crypto/ecies/interface.d.ts +176 -0
- package/dist/crypto/ecies/interface.js +61 -0
- package/dist/crypto/ecies/interface.js.map +1 -0
- package/dist/crypto/ecies/node.cjs +166 -0
- package/dist/crypto/ecies/node.cjs.map +1 -0
- package/dist/crypto/ecies/node.d.cts +50 -0
- package/dist/crypto/ecies/node.d.ts +50 -0
- package/dist/crypto/ecies/node.js +144 -0
- package/dist/crypto/ecies/node.js.map +1 -0
- package/dist/crypto/ecies/test-vectors/eccrypto-vectors.d.cts +76 -0
- package/dist/crypto/ecies/test-vectors/eccrypto-vectors.d.ts +76 -0
- package/dist/crypto/ecies/test-vectors/eccrypto-vectors.json +72 -0
- package/dist/crypto/ecies/utils.cjs +91 -0
- package/dist/crypto/ecies/utils.cjs.map +1 -0
- package/dist/crypto/ecies/utils.d.cts +67 -0
- package/dist/crypto/ecies/utils.d.ts +67 -0
- package/dist/crypto/ecies/utils.js +60 -0
- package/dist/crypto/ecies/utils.js.map +1 -0
- package/dist/crypto/services/WalletKeyEncryptionService.cjs +128 -0
- package/dist/crypto/services/WalletKeyEncryptionService.cjs.map +1 -0
- package/dist/crypto/services/WalletKeyEncryptionService.d.cts +92 -0
- package/dist/crypto/services/WalletKeyEncryptionService.d.ts +92 -0
- package/dist/crypto/services/WalletKeyEncryptionService.js +112 -0
- package/dist/crypto/services/WalletKeyEncryptionService.js.map +1 -0
- package/dist/diagnostics.cjs +37 -0
- package/dist/diagnostics.cjs.map +1 -0
- package/dist/diagnostics.d.cts +26 -0
- package/dist/diagnostics.d.ts +26 -0
- package/dist/diagnostics.js +13 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/errors.cjs +141 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +350 -0
- package/dist/errors.d.ts +350 -0
- package/dist/errors.js +108 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/abi/ComputeEngineImplementation.cjs +1313 -0
- package/dist/generated/abi/ComputeEngineImplementation.cjs.map +1 -0
- package/dist/generated/abi/ComputeEngineImplementation.d.cts +996 -0
- package/dist/generated/abi/ComputeEngineImplementation.d.ts +996 -0
- package/dist/generated/abi/ComputeEngineImplementation.js +1289 -0
- package/dist/generated/abi/ComputeEngineImplementation.js.map +1 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs +734 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.d.cts +545 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.d.ts +545 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.js +710 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/DATFactoryImplementation.cjs +882 -0
- package/dist/generated/abi/DATFactoryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DATFactoryImplementation.d.cts +661 -0
- package/dist/generated/abi/DATFactoryImplementation.d.ts +661 -0
- package/dist/generated/abi/DATFactoryImplementation.js +858 -0
- package/dist/generated/abi/DATFactoryImplementation.js.map +1 -0
- package/dist/generated/abi/DATImplementation.cjs +934 -0
- package/dist/generated/abi/DATImplementation.cjs.map +1 -0
- package/dist/generated/abi/DATImplementation.d.cts +693 -0
- package/dist/generated/abi/DATImplementation.d.ts +693 -0
- package/dist/generated/abi/DATImplementation.js +910 -0
- package/dist/generated/abi/DATImplementation.js.map +1 -0
- package/dist/generated/abi/DATPausableImplementation.cjs +1523 -0
- package/dist/generated/abi/DATPausableImplementation.cjs.map +1 -0
- package/dist/generated/abi/DATPausableImplementation.d.cts +1145 -0
- package/dist/generated/abi/DATPausableImplementation.d.ts +1145 -0
- package/dist/generated/abi/DATPausableImplementation.js +1499 -0
- package/dist/generated/abi/DATPausableImplementation.js.map +1 -0
- package/dist/generated/abi/DATVotesImplementation.cjs +1460 -0
- package/dist/generated/abi/DATVotesImplementation.cjs.map +1 -0
- package/dist/generated/abi/DATVotesImplementation.d.cts +1095 -0
- package/dist/generated/abi/DATVotesImplementation.d.ts +1095 -0
- package/dist/generated/abi/DATVotesImplementation.js +1436 -0
- package/dist/generated/abi/DATVotesImplementation.js.map +1 -0
- package/dist/generated/abi/DLPPerformanceImplementation.cjs +1160 -0
- package/dist/generated/abi/DLPPerformanceImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPPerformanceImplementation.d.cts +883 -0
- package/dist/generated/abi/DLPPerformanceImplementation.d.ts +883 -0
- package/dist/generated/abi/DLPPerformanceImplementation.js +1136 -0
- package/dist/generated/abi/DLPPerformanceImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRegistryImplementation.cjs +1469 -0
- package/dist/generated/abi/DLPRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRegistryImplementation.d.cts +1123 -0
- package/dist/generated/abi/DLPRegistryImplementation.d.ts +1123 -0
- package/dist/generated/abi/DLPRegistryImplementation.js +1445 -0
- package/dist/generated/abi/DLPRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.cjs +612 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.d.cts +452 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.d.ts +452 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.js +588 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.cjs +948 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.d.cts +714 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +714 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.js +924 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.cjs +612 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.d.cts +452 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.d.ts +452 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.js +588 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.cjs +939 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.d.cts +706 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.d.ts +706 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.js +915 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRootImplementation.cjs +1644 -0
- package/dist/generated/abi/DLPRootImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRootImplementation.d.cts +1248 -0
- package/dist/generated/abi/DLPRootImplementation.d.ts +1248 -0
- package/dist/generated/abi/DLPRootImplementation.js +1620 -0
- package/dist/generated/abi/DLPRootImplementation.js.map +1 -0
- package/dist/generated/abi/DLPTreasuryImplementation.cjs +612 -0
- package/dist/generated/abi/DLPTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPTreasuryImplementation.d.cts +452 -0
- package/dist/generated/abi/DLPTreasuryImplementation.d.ts +452 -0
- package/dist/generated/abi/DLPTreasuryImplementation.js +588 -0
- package/dist/generated/abi/DLPTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.cjs +985 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.d.cts +737 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +737 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.js +961 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.js.map +1 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs +888 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.d.cts +661 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.d.ts +661 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.js +864 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.js.map +1 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs +1317 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.cts +989 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.ts +989 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.js +1293 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.js.map +1 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.cjs +1438 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.d.cts +1086 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.d.ts +1086 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.js +1414 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.js.map +1 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.cjs +984 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.d.cts +737 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.d.ts +737 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.js +960 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/DataRegistryImplementation.cjs +1341 -0
- package/dist/generated/abi/DataRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataRegistryImplementation.d.cts +1014 -0
- package/dist/generated/abi/DataRegistryImplementation.d.ts +1014 -0
- package/dist/generated/abi/DataRegistryImplementation.js +1317 -0
- package/dist/generated/abi/DataRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/QueryEngineImplementation.cjs +1319 -0
- package/dist/generated/abi/QueryEngineImplementation.cjs.map +1 -0
- package/dist/generated/abi/QueryEngineImplementation.d.cts +1001 -0
- package/dist/generated/abi/QueryEngineImplementation.d.ts +1001 -0
- package/dist/generated/abi/QueryEngineImplementation.js +1295 -0
- package/dist/generated/abi/QueryEngineImplementation.js.map +1 -0
- package/dist/generated/abi/SwapHelperImplementation.cjs +1019 -0
- package/dist/generated/abi/SwapHelperImplementation.cjs.map +1 -0
- package/dist/generated/abi/SwapHelperImplementation.d.cts +764 -0
- package/dist/generated/abi/SwapHelperImplementation.d.ts +764 -0
- package/dist/generated/abi/SwapHelperImplementation.js +995 -0
- package/dist/generated/abi/SwapHelperImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.d.cts +701 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.d.ts +701 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.js +912 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.d.cts +701 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.d.ts +701 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.js +912 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.d.cts +701 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.d.ts +701 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.js +912 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolImplementation.cjs +1313 -0
- package/dist/generated/abi/TeePoolImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolImplementation.d.cts +993 -0
- package/dist/generated/abi/TeePoolImplementation.d.ts +993 -0
- package/dist/generated/abi/TeePoolImplementation.js +1289 -0
- package/dist/generated/abi/TeePoolImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.d.cts +701 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.d.ts +701 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.js +912 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.d.cts +701 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.d.ts +701 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.js +912 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.cjs +1313 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.d.cts +993 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.d.ts +993 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.js +1289 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.js.map +1 -0
- package/dist/generated/abi/VanaEpochImplementation.cjs +1188 -0
- package/dist/generated/abi/VanaEpochImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaEpochImplementation.d.cts +900 -0
- package/dist/generated/abi/VanaEpochImplementation.d.ts +900 -0
- package/dist/generated/abi/VanaEpochImplementation.js +1164 -0
- package/dist/generated/abi/VanaEpochImplementation.js.map +1 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.cjs +1234 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.d.cts +934 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.d.ts +934 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.js +1210 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.js.map +1 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.cjs +921 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.d.cts +693 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.d.ts +693 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.js +897 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.js.map +1 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.cjs +538 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.d.cts +394 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.d.ts +394 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.js +514 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/index.cjs +177 -0
- package/dist/generated/abi/index.cjs.map +1 -0
- package/dist/generated/abi/index.d.cts +26547 -0
- package/dist/generated/abi/index.d.ts +26547 -0
- package/dist/generated/abi/index.js +120 -0
- package/dist/generated/abi/index.js.map +1 -0
- package/dist/generated/event-types.cjs +17 -0
- package/dist/generated/event-types.cjs.map +1 -0
- package/dist/generated/event-types.d.cts +855 -0
- package/dist/generated/event-types.d.ts +855 -0
- package/dist/generated/event-types.js +1 -0
- package/dist/generated/event-types.js.map +1 -0
- package/dist/generated/eventRegistry.cjs +3351 -0
- package/dist/generated/eventRegistry.cjs.map +1 -0
- package/dist/generated/eventRegistry.d.cts +18 -0
- package/dist/generated/eventRegistry.d.ts +18 -0
- package/dist/generated/eventRegistry.js +3326 -0
- package/dist/generated/eventRegistry.js.map +1 -0
- package/dist/generated/server/server-exports.cjs +23 -0
- package/dist/generated/server/server-exports.cjs.map +1 -0
- package/dist/generated/server/server-exports.d.cts +21 -0
- package/dist/generated/server/server-exports.d.ts +21 -0
- package/dist/generated/server/server-exports.js +2 -0
- package/dist/generated/server/server-exports.js.map +1 -0
- package/dist/generated/server/server.cjs +17 -0
- package/dist/generated/server/server.cjs.map +1 -0
- package/dist/generated/server/server.d.cts +512 -0
- package/dist/generated/server/server.d.ts +512 -0
- package/dist/generated/server/server.js +1 -0
- package/dist/generated/server/server.js.map +1 -0
- package/dist/generated/subgraph.cjs +675 -0
- package/dist/generated/subgraph.cjs.map +1 -0
- package/dist/generated/subgraph.d.cts +5981 -0
- package/dist/generated/subgraph.d.ts +5981 -0
- package/dist/generated/subgraph.js +644 -0
- package/dist/generated/subgraph.js.map +1 -0
- package/dist/index.browser.cjs +151 -0
- package/dist/index.browser.cjs.map +1 -0
- package/dist/index.browser.d.cts +201 -0
- package/dist/index.browser.d.ts +162 -32452
- package/dist/index.browser.js +64 -40995
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.node.cjs +87 -41441
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.cts +86 -32596
- package/dist/index.node.d.ts +86 -32596
- package/dist/index.node.js +68 -41331
- package/dist/index.node.js.map +1 -1
- package/dist/node.cjs +29 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +2 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.js +5 -0
- package/dist/node.js.map +1 -0
- package/dist/platform/browser-only.cjs +37 -0
- package/dist/platform/browser-only.cjs.map +1 -0
- package/dist/platform/browser-only.d.cts +25 -0
- package/dist/platform/browser-only.d.ts +25 -0
- package/dist/platform/browser-only.js +12 -0
- package/dist/platform/browser-only.js.map +1 -0
- package/dist/platform/browser-safe.cjs +57 -0
- package/dist/platform/browser-safe.cjs.map +1 -0
- package/dist/platform/browser-safe.d.cts +32 -0
- package/dist/platform/browser-safe.d.ts +32 -0
- package/dist/platform/browser-safe.js +31 -0
- package/dist/platform/browser-safe.js.map +1 -0
- package/dist/platform/browser.cjs +329 -0
- package/dist/platform/browser.cjs.map +1 -0
- package/dist/platform/browser.d.cts +74 -0
- package/dist/platform/browser.d.ts +74 -0
- package/dist/platform/browser.js +304 -0
- package/dist/platform/browser.js.map +1 -0
- package/dist/platform/index.cjs +50 -0
- package/dist/platform/index.cjs.map +1 -0
- package/dist/platform/index.d.cts +5 -0
- package/dist/platform/index.d.ts +5 -0
- package/dist/platform/index.js +27 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/interface.cjs +17 -0
- package/dist/platform/interface.cjs.map +1 -0
- package/dist/platform/interface.d.cts +218 -0
- package/dist/platform/interface.d.ts +218 -0
- package/dist/platform/interface.js +1 -0
- package/dist/platform/interface.js.map +1 -0
- package/dist/platform/node.cjs +351 -0
- package/dist/platform/node.cjs.map +1 -0
- package/dist/platform/node.d.cts +27 -0
- package/dist/platform/node.d.ts +27 -0
- package/dist/platform/node.js +327 -0
- package/dist/platform/node.js.map +1 -0
- package/dist/platform/shared/error-utils.cjs +43 -0
- package/dist/platform/shared/error-utils.cjs.map +1 -0
- package/dist/platform/shared/error-utils.d.cts +25 -0
- package/dist/platform/shared/error-utils.d.ts +25 -0
- package/dist/platform/shared/error-utils.js +18 -0
- package/dist/platform/shared/error-utils.js.map +1 -0
- package/dist/platform/shared/pgp-utils.cjs +55 -0
- package/dist/platform/shared/pgp-utils.cjs.map +1 -0
- package/dist/platform/shared/pgp-utils.d.cts +61 -0
- package/dist/platform/shared/pgp-utils.d.ts +61 -0
- package/dist/platform/shared/pgp-utils.js +29 -0
- package/dist/platform/shared/pgp-utils.js.map +1 -0
- package/dist/platform/shared/stream-utils.cjs +49 -0
- package/dist/platform/shared/stream-utils.cjs.map +1 -0
- package/dist/platform/shared/stream-utils.d.cts +16 -0
- package/dist/platform/shared/stream-utils.d.ts +16 -0
- package/dist/platform/shared/stream-utils.js +25 -0
- package/dist/platform/shared/stream-utils.js.map +1 -0
- package/dist/platform/utils.cjs +114 -0
- package/dist/platform/utils.cjs.map +1 -0
- package/dist/platform/utils.d.cts +53 -0
- package/dist/platform/utils.d.ts +53 -0
- package/dist/platform/utils.js +76 -0
- package/dist/platform/utils.js.map +1 -0
- package/dist/platform.browser.cjs +41 -0
- package/dist/platform.browser.cjs.map +1 -0
- package/dist/platform.browser.d.cts +4 -0
- package/dist/platform.browser.d.ts +4 -224
- package/dist/platform.browser.js +10 -309
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.cjs +14 -623
- package/dist/platform.cjs.map +1 -1
- package/dist/platform.d.cts +5 -1
- package/dist/platform.d.ts +5 -1
- package/dist/platform.js +14 -609
- package/dist/platform.js.map +1 -1
- package/dist/platform.node.cjs +14 -623
- package/dist/platform.node.cjs.map +1 -1
- package/dist/platform.node.d.cts +5 -264
- package/dist/platform.node.d.ts +5 -264
- package/dist/platform.node.js +14 -609
- package/dist/platform.node.js.map +1 -1
- package/dist/schemas/dataSchema.schema.d.cts +88 -0
- package/dist/schemas/dataSchema.schema.d.ts +88 -0
- package/dist/schemas/dataSchema.schema.json +53 -0
- package/dist/schemas/grantFile.schema.d.cts +57 -0
- package/dist/schemas/grantFile.schema.d.ts +57 -0
- package/dist/schemas/grantFile.schema.json +43 -0
- package/dist/server/handler.cjs +101 -0
- package/dist/server/handler.cjs.map +1 -0
- package/dist/server/handler.d.cts +306 -0
- package/dist/server/handler.d.ts +306 -0
- package/dist/server/handler.js +77 -0
- package/dist/server/handler.js.map +1 -0
- package/dist/storage/index.cjs +44 -0
- package/dist/storage/index.cjs.map +1 -0
- package/dist/storage/index.d.cts +10 -0
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.js +15 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/manager.cjs +189 -0
- package/dist/storage/manager.cjs.map +1 -0
- package/dist/storage/manager.d.cts +150 -0
- package/dist/storage/manager.d.ts +150 -0
- package/dist/storage/manager.js +172 -0
- package/dist/storage/manager.js.map +1 -0
- package/dist/storage/providers/callback-storage.cjs +177 -0
- package/dist/storage/providers/callback-storage.cjs.map +1 -0
- package/dist/storage/providers/callback-storage.d.cts +100 -0
- package/dist/storage/providers/callback-storage.d.ts +100 -0
- package/dist/storage/providers/callback-storage.js +155 -0
- package/dist/storage/providers/callback-storage.js.map +1 -0
- package/dist/storage/providers/google-drive.cjs +516 -0
- package/dist/storage/providers/google-drive.cjs.map +1 -0
- package/dist/storage/providers/google-drive.d.cts +156 -0
- package/dist/storage/providers/google-drive.d.ts +156 -0
- package/dist/storage/providers/google-drive.js +497 -0
- package/dist/storage/providers/google-drive.js.map +1 -0
- package/dist/storage/providers/ipfs.cjs +283 -0
- package/dist/storage/providers/ipfs.cjs.map +1 -0
- package/dist/storage/providers/ipfs.d.cts +163 -0
- package/dist/storage/providers/ipfs.d.ts +163 -0
- package/dist/storage/providers/ipfs.js +264 -0
- package/dist/storage/providers/ipfs.js.map +1 -0
- package/dist/storage/providers/pinata.cjs +339 -0
- package/dist/storage/providers/pinata.cjs.map +1 -0
- package/dist/storage/providers/pinata.d.cts +173 -0
- package/dist/storage/providers/pinata.d.ts +173 -0
- package/dist/storage/providers/pinata.js +320 -0
- package/dist/storage/providers/pinata.js.map +1 -0
- package/dist/types/blockchain.cjs +17 -0
- package/dist/types/blockchain.cjs.map +1 -0
- package/dist/types/blockchain.d.cts +52 -0
- package/dist/types/blockchain.d.ts +52 -0
- package/dist/types/blockchain.js +1 -0
- package/dist/types/blockchain.js.map +1 -0
- package/dist/types/chains.cjs +36 -0
- package/dist/types/chains.cjs.map +1 -0
- package/dist/types/chains.d.cts +34 -0
- package/dist/types/chains.d.ts +34 -0
- package/dist/types/chains.js +11 -0
- package/dist/types/chains.js.map +1 -0
- package/dist/types/config.cjs +41 -0
- package/dist/types/config.cjs.map +1 -0
- package/dist/types/config.d.cts +726 -0
- package/dist/types/config.d.ts +726 -0
- package/dist/types/config.js +15 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/contracts.cjs +17 -0
- package/dist/types/contracts.cjs.map +1 -0
- package/dist/types/contracts.d.cts +68 -0
- package/dist/types/contracts.d.ts +68 -0
- package/dist/types/contracts.js +1 -0
- package/dist/types/contracts.js.map +1 -0
- package/dist/types/controller-context.cjs +17 -0
- package/dist/types/controller-context.cjs.map +1 -0
- package/dist/types/controller-context.d.cts +71 -0
- package/dist/types/controller-context.d.ts +71 -0
- package/dist/types/controller-context.js +1 -0
- package/dist/types/controller-context.js.map +1 -0
- package/dist/types/data.cjs +17 -0
- package/dist/types/data.cjs.map +1 -0
- package/dist/types/data.d.cts +694 -0
- package/dist/types/data.d.ts +694 -0
- package/dist/types/data.js +1 -0
- package/dist/types/data.js.map +1 -0
- package/dist/types/eccrypto-js.d.cjs +2 -0
- package/dist/types/eccrypto-js.d.cjs.map +1 -0
- package/dist/types/eccrypto-js.d.d.cts +13 -0
- package/dist/types/eccrypto-js.d.d.ts +13 -0
- package/dist/types/eccrypto-js.d.js +1 -0
- package/dist/types/eccrypto-js.d.js.map +1 -0
- package/dist/types/external-apis.cjs +61 -0
- package/dist/types/external-apis.cjs.map +1 -0
- package/dist/types/external-apis.d.cts +186 -0
- package/dist/types/external-apis.d.ts +186 -0
- package/dist/types/external-apis.js +34 -0
- package/dist/types/external-apis.js.map +1 -0
- package/dist/types/generics.cjs +17 -0
- package/dist/types/generics.cjs.map +1 -0
- package/dist/types/generics.d.cts +450 -0
- package/dist/types/generics.d.ts +450 -0
- package/dist/types/generics.js +1 -0
- package/dist/types/generics.js.map +1 -0
- package/dist/types/index.cjs +64 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +22 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.js +35 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/operations.cjs +65 -0
- package/dist/types/operations.cjs.map +1 -0
- package/dist/types/operations.d.cts +116 -0
- package/dist/types/operations.d.ts +116 -0
- package/dist/types/operations.js +37 -0
- package/dist/types/operations.js.map +1 -0
- package/dist/types/permissions.cjs +17 -0
- package/dist/types/permissions.cjs.map +1 -0
- package/dist/types/permissions.d.cts +957 -0
- package/dist/types/permissions.d.ts +957 -0
- package/dist/types/permissions.js +1 -0
- package/dist/types/permissions.js.map +1 -0
- package/dist/types/personal.cjs +17 -0
- package/dist/types/personal.cjs.map +1 -0
- package/dist/types/personal.d.cts +40 -0
- package/dist/types/personal.d.ts +40 -0
- package/dist/types/personal.js +1 -0
- package/dist/types/personal.js.map +1 -0
- package/dist/types/relayer.cjs +17 -0
- package/dist/types/relayer.cjs.map +1 -0
- package/dist/types/relayer.d.cts +284 -0
- package/dist/types/relayer.d.ts +284 -0
- package/dist/types/relayer.js +1 -0
- package/dist/types/relayer.js.map +1 -0
- package/dist/types/storage.cjs +39 -0
- package/dist/types/storage.cjs.map +1 -0
- package/dist/types/storage.d.cts +131 -0
- package/dist/types/storage.d.ts +131 -0
- package/dist/types/storage.js +18 -0
- package/dist/types/storage.js.map +1 -0
- package/dist/types/transactionResults.cjs +17 -0
- package/dist/types/transactionResults.cjs.map +1 -0
- package/dist/types/transactionResults.d.cts +195 -0
- package/dist/types/transactionResults.d.ts +195 -0
- package/dist/types/transactionResults.js +1 -0
- package/dist/types/transactionResults.js.map +1 -0
- package/dist/types/utils.cjs +17 -0
- package/dist/types/utils.cjs.map +1 -0
- package/dist/types/utils.d.cts +819 -0
- package/dist/types/utils.d.ts +819 -0
- package/dist/types/utils.js +1 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/types.cjs +23 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +54 -0
- package/dist/types.d.ts +54 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/blockchain/registry.cjs +81 -0
- package/dist/utils/blockchain/registry.cjs.map +1 -0
- package/dist/utils/blockchain/registry.d.cts +34 -0
- package/dist/utils/blockchain/registry.d.ts +34 -0
- package/dist/utils/blockchain/registry.js +56 -0
- package/dist/utils/blockchain/registry.js.map +1 -0
- package/dist/utils/crypto-utils.cjs +120 -0
- package/dist/utils/crypto-utils.cjs.map +1 -0
- package/dist/utils/crypto-utils.d.cts +118 -0
- package/dist/utils/crypto-utils.d.ts +118 -0
- package/dist/utils/crypto-utils.js +87 -0
- package/dist/utils/crypto-utils.js.map +1 -0
- package/dist/utils/download.cjs +69 -0
- package/dist/utils/download.cjs.map +1 -0
- package/dist/utils/download.d.cts +41 -0
- package/dist/utils/download.d.ts +41 -0
- package/dist/utils/download.js +45 -0
- package/dist/utils/download.js.map +1 -0
- package/dist/utils/encoding.cjs +66 -0
- package/dist/utils/encoding.cjs.map +1 -0
- package/dist/utils/encoding.d.cts +54 -0
- package/dist/utils/encoding.d.ts +54 -0
- package/dist/utils/encoding.js +39 -0
- package/dist/utils/encoding.js.map +1 -0
- package/dist/utils/encryption.cjs +170 -0
- package/dist/utils/encryption.cjs.map +1 -0
- package/dist/utils/encryption.d.cts +275 -0
- package/dist/utils/encryption.d.ts +275 -0
- package/dist/utils/encryption.js +136 -0
- package/dist/utils/encryption.js.map +1 -0
- package/dist/utils/formatters.cjs +53 -0
- package/dist/utils/formatters.cjs.map +1 -0
- package/dist/utils/formatters.d.cts +120 -0
- package/dist/utils/formatters.d.ts +120 -0
- package/dist/utils/formatters.js +26 -0
- package/dist/utils/formatters.js.map +1 -0
- package/dist/utils/grantFiles.cjs +175 -0
- package/dist/utils/grantFiles.cjs.map +1 -0
- package/dist/utils/grantFiles.d.cts +186 -0
- package/dist/utils/grantFiles.d.ts +186 -0
- package/dist/utils/grantFiles.js +137 -0
- package/dist/utils/grantFiles.js.map +1 -0
- package/dist/utils/grantValidation.cjs +243 -0
- package/dist/utils/grantValidation.cjs.map +1 -0
- package/dist/utils/grantValidation.d.cts +150 -0
- package/dist/utils/grantValidation.d.ts +150 -0
- package/dist/utils/grantValidation.js +201 -0
- package/dist/utils/grantValidation.js.map +1 -0
- package/dist/utils/grants.cjs +108 -0
- package/dist/utils/grants.cjs.map +1 -0
- package/dist/utils/grants.d.cts +70 -0
- package/dist/utils/grants.d.ts +70 -0
- package/dist/utils/grants.js +82 -0
- package/dist/utils/grants.js.map +1 -0
- package/dist/utils/ipfs.cjs +130 -0
- package/dist/utils/ipfs.cjs.map +1 -0
- package/dist/utils/ipfs.d.cts +90 -0
- package/dist/utils/ipfs.d.ts +90 -0
- package/dist/utils/ipfs.js +99 -0
- package/dist/utils/ipfs.js.map +1 -0
- package/dist/utils/lazy-import.cjs +40 -0
- package/dist/utils/lazy-import.cjs.map +1 -0
- package/dist/utils/lazy-import.d.cts +20 -0
- package/dist/utils/lazy-import.d.ts +20 -0
- package/dist/utils/lazy-import.js +16 -0
- package/dist/utils/lazy-import.js.map +1 -0
- package/dist/utils/multicall.cjs +231 -0
- package/dist/utils/multicall.cjs.map +1 -0
- package/dist/utils/multicall.d.cts +129 -0
- package/dist/utils/multicall.d.ts +129 -0
- package/dist/utils/multicall.js +206 -0
- package/dist/utils/multicall.js.map +1 -0
- package/dist/utils/parseTransactionPojo.cjs +87 -0
- package/dist/utils/parseTransactionPojo.cjs.map +1 -0
- package/dist/utils/parseTransactionPojo.d.cts +37 -0
- package/dist/utils/parseTransactionPojo.d.ts +37 -0
- package/dist/utils/parseTransactionPojo.js +63 -0
- package/dist/utils/parseTransactionPojo.js.map +1 -0
- package/dist/utils/schemaValidation.cjs +258 -0
- package/dist/utils/schemaValidation.cjs.map +1 -0
- package/dist/utils/schemaValidation.d.cts +172 -0
- package/dist/utils/schemaValidation.d.ts +172 -0
- package/dist/utils/schemaValidation.js +222 -0
- package/dist/utils/schemaValidation.js.map +1 -0
- package/dist/utils/signatureCache.cjs +187 -0
- package/dist/utils/signatureCache.cjs.map +1 -0
- package/dist/utils/signatureCache.d.cts +134 -0
- package/dist/utils/signatureCache.d.ts +134 -0
- package/dist/utils/signatureCache.js +165 -0
- package/dist/utils/signatureCache.js.map +1 -0
- package/dist/utils/signatureFormatter.cjs +45 -0
- package/dist/utils/signatureFormatter.cjs.map +1 -0
- package/dist/utils/signatureFormatter.d.cts +39 -0
- package/dist/utils/signatureFormatter.d.ts +39 -0
- package/dist/utils/signatureFormatter.js +21 -0
- package/dist/utils/signatureFormatter.js.map +1 -0
- package/dist/utils/transactionHelpers.cjs +54 -0
- package/dist/utils/transactionHelpers.cjs.map +1 -0
- package/dist/utils/transactionHelpers.d.cts +86 -0
- package/dist/utils/transactionHelpers.d.ts +86 -0
- package/dist/utils/transactionHelpers.js +29 -0
- package/dist/utils/transactionHelpers.js.map +1 -0
- package/dist/utils/typedDataConverter.cjs +43 -0
- package/dist/utils/typedDataConverter.cjs.map +1 -0
- package/dist/utils/typedDataConverter.d.cts +13 -0
- package/dist/utils/typedDataConverter.d.ts +13 -0
- package/dist/utils/typedDataConverter.js +19 -0
- package/dist/utils/typedDataConverter.js.map +1 -0
- package/dist/utils/urlResolver.cjs +55 -0
- package/dist/utils/urlResolver.cjs.map +1 -0
- package/dist/utils/urlResolver.d.cts +40 -0
- package/dist/utils/urlResolver.d.ts +40 -0
- package/dist/utils/urlResolver.js +30 -0
- package/dist/utils/urlResolver.js.map +1 -0
- package/dist/utils/withEvents.cjs +44 -0
- package/dist/utils/withEvents.cjs.map +1 -0
- package/dist/utils/withEvents.d.cts +63 -0
- package/dist/utils/withEvents.d.ts +63 -0
- package/dist/utils/withEvents.js +18 -0
- package/dist/utils/withEvents.js.map +1 -0
- package/package.json +58 -27
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Hash } from 'viem';
|
|
2
|
+
import { VanaCacheAdapter } from '../platform/interface.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Simple signature cache using platform cache adapter to avoid repeated signing of identical messages.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This cache significantly improves UX by avoiding repeated wallet signature prompts
|
|
9
|
+
* for identical operations. It's particularly useful for operations that may be
|
|
10
|
+
* retried or called multiple times with the same parameters.
|
|
11
|
+
*
|
|
12
|
+
* Features:
|
|
13
|
+
* - Platform-appropriate storage (sessionStorage in browser, memory in Node.js)
|
|
14
|
+
* - Configurable TTL (default 2 hours)
|
|
15
|
+
* - Automatic cleanup of expired entries
|
|
16
|
+
* - Cache keys based on wallet address + message hash
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Check cache before requesting signature
|
|
21
|
+
* const cached = SignatureCache.get(cache, walletAddress, messageHash);
|
|
22
|
+
* if (cached) {
|
|
23
|
+
* return cached;
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* // Request signature and cache it
|
|
27
|
+
* const signature = await wallet.signTypedData(typedData);
|
|
28
|
+
* SignatureCache.set(cache, walletAddress, messageHash, signature);
|
|
29
|
+
* ```
|
|
30
|
+
* @category Utilities
|
|
31
|
+
*/
|
|
32
|
+
declare class SignatureCache {
|
|
33
|
+
private static readonly PREFIX;
|
|
34
|
+
private static readonly DEFAULT_TTL_HOURS;
|
|
35
|
+
/**
|
|
36
|
+
* Get a cached signature if it exists and hasn't expired
|
|
37
|
+
*
|
|
38
|
+
* @param cache - Platform cache adapter instance
|
|
39
|
+
* @param walletAddress - Wallet address that created the signature
|
|
40
|
+
* @param messageHash - Hash of the message that was signed
|
|
41
|
+
* @returns The cached signature if valid, null if expired or not found
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const messageHash = SignatureCache.hashMessage(typedData);
|
|
45
|
+
* const cached = SignatureCache.get(cache, '0x123...', messageHash);
|
|
46
|
+
* if (cached) {
|
|
47
|
+
* console.log('Using cached signature:', cached);
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
static get(cache: VanaCacheAdapter, walletAddress: string, messageHash: string): Hash | null;
|
|
52
|
+
/**
|
|
53
|
+
* Store a signature in the cache with configurable TTL
|
|
54
|
+
*
|
|
55
|
+
* @param cache - Platform cache adapter instance
|
|
56
|
+
* @param walletAddress - Wallet address that created the signature
|
|
57
|
+
* @param messageHash - Hash of the message that was signed
|
|
58
|
+
* @param signature - The signature to cache
|
|
59
|
+
* @param ttlHours - Time to live in hours (default: 2)
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const signature = await wallet.signTypedData(typedData);
|
|
63
|
+
* const messageHash = SignatureCache.hashMessage(typedData);
|
|
64
|
+
*
|
|
65
|
+
* // Cache for default 2 hours
|
|
66
|
+
* SignatureCache.set(cache, walletAddress, messageHash, signature);
|
|
67
|
+
*
|
|
68
|
+
* // Cache for 24 hours
|
|
69
|
+
* SignatureCache.set(cache, walletAddress, messageHash, signature, 24);
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
static set(cache: VanaCacheAdapter, walletAddress: string, messageHash: string, signature: Hash, ttlHours?: number): void;
|
|
73
|
+
/**
|
|
74
|
+
* Clear all cached signatures (useful for testing or explicit cleanup)
|
|
75
|
+
*
|
|
76
|
+
* @param cache - Platform cache adapter instance
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* // Clear all signatures when user logs out
|
|
80
|
+
* SignatureCache.clear(cache);
|
|
81
|
+
*
|
|
82
|
+
* // Clear before running tests
|
|
83
|
+
* beforeEach(() => {
|
|
84
|
+
* SignatureCache.clear(cache);
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
static clear(cache: VanaCacheAdapter): void;
|
|
89
|
+
private static getCacheKey;
|
|
90
|
+
/**
|
|
91
|
+
* Generate a deterministic hash of a message object for cache key generation
|
|
92
|
+
*
|
|
93
|
+
* @remarks
|
|
94
|
+
* Creates a cryptographically secure hash from complex objects including EIP-712 typed data.
|
|
95
|
+
* Uses SHA-256 for collision resistance and deterministic key generation.
|
|
96
|
+
* Handles BigInt serialization and sorts object keys for consistency.
|
|
97
|
+
*
|
|
98
|
+
* @param message - The message object to hash (typically EIP-712 typed data)
|
|
99
|
+
* @returns A hex string hash (SHA-256) suitable for cache keys
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const typedData = {
|
|
103
|
+
* domain: { name: 'Vana', version: '1' },
|
|
104
|
+
* message: { nonce: 123n, grant: '...' }
|
|
105
|
+
* };
|
|
106
|
+
*
|
|
107
|
+
* const hash = SignatureCache.hashMessage(typedData);
|
|
108
|
+
* // Returns SHA-256 hash like: "a1b2c3d4e5f6..."
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
static hashMessage(message: object): string;
|
|
112
|
+
/**
|
|
113
|
+
* Deterministic JSON replacer that handles BigInt values and sorts object keys
|
|
114
|
+
* This ensures consistent cache key generation for EIP-712 typed data
|
|
115
|
+
*
|
|
116
|
+
* @param _key - The object key being serialized (unused)
|
|
117
|
+
* @param value - The value to serialize
|
|
118
|
+
* @returns The serialized value with sorted keys for objects
|
|
119
|
+
*/
|
|
120
|
+
private static deterministicReplacer;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Wrapper function to cache signature operations
|
|
124
|
+
*
|
|
125
|
+
* @param cache - The cache adapter to use for storage
|
|
126
|
+
* @param walletAddress - The wallet address signing the message
|
|
127
|
+
* @param typedData - The EIP-712 typed data being signed
|
|
128
|
+
* @param signFn - Function that performs the actual signing
|
|
129
|
+
* @param ttlHours - Cache TTL in hours (default 2)
|
|
130
|
+
* @returns The signature (cached or newly generated)
|
|
131
|
+
*/
|
|
132
|
+
declare function withSignatureCache(cache: VanaCacheAdapter, walletAddress: string, typedData: Record<string, unknown>, signFn: () => Promise<Hash>, ttlHours?: number): Promise<Hash>;
|
|
133
|
+
|
|
134
|
+
export { SignatureCache, withSignatureCache };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { getAddress } from "viem";
|
|
5
|
+
import { sha256 } from "@noble/hashes/sha256";
|
|
6
|
+
import { bytesToHex } from "@noble/hashes/utils";
|
|
7
|
+
class SignatureCache {
|
|
8
|
+
/**
|
|
9
|
+
* Get a cached signature if it exists and hasn't expired
|
|
10
|
+
*
|
|
11
|
+
* @param cache - Platform cache adapter instance
|
|
12
|
+
* @param walletAddress - Wallet address that created the signature
|
|
13
|
+
* @param messageHash - Hash of the message that was signed
|
|
14
|
+
* @returns The cached signature if valid, null if expired or not found
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const messageHash = SignatureCache.hashMessage(typedData);
|
|
18
|
+
* const cached = SignatureCache.get(cache, '0x123...', messageHash);
|
|
19
|
+
* if (cached) {
|
|
20
|
+
* console.log('Using cached signature:', cached);
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
static get(cache, walletAddress, messageHash) {
|
|
25
|
+
const key = this.getCacheKey(walletAddress, messageHash);
|
|
26
|
+
try {
|
|
27
|
+
const stored = cache.get(key);
|
|
28
|
+
if (!stored) return null;
|
|
29
|
+
const cached = JSON.parse(stored);
|
|
30
|
+
if (Date.now() > cached.expires) {
|
|
31
|
+
cache.delete(key);
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return cached.signature;
|
|
35
|
+
} catch {
|
|
36
|
+
try {
|
|
37
|
+
cache.delete(key);
|
|
38
|
+
} catch {
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Store a signature in the cache with configurable TTL
|
|
45
|
+
*
|
|
46
|
+
* @param cache - Platform cache adapter instance
|
|
47
|
+
* @param walletAddress - Wallet address that created the signature
|
|
48
|
+
* @param messageHash - Hash of the message that was signed
|
|
49
|
+
* @param signature - The signature to cache
|
|
50
|
+
* @param ttlHours - Time to live in hours (default: 2)
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const signature = await wallet.signTypedData(typedData);
|
|
54
|
+
* const messageHash = SignatureCache.hashMessage(typedData);
|
|
55
|
+
*
|
|
56
|
+
* // Cache for default 2 hours
|
|
57
|
+
* SignatureCache.set(cache, walletAddress, messageHash, signature);
|
|
58
|
+
*
|
|
59
|
+
* // Cache for 24 hours
|
|
60
|
+
* SignatureCache.set(cache, walletAddress, messageHash, signature, 24);
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
static set(cache, walletAddress, messageHash, signature, ttlHours = this.DEFAULT_TTL_HOURS) {
|
|
64
|
+
const key = this.getCacheKey(walletAddress, messageHash);
|
|
65
|
+
const cached = {
|
|
66
|
+
signature,
|
|
67
|
+
expires: Date.now() + ttlHours * 36e5
|
|
68
|
+
// Convert hours to milliseconds
|
|
69
|
+
};
|
|
70
|
+
try {
|
|
71
|
+
cache.set(key, JSON.stringify(cached));
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Clear all cached signatures (useful for testing or explicit cleanup)
|
|
77
|
+
*
|
|
78
|
+
* @param cache - Platform cache adapter instance
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* // Clear all signatures when user logs out
|
|
82
|
+
* SignatureCache.clear(cache);
|
|
83
|
+
*
|
|
84
|
+
* // Clear before running tests
|
|
85
|
+
* beforeEach(() => {
|
|
86
|
+
* SignatureCache.clear(cache);
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
static clear(cache) {
|
|
91
|
+
try {
|
|
92
|
+
cache.clear();
|
|
93
|
+
} catch {
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
static getCacheKey(walletAddress, messageHash) {
|
|
97
|
+
return `${this.PREFIX}${getAddress(walletAddress)}:${messageHash}`;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Generate a deterministic hash of a message object for cache key generation
|
|
101
|
+
*
|
|
102
|
+
* @remarks
|
|
103
|
+
* Creates a cryptographically secure hash from complex objects including EIP-712 typed data.
|
|
104
|
+
* Uses SHA-256 for collision resistance and deterministic key generation.
|
|
105
|
+
* Handles BigInt serialization and sorts object keys for consistency.
|
|
106
|
+
*
|
|
107
|
+
* @param message - The message object to hash (typically EIP-712 typed data)
|
|
108
|
+
* @returns A hex string hash (SHA-256) suitable for cache keys
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const typedData = {
|
|
112
|
+
* domain: { name: 'Vana', version: '1' },
|
|
113
|
+
* message: { nonce: 123n, grant: '...' }
|
|
114
|
+
* };
|
|
115
|
+
*
|
|
116
|
+
* const hash = SignatureCache.hashMessage(typedData);
|
|
117
|
+
* // Returns SHA-256 hash like: "a1b2c3d4e5f6..."
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
static hashMessage(message) {
|
|
121
|
+
const jsonString = JSON.stringify(message, this.deterministicReplacer);
|
|
122
|
+
const hashBytes = sha256(new TextEncoder().encode(jsonString));
|
|
123
|
+
return bytesToHex(hashBytes);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Deterministic JSON replacer that handles BigInt values and sorts object keys
|
|
127
|
+
* This ensures consistent cache key generation for EIP-712 typed data
|
|
128
|
+
*
|
|
129
|
+
* @param _key - The object key being serialized (unused)
|
|
130
|
+
* @param value - The value to serialize
|
|
131
|
+
* @returns The serialized value with sorted keys for objects
|
|
132
|
+
*/
|
|
133
|
+
static deterministicReplacer(_key, value) {
|
|
134
|
+
if (typeof value === "bigint") {
|
|
135
|
+
return `__BIGINT__${value.toString()}`;
|
|
136
|
+
}
|
|
137
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
138
|
+
return Object.keys(value).sort().reduce(
|
|
139
|
+
(sorted, key) => {
|
|
140
|
+
sorted[key] = value[key];
|
|
141
|
+
return sorted;
|
|
142
|
+
},
|
|
143
|
+
{}
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
return value;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
__publicField(SignatureCache, "PREFIX", "vana_sig_");
|
|
150
|
+
__publicField(SignatureCache, "DEFAULT_TTL_HOURS", 2);
|
|
151
|
+
async function withSignatureCache(cache, walletAddress, typedData, signFn, ttlHours) {
|
|
152
|
+
const messageHash = SignatureCache.hashMessage(typedData);
|
|
153
|
+
const cached = SignatureCache.get(cache, walletAddress, messageHash);
|
|
154
|
+
if (cached) {
|
|
155
|
+
return cached;
|
|
156
|
+
}
|
|
157
|
+
const signature = await signFn();
|
|
158
|
+
SignatureCache.set(cache, walletAddress, messageHash, signature, ttlHours);
|
|
159
|
+
return signature;
|
|
160
|
+
}
|
|
161
|
+
export {
|
|
162
|
+
SignatureCache,
|
|
163
|
+
withSignatureCache
|
|
164
|
+
};
|
|
165
|
+
//# sourceMappingURL=signatureCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/signatureCache.ts"],"sourcesContent":["import { Hash, getAddress } from \"viem\";\nimport type { VanaCacheAdapter } from \"../platform/interface\";\nimport { sha256 } from \"@noble/hashes/sha256\";\nimport { bytesToHex } from \"@noble/hashes/utils\";\n\ninterface CachedSignature {\n signature: Hash;\n expires: number;\n}\n\n/**\n * Simple signature cache using platform cache adapter to avoid repeated signing of identical messages.\n *\n * @remarks\n * This cache significantly improves UX by avoiding repeated wallet signature prompts\n * for identical operations. It's particularly useful for operations that may be\n * retried or called multiple times with the same parameters.\n *\n * Features:\n * - Platform-appropriate storage (sessionStorage in browser, memory in Node.js)\n * - Configurable TTL (default 2 hours)\n * - Automatic cleanup of expired entries\n * - Cache keys based on wallet address + message hash\n *\n * @example\n * ```typescript\n * // Check cache before requesting signature\n * const cached = SignatureCache.get(cache, walletAddress, messageHash);\n * if (cached) {\n * return cached;\n * }\n *\n * // Request signature and cache it\n * const signature = await wallet.signTypedData(typedData);\n * SignatureCache.set(cache, walletAddress, messageHash, signature);\n * ```\n * @category Utilities\n */\nexport class SignatureCache {\n private static readonly PREFIX = \"vana_sig_\";\n private static readonly DEFAULT_TTL_HOURS = 2;\n\n /**\n * Get a cached signature if it exists and hasn't expired\n *\n * @param cache - Platform cache adapter instance\n * @param walletAddress - Wallet address that created the signature\n * @param messageHash - Hash of the message that was signed\n * @returns The cached signature if valid, null if expired or not found\n * @example\n * ```typescript\n * const messageHash = SignatureCache.hashMessage(typedData);\n * const cached = SignatureCache.get(cache, '0x123...', messageHash);\n * if (cached) {\n * console.log('Using cached signature:', cached);\n * }\n * ```\n */\n static get(\n cache: VanaCacheAdapter,\n walletAddress: string,\n messageHash: string,\n ): Hash | null {\n const key = this.getCacheKey(walletAddress, messageHash);\n\n try {\n const stored = cache.get(key);\n if (!stored) return null;\n\n const cached: CachedSignature = JSON.parse(stored);\n\n // Check if expired\n if (Date.now() > cached.expires) {\n cache.delete(key);\n return null;\n }\n\n return cached.signature;\n } catch {\n // Invalid JSON or storage error, clean up\n try {\n cache.delete(key);\n } catch {\n // Ignore cache cleanup errors\n }\n return null;\n }\n }\n\n /**\n * Store a signature in the cache with configurable TTL\n *\n * @param cache - Platform cache adapter instance\n * @param walletAddress - Wallet address that created the signature\n * @param messageHash - Hash of the message that was signed\n * @param signature - The signature to cache\n * @param ttlHours - Time to live in hours (default: 2)\n * @example\n * ```typescript\n * const signature = await wallet.signTypedData(typedData);\n * const messageHash = SignatureCache.hashMessage(typedData);\n *\n * // Cache for default 2 hours\n * SignatureCache.set(cache, walletAddress, messageHash, signature);\n *\n * // Cache for 24 hours\n * SignatureCache.set(cache, walletAddress, messageHash, signature, 24);\n * ```\n */\n static set(\n cache: VanaCacheAdapter,\n walletAddress: string,\n messageHash: string,\n signature: Hash,\n ttlHours: number = this.DEFAULT_TTL_HOURS,\n ): void {\n const key = this.getCacheKey(walletAddress, messageHash);\n const cached: CachedSignature = {\n signature,\n expires: Date.now() + ttlHours * 3600000, // Convert hours to milliseconds\n };\n\n try {\n cache.set(key, JSON.stringify(cached));\n } catch {\n // Storage quota exceeded or other error, ignore silently\n // Better to continue without caching than to fail\n }\n }\n\n /**\n * Clear all cached signatures (useful for testing or explicit cleanup)\n *\n * @param cache - Platform cache adapter instance\n * @example\n * ```typescript\n * // Clear all signatures when user logs out\n * SignatureCache.clear(cache);\n *\n * // Clear before running tests\n * beforeEach(() => {\n * SignatureCache.clear(cache);\n * });\n * ```\n */\n static clear(cache: VanaCacheAdapter): void {\n try {\n cache.clear();\n } catch {\n // Ignore storage errors\n }\n }\n\n private static getCacheKey(\n walletAddress: string,\n messageHash: string,\n ): string {\n return `${this.PREFIX}${getAddress(walletAddress)}:${messageHash}`;\n }\n\n /**\n * Generate a deterministic hash of a message object for cache key generation\n *\n * @remarks\n * Creates a cryptographically secure hash from complex objects including EIP-712 typed data.\n * Uses SHA-256 for collision resistance and deterministic key generation.\n * Handles BigInt serialization and sorts object keys for consistency.\n *\n * @param message - The message object to hash (typically EIP-712 typed data)\n * @returns A hex string hash (SHA-256) suitable for cache keys\n * @example\n * ```typescript\n * const typedData = {\n * domain: { name: 'Vana', version: '1' },\n * message: { nonce: 123n, grant: '...' }\n * };\n *\n * const hash = SignatureCache.hashMessage(typedData);\n * // Returns SHA-256 hash like: \"a1b2c3d4e5f6...\"\n * ```\n */\n static hashMessage(message: object): string {\n // Deterministically stringify the object with sorted keys\n const jsonString = JSON.stringify(message, this.deterministicReplacer);\n\n // Use SHA-256 for cryptographic hashing\n const hashBytes = sha256(new TextEncoder().encode(jsonString));\n return bytesToHex(hashBytes);\n }\n\n /**\n * Deterministic JSON replacer that handles BigInt values and sorts object keys\n * This ensures consistent cache key generation for EIP-712 typed data\n *\n * @param _key - The object key being serialized (unused)\n * @param value - The value to serialize\n * @returns The serialized value with sorted keys for objects\n */\n private static deterministicReplacer(_key: string, value: unknown): unknown {\n if (typeof value === \"bigint\") {\n return `__BIGINT__${value.toString()}`;\n }\n // Sort object keys for deterministic serialization\n if (value !== null && typeof value === \"object\" && !Array.isArray(value)) {\n return Object.keys(value as Record<string, unknown>)\n .sort()\n .reduce(\n (sorted, key) => {\n sorted[key] = (value as Record<string, unknown>)[key];\n return sorted;\n },\n {} as Record<string, unknown>,\n );\n }\n return value;\n }\n}\n\n/**\n * Wrapper function to cache signature operations\n *\n * @param cache - The cache adapter to use for storage\n * @param walletAddress - The wallet address signing the message\n * @param typedData - The EIP-712 typed data being signed\n * @param signFn - Function that performs the actual signing\n * @param ttlHours - Cache TTL in hours (default 2)\n * @returns The signature (cached or newly generated)\n */\nexport async function withSignatureCache(\n cache: VanaCacheAdapter,\n walletAddress: string,\n typedData: Record<string, unknown>,\n signFn: () => Promise<Hash>,\n ttlHours?: number,\n): Promise<Hash> {\n // Create a hash of the typed data for the cache key\n const messageHash = SignatureCache.hashMessage(typedData);\n\n // Try to get from cache first\n const cached = SignatureCache.get(cache, walletAddress, messageHash);\n if (cached) {\n return cached;\n }\n\n // Not in cache, sign and store\n const signature = await signFn();\n SignatureCache.set(cache, walletAddress, messageHash, signature, ttlHours);\n\n return signature;\n}\n"],"mappings":";;;AAAA,SAAe,kBAAkB;AAEjC,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAmCpB,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoB1B,OAAO,IACL,OACA,eACA,aACa;AACb,UAAM,MAAM,KAAK,YAAY,eAAe,WAAW;AAEvD,QAAI;AACF,YAAM,SAAS,MAAM,IAAI,GAAG;AAC5B,UAAI,CAAC,OAAQ,QAAO;AAEpB,YAAM,SAA0B,KAAK,MAAM,MAAM;AAGjD,UAAI,KAAK,IAAI,IAAI,OAAO,SAAS;AAC/B,cAAM,OAAO,GAAG;AAChB,eAAO;AAAA,MACT;AAEA,aAAO,OAAO;AAAA,IAChB,QAAQ;AAEN,UAAI;AACF,cAAM,OAAO,GAAG;AAAA,MAClB,QAAQ;AAAA,MAER;AACA,aAAO;AAAA,IACT;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBA,OAAO,IACL,OACA,eACA,aACA,WACA,WAAmB,KAAK,mBAClB;AACN,UAAM,MAAM,KAAK,YAAY,eAAe,WAAW;AACvD,UAAM,SAA0B;AAAA,MAC9B;AAAA,MACA,SAAS,KAAK,IAAI,IAAI,WAAW;AAAA;AAAA,IACnC;AAEA,QAAI;AACF,YAAM,IAAI,KAAK,KAAK,UAAU,MAAM,CAAC;AAAA,IACvC,QAAQ;AAAA,IAGR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,OAAO,MAAM,OAA+B;AAC1C,QAAI;AACF,YAAM,MAAM;AAAA,IACd,QAAQ;AAAA,IAER;AAAA,EACF;AAAA,EAEA,OAAe,YACb,eACA,aACQ;AACR,WAAO,GAAG,KAAK,MAAM,GAAG,WAAW,aAAa,CAAC,IAAI,WAAW;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBA,OAAO,YAAY,SAAyB;AAE1C,UAAM,aAAa,KAAK,UAAU,SAAS,KAAK,qBAAqB;AAGrE,UAAM,YAAY,OAAO,IAAI,YAAY,EAAE,OAAO,UAAU,CAAC;AAC7D,WAAO,WAAW,SAAS;AAAA,EAC7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAe,sBAAsB,MAAc,OAAyB;AAC1E,QAAI,OAAO,UAAU,UAAU;AAC7B,aAAO,aAAa,MAAM,SAAS,CAAC;AAAA,IACtC;AAEA,QAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,GAAG;AACxE,aAAO,OAAO,KAAK,KAAgC,EAChD,KAAK,EACL;AAAA,QACC,CAAC,QAAQ,QAAQ;AACf,iBAAO,GAAG,IAAK,MAAkC,GAAG;AACpD,iBAAO;AAAA,QACT;AAAA,QACA,CAAC;AAAA,MACH;AAAA,IACJ;AACA,WAAO;AAAA,EACT;AACF;AAjLE,cADW,gBACa,UAAS;AACjC,cAFW,gBAEa,qBAAoB;AA4L9C,eAAsB,mBACpB,OACA,eACA,WACA,QACA,UACe;AAEf,QAAM,cAAc,eAAe,YAAY,SAAS;AAGxD,QAAM,SAAS,eAAe,IAAI,OAAO,eAAe,WAAW;AACnE,MAAI,QAAQ;AACV,WAAO;AAAA,EACT;AAGA,QAAM,YAAY,MAAM,OAAO;AAC/B,iBAAe,IAAI,OAAO,eAAe,aAAa,WAAW,QAAQ;AAEzE,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 signatureFormatter_exports = {};
|
|
20
|
+
__export(signatureFormatter_exports, {
|
|
21
|
+
formatSignatureForContract: () => formatSignatureForContract
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(signatureFormatter_exports);
|
|
24
|
+
const V_OFFSET_FOR_ETHEREUM = 27;
|
|
25
|
+
function formatSignatureForContract(signature) {
|
|
26
|
+
const cleanSig = signature.startsWith("0x") ? signature.slice(2) : signature;
|
|
27
|
+
if (cleanSig.length !== 130) {
|
|
28
|
+
return signature;
|
|
29
|
+
}
|
|
30
|
+
const vHex = cleanSig.slice(128, 130);
|
|
31
|
+
const v = parseInt(vHex, 16);
|
|
32
|
+
if (isNaN(v)) {
|
|
33
|
+
return signature;
|
|
34
|
+
}
|
|
35
|
+
if (v < 27) {
|
|
36
|
+
const adjustedV = (v + V_OFFSET_FOR_ETHEREUM).toString(16).padStart(2, "0");
|
|
37
|
+
return `0x${cleanSig.slice(0, 128)}${adjustedV}`;
|
|
38
|
+
}
|
|
39
|
+
return signature;
|
|
40
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
formatSignatureForContract
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=signatureFormatter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/signatureFormatter.ts"],"sourcesContent":["import type { Hash } from \"viem\";\n\nconst V_OFFSET_FOR_ETHEREUM = 27;\n\n/**\n * Formats a signature for Ethereum smart contract compatibility by adjusting the v-value.\n *\n * @remarks\n * This function ensures signature compatibility with Ethereum smart contracts by adjusting\n * the v-value component of ECDSA signatures. Some wallet implementations and signing methods\n * produce signatures with v-values in the range [0, 1], while Ethereum smart contracts\n * expect v-values in the range [27, 28] for proper signature verification.\n *\n * The function automatically detects signatures with low v-values and applies the standard\n * Ethereum offset (+27) to ensure compatibility. This is particularly important for gasless\n * transactions and EIP-712 signature verification in smart contracts.\n *\n * **Technical Details:**\n * - Ethereum signatures consist of r (32 bytes) + s (32 bytes) + v (1 byte) = 65 bytes total\n * - Valid v-values for Ethereum are 27 or 28 (or 0/1 + chain-specific offset for EIP-155)\n * - This function handles the common case where v ∈ [0, 1] needs adjustment to [27, 28]\n *\n * @param signature - The ECDSA signature hash to format (65 bytes as hex string)\n * @returns The formatted signature with correct v-value for Ethereum contract verification\n * @example\n * ```typescript\n * // Signature with v-value that needs adjustment\n * const rawSignature = \"0x1234...5600\"; // v = 0 (last byte)\n * const formatted = formatSignatureForContract(rawSignature);\n * // Result: \"0x1234...561b\" // v = 27 (0x1b)\n *\n * // Already properly formatted signature remains unchanged\n * const goodSignature = \"0x1234...561b\"; // v = 27\n * const unchanged = formatSignatureForContract(goodSignature);\n * // Result: \"0x1234...561b\" (no change needed)\n * ```\n * @category Cryptography\n */\nexport function formatSignatureForContract(signature: Hash): Hash {\n const cleanSig = signature.startsWith(\"0x\") ? signature.slice(2) : signature;\n\n if (cleanSig.length !== 130) {\n return signature;\n }\n\n const vHex = cleanSig.slice(128, 130);\n const v = parseInt(vHex, 16);\n\n if (isNaN(v)) {\n return signature;\n }\n\n if (v < 27) {\n const adjustedV = (v + V_OFFSET_FOR_ETHEREUM).toString(16).padStart(2, \"0\");\n return `0x${cleanSig.slice(0, 128)}${adjustedV}` as Hash;\n }\n\n return signature;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,wBAAwB;AAoCvB,SAAS,2BAA2B,WAAuB;AAChE,QAAM,WAAW,UAAU,WAAW,IAAI,IAAI,UAAU,MAAM,CAAC,IAAI;AAEnE,MAAI,SAAS,WAAW,KAAK;AAC3B,WAAO;AAAA,EACT;AAEA,QAAM,OAAO,SAAS,MAAM,KAAK,GAAG;AACpC,QAAM,IAAI,SAAS,MAAM,EAAE;AAE3B,MAAI,MAAM,CAAC,GAAG;AACZ,WAAO;AAAA,EACT;AAEA,MAAI,IAAI,IAAI;AACV,UAAM,aAAa,IAAI,uBAAuB,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AAC1E,WAAO,KAAK,SAAS,MAAM,GAAG,GAAG,CAAC,GAAG,SAAS;AAAA,EAChD;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Hash } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Formats a signature for Ethereum smart contract compatibility by adjusting the v-value.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This function ensures signature compatibility with Ethereum smart contracts by adjusting
|
|
8
|
+
* the v-value component of ECDSA signatures. Some wallet implementations and signing methods
|
|
9
|
+
* produce signatures with v-values in the range [0, 1], while Ethereum smart contracts
|
|
10
|
+
* expect v-values in the range [27, 28] for proper signature verification.
|
|
11
|
+
*
|
|
12
|
+
* The function automatically detects signatures with low v-values and applies the standard
|
|
13
|
+
* Ethereum offset (+27) to ensure compatibility. This is particularly important for gasless
|
|
14
|
+
* transactions and EIP-712 signature verification in smart contracts.
|
|
15
|
+
*
|
|
16
|
+
* **Technical Details:**
|
|
17
|
+
* - Ethereum signatures consist of r (32 bytes) + s (32 bytes) + v (1 byte) = 65 bytes total
|
|
18
|
+
* - Valid v-values for Ethereum are 27 or 28 (or 0/1 + chain-specific offset for EIP-155)
|
|
19
|
+
* - This function handles the common case where v ∈ [0, 1] needs adjustment to [27, 28]
|
|
20
|
+
*
|
|
21
|
+
* @param signature - The ECDSA signature hash to format (65 bytes as hex string)
|
|
22
|
+
* @returns The formatted signature with correct v-value for Ethereum contract verification
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Signature with v-value that needs adjustment
|
|
26
|
+
* const rawSignature = "0x1234...5600"; // v = 0 (last byte)
|
|
27
|
+
* const formatted = formatSignatureForContract(rawSignature);
|
|
28
|
+
* // Result: "0x1234...561b" // v = 27 (0x1b)
|
|
29
|
+
*
|
|
30
|
+
* // Already properly formatted signature remains unchanged
|
|
31
|
+
* const goodSignature = "0x1234...561b"; // v = 27
|
|
32
|
+
* const unchanged = formatSignatureForContract(goodSignature);
|
|
33
|
+
* // Result: "0x1234...561b" (no change needed)
|
|
34
|
+
* ```
|
|
35
|
+
* @category Cryptography
|
|
36
|
+
*/
|
|
37
|
+
declare function formatSignatureForContract(signature: Hash): Hash;
|
|
38
|
+
|
|
39
|
+
export { formatSignatureForContract };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Hash } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Formats a signature for Ethereum smart contract compatibility by adjusting the v-value.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This function ensures signature compatibility with Ethereum smart contracts by adjusting
|
|
8
|
+
* the v-value component of ECDSA signatures. Some wallet implementations and signing methods
|
|
9
|
+
* produce signatures with v-values in the range [0, 1], while Ethereum smart contracts
|
|
10
|
+
* expect v-values in the range [27, 28] for proper signature verification.
|
|
11
|
+
*
|
|
12
|
+
* The function automatically detects signatures with low v-values and applies the standard
|
|
13
|
+
* Ethereum offset (+27) to ensure compatibility. This is particularly important for gasless
|
|
14
|
+
* transactions and EIP-712 signature verification in smart contracts.
|
|
15
|
+
*
|
|
16
|
+
* **Technical Details:**
|
|
17
|
+
* - Ethereum signatures consist of r (32 bytes) + s (32 bytes) + v (1 byte) = 65 bytes total
|
|
18
|
+
* - Valid v-values for Ethereum are 27 or 28 (or 0/1 + chain-specific offset for EIP-155)
|
|
19
|
+
* - This function handles the common case where v ∈ [0, 1] needs adjustment to [27, 28]
|
|
20
|
+
*
|
|
21
|
+
* @param signature - The ECDSA signature hash to format (65 bytes as hex string)
|
|
22
|
+
* @returns The formatted signature with correct v-value for Ethereum contract verification
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Signature with v-value that needs adjustment
|
|
26
|
+
* const rawSignature = "0x1234...5600"; // v = 0 (last byte)
|
|
27
|
+
* const formatted = formatSignatureForContract(rawSignature);
|
|
28
|
+
* // Result: "0x1234...561b" // v = 27 (0x1b)
|
|
29
|
+
*
|
|
30
|
+
* // Already properly formatted signature remains unchanged
|
|
31
|
+
* const goodSignature = "0x1234...561b"; // v = 27
|
|
32
|
+
* const unchanged = formatSignatureForContract(goodSignature);
|
|
33
|
+
* // Result: "0x1234...561b" (no change needed)
|
|
34
|
+
* ```
|
|
35
|
+
* @category Cryptography
|
|
36
|
+
*/
|
|
37
|
+
declare function formatSignatureForContract(signature: Hash): Hash;
|
|
38
|
+
|
|
39
|
+
export { formatSignatureForContract };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const V_OFFSET_FOR_ETHEREUM = 27;
|
|
2
|
+
function formatSignatureForContract(signature) {
|
|
3
|
+
const cleanSig = signature.startsWith("0x") ? signature.slice(2) : signature;
|
|
4
|
+
if (cleanSig.length !== 130) {
|
|
5
|
+
return signature;
|
|
6
|
+
}
|
|
7
|
+
const vHex = cleanSig.slice(128, 130);
|
|
8
|
+
const v = parseInt(vHex, 16);
|
|
9
|
+
if (isNaN(v)) {
|
|
10
|
+
return signature;
|
|
11
|
+
}
|
|
12
|
+
if (v < 27) {
|
|
13
|
+
const adjustedV = (v + V_OFFSET_FOR_ETHEREUM).toString(16).padStart(2, "0");
|
|
14
|
+
return `0x${cleanSig.slice(0, 128)}${adjustedV}`;
|
|
15
|
+
}
|
|
16
|
+
return signature;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
formatSignatureForContract
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=signatureFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/signatureFormatter.ts"],"sourcesContent":["import type { Hash } from \"viem\";\n\nconst V_OFFSET_FOR_ETHEREUM = 27;\n\n/**\n * Formats a signature for Ethereum smart contract compatibility by adjusting the v-value.\n *\n * @remarks\n * This function ensures signature compatibility with Ethereum smart contracts by adjusting\n * the v-value component of ECDSA signatures. Some wallet implementations and signing methods\n * produce signatures with v-values in the range [0, 1], while Ethereum smart contracts\n * expect v-values in the range [27, 28] for proper signature verification.\n *\n * The function automatically detects signatures with low v-values and applies the standard\n * Ethereum offset (+27) to ensure compatibility. This is particularly important for gasless\n * transactions and EIP-712 signature verification in smart contracts.\n *\n * **Technical Details:**\n * - Ethereum signatures consist of r (32 bytes) + s (32 bytes) + v (1 byte) = 65 bytes total\n * - Valid v-values for Ethereum are 27 or 28 (or 0/1 + chain-specific offset for EIP-155)\n * - This function handles the common case where v ∈ [0, 1] needs adjustment to [27, 28]\n *\n * @param signature - The ECDSA signature hash to format (65 bytes as hex string)\n * @returns The formatted signature with correct v-value for Ethereum contract verification\n * @example\n * ```typescript\n * // Signature with v-value that needs adjustment\n * const rawSignature = \"0x1234...5600\"; // v = 0 (last byte)\n * const formatted = formatSignatureForContract(rawSignature);\n * // Result: \"0x1234...561b\" // v = 27 (0x1b)\n *\n * // Already properly formatted signature remains unchanged\n * const goodSignature = \"0x1234...561b\"; // v = 27\n * const unchanged = formatSignatureForContract(goodSignature);\n * // Result: \"0x1234...561b\" (no change needed)\n * ```\n * @category Cryptography\n */\nexport function formatSignatureForContract(signature: Hash): Hash {\n const cleanSig = signature.startsWith(\"0x\") ? signature.slice(2) : signature;\n\n if (cleanSig.length !== 130) {\n return signature;\n }\n\n const vHex = cleanSig.slice(128, 130);\n const v = parseInt(vHex, 16);\n\n if (isNaN(v)) {\n return signature;\n }\n\n if (v < 27) {\n const adjustedV = (v + V_OFFSET_FOR_ETHEREUM).toString(16).padStart(2, \"0\");\n return `0x${cleanSig.slice(0, 128)}${adjustedV}` as Hash;\n }\n\n return signature;\n}\n"],"mappings":"AAEA,MAAM,wBAAwB;AAoCvB,SAAS,2BAA2B,WAAuB;AAChE,QAAM,WAAW,UAAU,WAAW,IAAI,IAAI,UAAU,MAAM,CAAC,IAAI;AAEnE,MAAI,SAAS,WAAW,KAAK;AAC3B,WAAO;AAAA,EACT;AAEA,QAAM,OAAO,SAAS,MAAM,KAAK,GAAG;AACpC,QAAM,IAAI,SAAS,MAAM,EAAE;AAE3B,MAAI,MAAM,CAAC,GAAG;AACZ,WAAO;AAAA,EACT;AAEA,MAAI,IAAI,IAAI;AACV,UAAM,aAAa,IAAI,uBAAuB,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AAC1E,WAAO,KAAK,SAAS,MAAM,GAAG,GAAG,CAAC,GAAG,SAAS;AAAA,EAChD;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 transactionHelpers_exports = {};
|
|
20
|
+
__export(transactionHelpers_exports, {
|
|
21
|
+
tx: () => tx,
|
|
22
|
+
txLiteral: () => txLiteral
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(transactionHelpers_exports);
|
|
25
|
+
function tx(input) {
|
|
26
|
+
return {
|
|
27
|
+
hash: input.hash,
|
|
28
|
+
from: input.from,
|
|
29
|
+
contract: input.contract,
|
|
30
|
+
fn: input.fn,
|
|
31
|
+
...input.chainId !== void 0 && { chainId: input.chainId },
|
|
32
|
+
...input.value !== void 0 && { value: input.value },
|
|
33
|
+
...input.nonce !== void 0 && { nonce: input.nonce },
|
|
34
|
+
...input.to !== void 0 && { to: input.to }
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function txLiteral(input) {
|
|
38
|
+
return {
|
|
39
|
+
hash: input.hash,
|
|
40
|
+
from: input.from,
|
|
41
|
+
contract: input.contract,
|
|
42
|
+
fn: input.fn,
|
|
43
|
+
...input.chainId !== void 0 && { chainId: input.chainId },
|
|
44
|
+
...input.value !== void 0 && { value: input.value },
|
|
45
|
+
...input.nonce !== void 0 && { nonce: input.nonce },
|
|
46
|
+
...input.to !== void 0 && { to: input.to }
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
tx,
|
|
52
|
+
txLiteral
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=transactionHelpers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/transactionHelpers.ts"],"sourcesContent":["/**\n * Helper functions for creating typed transaction POJOs\n */\n\nimport type { Hash, Address } from 'viem';\nimport type { TransactionResult } from '../types/operations';\nimport type { Contract, Fn } from '../generated/event-types';\n\n/**\n * Creates a strongly-typed TransactionResult POJO.\n * \n * @remarks\n * This helper ensures all required fields are present and typed correctly,\n * reducing boilerplate and preventing mistakes.\n * \n * @param input - Transaction details\n * @param input.hash - Transaction hash\n * @param input.from - Transaction sender address\n * @param input.contract - Contract name\n * @param input.fn - Function name\n * @param input.chainId - Optional chain ID\n * @param input.value - Optional transaction value\n * @param input.nonce - Optional nonce\n * @param input.to - Optional recipient address\n * @returns Typed TransactionResult\n * \n * @example\n * ```typescript\n * return tx({\n * hash,\n * from: account.address,\n * contract: \"DataPortabilityPermissions\",\n * fn: \"revokePermission\",\n * });\n * ```\n */\nexport function tx<C extends Contract, F extends Fn<C>>(input: {\n hash: Hash;\n from: Address;\n contract: C;\n fn: F;\n chainId?: number;\n value?: bigint;\n nonce?: number;\n to?: Address;\n}): TransactionResult<C, F> {\n // Create a new plain object to ensure independence and true POJO behavior\n return {\n hash: input.hash,\n from: input.from,\n contract: input.contract,\n fn: input.fn,\n ...(input.chainId !== undefined && { chainId: input.chainId }),\n ...(input.value !== undefined && { value: input.value }),\n ...(input.nonce !== undefined && { nonce: input.nonce }),\n ...(input.to !== undefined && { to: input.to }),\n };\n}\n\n/**\n * Creates a transaction result with literal type inference.\n * Use this when you need TypeScript to preserve exact string literals.\n * \n * @param input - Transaction details\n * @param input.hash - Transaction hash\n * @param input.from - Transaction sender address\n * @param input.contract - Contract name\n * @param input.fn - Function name\n * @param input.chainId - Optional chain ID\n * @param input.value - Optional transaction value\n * @param input.nonce - Optional nonce\n * @param input.to - Optional recipient address\n * @returns Typed TransactionResult\n * \n * @example\n * ```typescript\n * const transaction = txLiteral({\n * hash: '0x...',\n * from: '0x...',\n * contract: \"DataPortabilityPermissions\",\n * fn: \"revokePermission\",\n * });\n * // TypeScript knows exactly: DataPortabilityPermissions + revokePermission\n * ```\n */\nexport function txLiteral<\n const C extends Contract,\n const F extends Fn<C>\n>(input: {\n hash: Hash;\n from: Address;\n contract: C;\n fn: F;\n chainId?: number;\n value?: bigint;\n nonce?: number;\n to?: Address;\n}): TransactionResult<C, F> {\n // Create a new plain object to ensure independence and true POJO behavior\n return {\n hash: input.hash,\n from: input.from,\n contract: input.contract,\n fn: input.fn,\n ...(input.chainId !== undefined && { chainId: input.chainId }),\n ...(input.value !== undefined && { value: input.value }),\n ...(input.nonce !== undefined && { nonce: input.nonce }),\n ...(input.to !== undefined && { to: input.to }),\n };\n}"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCO,SAAS,GAAwC,OAS5B;AAE1B,SAAO;AAAA,IACL,MAAM,MAAM;AAAA,IACZ,MAAM,MAAM;AAAA,IACZ,UAAU,MAAM;AAAA,IAChB,IAAI,MAAM;AAAA,IACV,GAAI,MAAM,YAAY,UAAa,EAAE,SAAS,MAAM,QAAQ;AAAA,IAC5D,GAAI,MAAM,UAAU,UAAa,EAAE,OAAO,MAAM,MAAM;AAAA,IACtD,GAAI,MAAM,UAAU,UAAa,EAAE,OAAO,MAAM,MAAM;AAAA,IACtD,GAAI,MAAM,OAAO,UAAa,EAAE,IAAI,MAAM,GAAG;AAAA,EAC/C;AACF;AA4BO,SAAS,UAGd,OAS0B;AAE1B,SAAO;AAAA,IACL,MAAM,MAAM;AAAA,IACZ,MAAM,MAAM;AAAA,IACZ,UAAU,MAAM;AAAA,IAChB,IAAI,MAAM;AAAA,IACV,GAAI,MAAM,YAAY,UAAa,EAAE,SAAS,MAAM,QAAQ;AAAA,IAC5D,GAAI,MAAM,UAAU,UAAa,EAAE,OAAO,MAAM,MAAM;AAAA,IACtD,GAAI,MAAM,UAAU,UAAa,EAAE,OAAO,MAAM,MAAM;AAAA,IACtD,GAAI,MAAM,OAAO,UAAa,EAAE,IAAI,MAAM,GAAG;AAAA,EAC/C;AACF;","names":[]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Hash, Address } from 'viem';
|
|
2
|
+
import { TransactionResult } from '../types/operations.cjs';
|
|
3
|
+
import { Contract, Fn } from '../generated/event-types.cjs';
|
|
4
|
+
import '../generated/server/server-exports.cjs';
|
|
5
|
+
import '../generated/server/server.cjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Helper functions for creating typed transaction POJOs
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates a strongly-typed TransactionResult POJO.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* This helper ensures all required fields are present and typed correctly,
|
|
16
|
+
* reducing boilerplate and preventing mistakes.
|
|
17
|
+
*
|
|
18
|
+
* @param input - Transaction details
|
|
19
|
+
* @param input.hash - Transaction hash
|
|
20
|
+
* @param input.from - Transaction sender address
|
|
21
|
+
* @param input.contract - Contract name
|
|
22
|
+
* @param input.fn - Function name
|
|
23
|
+
* @param input.chainId - Optional chain ID
|
|
24
|
+
* @param input.value - Optional transaction value
|
|
25
|
+
* @param input.nonce - Optional nonce
|
|
26
|
+
* @param input.to - Optional recipient address
|
|
27
|
+
* @returns Typed TransactionResult
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* return tx({
|
|
32
|
+
* hash,
|
|
33
|
+
* from: account.address,
|
|
34
|
+
* contract: "DataPortabilityPermissions",
|
|
35
|
+
* fn: "revokePermission",
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function tx<C extends Contract, F extends Fn<C>>(input: {
|
|
40
|
+
hash: Hash;
|
|
41
|
+
from: Address;
|
|
42
|
+
contract: C;
|
|
43
|
+
fn: F;
|
|
44
|
+
chainId?: number;
|
|
45
|
+
value?: bigint;
|
|
46
|
+
nonce?: number;
|
|
47
|
+
to?: Address;
|
|
48
|
+
}): TransactionResult<C, F>;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a transaction result with literal type inference.
|
|
51
|
+
* Use this when you need TypeScript to preserve exact string literals.
|
|
52
|
+
*
|
|
53
|
+
* @param input - Transaction details
|
|
54
|
+
* @param input.hash - Transaction hash
|
|
55
|
+
* @param input.from - Transaction sender address
|
|
56
|
+
* @param input.contract - Contract name
|
|
57
|
+
* @param input.fn - Function name
|
|
58
|
+
* @param input.chainId - Optional chain ID
|
|
59
|
+
* @param input.value - Optional transaction value
|
|
60
|
+
* @param input.nonce - Optional nonce
|
|
61
|
+
* @param input.to - Optional recipient address
|
|
62
|
+
* @returns Typed TransactionResult
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const transaction = txLiteral({
|
|
67
|
+
* hash: '0x...',
|
|
68
|
+
* from: '0x...',
|
|
69
|
+
* contract: "DataPortabilityPermissions",
|
|
70
|
+
* fn: "revokePermission",
|
|
71
|
+
* });
|
|
72
|
+
* // TypeScript knows exactly: DataPortabilityPermissions + revokePermission
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
declare function txLiteral<const C extends Contract, const F extends Fn<C>>(input: {
|
|
76
|
+
hash: Hash;
|
|
77
|
+
from: Address;
|
|
78
|
+
contract: C;
|
|
79
|
+
fn: F;
|
|
80
|
+
chainId?: number;
|
|
81
|
+
value?: bigint;
|
|
82
|
+
nonce?: number;
|
|
83
|
+
to?: Address;
|
|
84
|
+
}): TransactionResult<C, F>;
|
|
85
|
+
|
|
86
|
+
export { tx, txLiteral };
|