voltaire-effect 0.2.23 → 0.2.24
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/KZGService-B7PJerOb.d.ts +146 -0
- package/dist/{X25519Test-DGsk1V9o.d.ts → X25519Test-C8Cicdd_.d.ts} +2 -139
- package/dist/crypto/index.d.ts +3 -2
- package/dist/{index-IgkEHjBe.d.ts → index-DsFjN_a3.d.ts} +17633 -11961
- package/dist/index.d.ts +3104 -938
- package/dist/index.js +4467 -2446
- package/dist/native/index.d.ts +14 -5
- package/dist/native/index.js +4489 -2468
- package/dist/primitives/index.d.ts +12 -4
- package/dist/primitives/index.js +3980 -2411
- package/package.json +2 -2
- package/src/crypto/Keccak256/index.ts +1 -0
- package/src/index.ts +2 -2
- package/src/primitives/Abi/decode.test.ts +38 -0
- package/src/primitives/Abi/decode.ts +67 -0
- package/src/primitives/Abi/decodeData.test.ts +37 -0
- package/src/primitives/Abi/decodeData.ts +77 -0
- package/src/primitives/Abi/decodeLog.test.ts +32 -0
- package/src/primitives/Abi/decodeLog.ts +81 -0
- package/src/primitives/Abi/decodeWrappedError.test.ts +41 -0
- package/src/primitives/Abi/decodeWrappedError.ts +68 -0
- package/src/primitives/Abi/encode.test.ts +43 -0
- package/src/primitives/Abi/encode.ts +67 -0
- package/src/primitives/Abi/encodePacked.test.ts +35 -0
- package/src/primitives/Abi/encodePacked.ts +62 -0
- package/src/primitives/Abi/encodeWrappedError.test.ts +21 -0
- package/src/primitives/Abi/encodeWrappedError.ts +64 -0
- package/src/primitives/Abi/findSelectorCollisions.test.ts +50 -0
- package/src/primitives/Abi/findSelectorCollisions.ts +83 -0
- package/src/primitives/Abi/index.ts +33 -7
- package/src/primitives/Abi/parseLogs.test.ts +37 -0
- package/src/primitives/Abi/parseLogs.ts +62 -0
- package/src/primitives/AccessList/AccessList.test.ts +229 -0
- package/src/primitives/AccessList/AccessListTypeSchema.ts +16 -0
- package/src/primitives/AccessList/addressCount.ts +21 -0
- package/src/primitives/AccessList/assertValid.ts +37 -0
- package/src/primitives/AccessList/create.ts +19 -0
- package/src/primitives/AccessList/deduplicate.ts +23 -0
- package/src/primitives/AccessList/from.ts +39 -0
- package/src/primitives/AccessList/fromBytes.ts +36 -0
- package/src/primitives/AccessList/gasCost.ts +22 -0
- package/src/primitives/AccessList/gasSavings.ts +26 -0
- package/src/primitives/AccessList/hasSavings.ts +23 -0
- package/src/primitives/AccessList/includesAddress.ts +25 -0
- package/src/primitives/AccessList/includesStorageKey.ts +28 -0
- package/src/primitives/AccessList/index.ts +99 -19
- package/src/primitives/AccessList/is.ts +23 -0
- package/src/primitives/AccessList/isEmpty.ts +23 -0
- package/src/primitives/AccessList/isItem.ts +22 -0
- package/src/primitives/AccessList/keysFor.ts +29 -0
- package/src/primitives/AccessList/merge.ts +24 -0
- package/src/primitives/AccessList/storageKeyCount.ts +21 -0
- package/src/primitives/AccessList/toBytes.ts +23 -0
- package/src/primitives/AccessList/withAddress.ts +27 -0
- package/src/primitives/AccessList/withStorageKey.ts +30 -0
- package/src/primitives/Address/Address.test.ts +146 -0
- package/src/primitives/Address/assert.ts +51 -0
- package/src/primitives/Address/calculateCreate2Address.ts +33 -0
- package/src/primitives/Address/calculateCreateAddress.ts +30 -0
- package/src/primitives/Address/deduplicateAddresses.ts +20 -0
- package/src/primitives/Address/from.ts +41 -0
- package/src/primitives/Address/fromAbiEncoded.ts +35 -0
- package/src/primitives/Address/fromBase64.ts +25 -0
- package/src/primitives/Address/fromBytes.ts +25 -0
- package/src/primitives/Address/fromHex.ts +31 -0
- package/src/primitives/Address/fromNumber.ts +25 -0
- package/src/primitives/Address/fromPrivateKey.ts +25 -0
- package/src/primitives/Address/fromPublicKey.ts +56 -0
- package/src/primitives/Address/index.ts +99 -35
- package/src/primitives/Address/is.ts +20 -0
- package/src/primitives/Address/isAddress.ts +22 -0
- package/src/primitives/Address/sortAddresses.ts +19 -0
- package/src/primitives/Address/toChecksummed.ts +32 -0
- package/src/primitives/Address/toHex.ts +18 -0
- package/src/primitives/Address/zero.ts +18 -0
- package/src/primitives/Base64/Base64.test.ts +75 -0
- package/src/primitives/Base64/convert.ts +37 -0
- package/src/primitives/Base64/decode.ts +59 -0
- package/src/primitives/Base64/encode.ts +42 -0
- package/src/primitives/Base64/from.ts +39 -0
- package/src/primitives/Base64/index.ts +81 -1
- package/src/primitives/Base64/size.ts +16 -0
- package/src/primitives/Base64/validation.ts +16 -0
- package/src/primitives/Blob/Blob.test.ts +292 -0
- package/src/primitives/Blob/calculateGas.ts +30 -0
- package/src/primitives/Blob/estimateBlobCount.ts +30 -0
- package/src/primitives/Blob/from.ts +38 -0
- package/src/primitives/Blob/fromData.ts +36 -0
- package/src/primitives/Blob/index.ts +99 -12
- package/src/primitives/Blob/isValidVersion.ts +27 -0
- package/src/primitives/Blob/joinData.ts +43 -0
- package/src/primitives/Blob/splitData.ts +36 -0
- package/src/primitives/Blob/toCommitment.ts +43 -0
- package/src/primitives/Blob/toProof.ts +50 -0
- package/src/primitives/Blob/toVersionedHash.ts +35 -0
- package/src/primitives/Blob/verify.ts +49 -0
- package/src/primitives/Blob/verifyBatch.ts +119 -0
- package/src/primitives/BloomFilter/BloomFilter.test.ts +138 -0
- package/src/primitives/BloomFilter/add.ts +23 -0
- package/src/primitives/BloomFilter/combine.ts +21 -0
- package/src/primitives/BloomFilter/contains.ts +26 -0
- package/src/primitives/BloomFilter/create.ts +35 -0
- package/src/primitives/BloomFilter/density.ts +22 -0
- package/src/primitives/BloomFilter/expectedFalsePositiveRate.ts +25 -0
- package/src/primitives/BloomFilter/fromHex.ts +37 -0
- package/src/primitives/BloomFilter/hash.ts +43 -0
- package/src/primitives/BloomFilter/index.ts +59 -37
- package/src/primitives/BloomFilter/isEmpty.ts +22 -0
- package/src/primitives/BloomFilter/merge.ts +24 -0
- package/src/primitives/BloomFilter/toHex.ts +22 -0
- package/src/primitives/Bytecode/analyze.ts +58 -0
- package/src/primitives/Bytecode/detectFusions.ts +10 -0
- package/src/primitives/Bytecode/equals.ts +10 -0
- package/src/primitives/Bytecode/extractRuntime.ts +12 -0
- package/src/primitives/Bytecode/format.ts +16 -0
- package/src/primitives/Bytecode/from.ts +16 -0
- package/src/primitives/Bytecode/fromHex.ts +14 -0
- package/src/primitives/Bytecode/getBlock.ts +12 -0
- package/src/primitives/Bytecode/getNextPc.ts +12 -0
- package/src/primitives/Bytecode/getPushSize.ts +8 -0
- package/src/primitives/Bytecode/hasMetadata.ts +10 -0
- package/src/primitives/Bytecode/hash.ts +9 -0
- package/src/primitives/Bytecode/index.ts +103 -13
- package/src/primitives/Bytecode/isPush.ts +8 -0
- package/src/primitives/Bytecode/isTerminator.ts +8 -0
- package/src/primitives/Bytecode/isValidJumpDest.ts +12 -0
- package/src/primitives/Bytecode/parseInstructions.ts +10 -0
- package/src/primitives/Bytecode/prettyPrint.ts +12 -0
- package/src/primitives/Bytecode/scan.ts +20 -0
- package/src/primitives/Bytecode/size.ts +9 -0
- package/src/primitives/Bytecode/stripMetadata.ts +10 -0
- package/src/primitives/Bytecode/toAbi.ts +10 -0
- package/src/primitives/Bytecode/toHex.ts +10 -0
- package/src/primitives/Bytecode/types.ts +23 -0
- package/src/primitives/Bytecode/validate.ts +9 -0
- package/src/primitives/Ens/Ens.test.ts +71 -0
- package/src/primitives/Ens/convert.ts +13 -0
- package/src/primitives/Ens/from.ts +32 -0
- package/src/primitives/Ens/hash.ts +46 -0
- package/src/primitives/Ens/index.ts +86 -4
- package/src/primitives/Ens/normalize.ts +45 -0
- package/src/primitives/Ens/validation.ts +38 -0
- package/src/primitives/EventLog/accessors.ts +32 -0
- package/src/primitives/EventLog/clone.ts +17 -0
- package/src/primitives/EventLog/create.ts +46 -0
- package/src/primitives/EventLog/filtering.ts +48 -0
- package/src/primitives/EventLog/index.ts +96 -6
- package/src/primitives/EventLog/status.ts +17 -0
- package/src/primitives/EventLog/toRpc.ts +49 -0
- package/src/primitives/Hardfork/HardforkSchema.ts +3 -3
- package/src/primitives/Hardfork/allIds.ts +13 -0
- package/src/primitives/Hardfork/allNames.ts +13 -0
- package/src/primitives/Hardfork/compare.ts +17 -0
- package/src/primitives/Hardfork/comparisons.ts +45 -0
- package/src/primitives/Hardfork/equals.ts +17 -0
- package/src/primitives/Hardfork/features.ts +61 -0
- package/src/primitives/Hardfork/fromString.ts +16 -0
- package/src/primitives/Hardfork/index.ts +128 -18
- package/src/primitives/Hardfork/isValidName.ts +14 -0
- package/src/primitives/Hardfork/minMax.ts +23 -0
- package/src/primitives/Hardfork/range.ts +19 -0
- package/src/primitives/Hardfork/toString.ts +16 -0
- package/src/primitives/Hash/Hash.test.ts +104 -0
- package/src/primitives/Hash/from.ts +47 -0
- package/src/primitives/Hash/fromBytes.ts +46 -0
- package/src/primitives/Hash/fromHex.ts +44 -0
- package/src/primitives/Hash/index.ts +45 -8
- package/src/primitives/Hash/isHash.ts +31 -0
- package/src/primitives/Hash/toHex.ts +29 -0
- package/src/primitives/Hex/Hex.test.ts +266 -155
- package/src/primitives/Hex/assertSize.ts +41 -0
- package/src/primitives/Hex/concat.ts +37 -0
- package/src/primitives/Hex/from.ts +38 -0
- package/src/primitives/Hex/fromBigInt.ts +40 -0
- package/src/primitives/Hex/fromBoolean.ts +29 -0
- package/src/primitives/Hex/fromNumber.ts +41 -0
- package/src/primitives/Hex/fromString.ts +28 -0
- package/src/primitives/Hex/index.ts +68 -37
- package/src/primitives/Hex/pad.ts +40 -0
- package/src/primitives/Hex/padRight.ts +39 -0
- package/src/primitives/Hex/size.ts +29 -0
- package/src/primitives/Hex/slice.ts +42 -0
- package/src/primitives/Hex/toBigInt.ts +27 -0
- package/src/primitives/Hex/toBoolean.ts +38 -0
- package/src/primitives/Hex/toNumber.ts +37 -0
- package/src/primitives/Hex/toStringHex.ts +39 -0
- package/src/primitives/Hex/trim.ts +27 -0
- package/src/primitives/Hex/validate.ts +37 -0
- package/src/primitives/Hex/xor.ts +39 -0
- package/src/primitives/Opcode/OpcodeSchema.ts +1 -1
- package/src/primitives/Opcode/disassemble.ts +15 -0
- package/src/primitives/Opcode/dupPosition.ts +15 -0
- package/src/primitives/Opcode/format.ts +15 -0
- package/src/primitives/Opcode/getters.ts +54 -0
- package/src/primitives/Opcode/index.ts +301 -11
- package/src/primitives/Opcode/info.ts +18 -0
- package/src/primitives/Opcode/jumpDests.ts +15 -0
- package/src/primitives/Opcode/logTopics.ts +15 -0
- package/src/primitives/Opcode/name.ts +15 -0
- package/src/primitives/Opcode/parse.ts +15 -0
- package/src/primitives/Opcode/predicates.ts +72 -0
- package/src/primitives/Opcode/pushBytes.ts +15 -0
- package/src/primitives/Opcode/pushOpcode.ts +15 -0
- package/src/primitives/Opcode/swapPosition.ts +15 -0
- package/src/primitives/Rlp/decodeBatch.ts +46 -0
- package/src/primitives/Rlp/decodeObject.ts +46 -0
- package/src/primitives/Rlp/decodeValue.ts +51 -0
- package/src/primitives/Rlp/encodeBatch.ts +50 -0
- package/src/primitives/Rlp/encodeObject.ts +48 -0
- package/src/primitives/Rlp/encodeVariadic.ts +49 -0
- package/src/primitives/Rlp/equals.ts +22 -0
- package/src/primitives/Rlp/from.ts +44 -0
- package/src/primitives/Rlp/fromJSON.ts +45 -0
- package/src/primitives/Rlp/getEncodedLength.ts +47 -0
- package/src/primitives/Rlp/getLength.ts +44 -0
- package/src/primitives/Rlp/index.ts +67 -14
- package/src/primitives/Rlp/isBytesData.ts +21 -0
- package/src/primitives/Rlp/isCanonical.ts +32 -0
- package/src/primitives/Rlp/isData.ts +21 -0
- package/src/primitives/Rlp/isList.ts +46 -0
- package/src/primitives/Rlp/isListData.ts +21 -0
- package/src/primitives/Rlp/isString.ts +46 -0
- package/src/primitives/Rlp/toJSON.ts +20 -0
- package/src/primitives/Rlp/toRaw.ts +31 -0
- package/src/primitives/Signature/Signature.test.ts +217 -0
- package/src/primitives/Signature/from.ts +38 -0
- package/src/primitives/Signature/fromBytes.ts +31 -0
- package/src/primitives/Signature/fromCompact.ts +33 -0
- package/src/primitives/Signature/fromDER.ts +35 -0
- package/src/primitives/Signature/fromEd25519.ts +24 -0
- package/src/primitives/Signature/fromHex.ts +29 -0
- package/src/primitives/Signature/fromP256.ts +25 -0
- package/src/primitives/Signature/fromRpc.ts +38 -0
- package/src/primitives/Signature/fromSecp256k1.ts +29 -0
- package/src/primitives/Signature/fromTuple.ts +33 -0
- package/src/primitives/Signature/getR.ts +24 -0
- package/src/primitives/Signature/getS.ts +24 -0
- package/src/primitives/Signature/getV.ts +24 -0
- package/src/primitives/Signature/index.ts +61 -11
- package/src/primitives/Signature/toDER.ts +24 -0
- package/src/primitives/Signature/toHex.ts +24 -0
- package/src/primitives/Signature/toRpc.ts +35 -0
- package/src/primitives/Signature/toTuple.ts +29 -0
- package/src/primitives/Signature/verify.ts +31 -0
- package/src/primitives/Siwe/create.ts +56 -0
- package/src/primitives/Siwe/hash.ts +27 -0
- package/src/primitives/Siwe/index.ts +57 -21
- package/src/primitives/Siwe/parse.ts +24 -0
- package/src/primitives/Siwe/verify.ts +47 -0
- package/src/primitives/Transaction/index.ts +467 -2
- package/src/primitives/Uint/Uint.test.ts +200 -0
- package/src/primitives/Uint/dividedBy.ts +34 -0
- package/src/primitives/Uint/from.ts +35 -0
- package/src/primitives/Uint/fromAbiEncoded.ts +29 -0
- package/src/primitives/Uint/fromBigInt.ts +30 -0
- package/src/primitives/Uint/fromBytes.ts +32 -0
- package/src/primitives/Uint/fromHex.ts +32 -0
- package/src/primitives/Uint/fromNumber.ts +30 -0
- package/src/primitives/Uint/index.ts +90 -45
- package/src/primitives/Uint/isUint256.ts +25 -0
- package/src/primitives/Uint/isValid.ts +25 -0
- package/src/primitives/Uint/modulo.ts +34 -0
- package/src/primitives/Uint/toHex.ts +31 -0
- package/src/primitives/Uint/tryFrom.ts +30 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import * as effect_Cause from 'effect/Cause';
|
|
2
|
+
import * as effect_Types from 'effect/Types';
|
|
3
|
+
import { KzgBlobType, KzgCommitmentType, KzgProofType } from '@tevm/voltaire';
|
|
4
|
+
import * as Context from 'effect/Context';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Layer from 'effect/Layer';
|
|
7
|
+
|
|
8
|
+
declare const KZGError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
9
|
+
readonly _tag: "KZGError";
|
|
10
|
+
} & Readonly<A>;
|
|
11
|
+
/**
|
|
12
|
+
* Error thrown when a KZG operation fails.
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* Contains the operation that failed, error code, message, and optional cause.
|
|
16
|
+
*
|
|
17
|
+
* Common failure reasons:
|
|
18
|
+
* - Trusted setup not loaded (SETUP_NOT_LOADED)
|
|
19
|
+
* - Invalid blob size or format (INVALID_BLOB)
|
|
20
|
+
* - Invalid commitment format (INVALID_COMMITMENT)
|
|
21
|
+
* - Invalid proof format (INVALID_PROOF)
|
|
22
|
+
* - Verification failure
|
|
23
|
+
*
|
|
24
|
+
* @since 0.0.1
|
|
25
|
+
*/
|
|
26
|
+
declare class KZGError extends KZGError_base<{
|
|
27
|
+
/** Error code for programmatic handling */
|
|
28
|
+
readonly code: "SETUP_NOT_LOADED" | "INVALID_BLOB" | "INVALID_COMMITMENT" | "INVALID_PROOF" | "OPERATION_FAILED";
|
|
29
|
+
/** The KZG operation that failed */
|
|
30
|
+
readonly operation: "blobToKzgCommitment" | "computeBlobKzgProof" | "verifyBlobKzgProof" | "loadTrustedSetup" | "isInitialized";
|
|
31
|
+
/** Human-readable error message */
|
|
32
|
+
readonly message: string;
|
|
33
|
+
/** Underlying error that caused this failure */
|
|
34
|
+
readonly cause?: unknown;
|
|
35
|
+
}> {
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Shape interface for KZG commitment service operations.
|
|
39
|
+
*
|
|
40
|
+
* @description
|
|
41
|
+
* Defines the contract for KZG implementations. Operations require the trusted
|
|
42
|
+
* setup to be loaded first via loadTrustedSetup().
|
|
43
|
+
*
|
|
44
|
+
* @since 0.0.1
|
|
45
|
+
*/
|
|
46
|
+
interface KZGServiceShape {
|
|
47
|
+
/**
|
|
48
|
+
* Computes a KZG commitment for a blob.
|
|
49
|
+
* @param blob - The 128KB blob data
|
|
50
|
+
* @returns Effect containing the 48-byte commitment, or KZGError if operation fails
|
|
51
|
+
*/
|
|
52
|
+
readonly blobToKzgCommitment: (blob: KzgBlobType) => Effect.Effect<KzgCommitmentType, KZGError>;
|
|
53
|
+
/**
|
|
54
|
+
* Computes a KZG proof for a blob and commitment.
|
|
55
|
+
* @param blob - The 128KB blob data
|
|
56
|
+
* @param commitment - The 48-byte commitment
|
|
57
|
+
* @returns Effect containing the 48-byte proof, or KZGError if operation fails
|
|
58
|
+
*/
|
|
59
|
+
readonly computeBlobKzgProof: (blob: KzgBlobType, commitment: KzgCommitmentType) => Effect.Effect<KzgProofType, KZGError>;
|
|
60
|
+
/**
|
|
61
|
+
* Verifies a KZG proof against a blob and commitment.
|
|
62
|
+
* @param blob - The 128KB blob data
|
|
63
|
+
* @param commitment - The 48-byte commitment
|
|
64
|
+
* @param proof - The 48-byte proof
|
|
65
|
+
* @returns Effect containing true if proof is valid, or KZGError if operation fails
|
|
66
|
+
*/
|
|
67
|
+
readonly verifyBlobKzgProof: (blob: KzgBlobType, commitment: KzgCommitmentType, proof: KzgProofType) => Effect.Effect<boolean, KZGError>;
|
|
68
|
+
/**
|
|
69
|
+
* Loads the trusted setup for KZG operations.
|
|
70
|
+
* @returns Effect that completes when setup is loaded, or KZGError if loading fails
|
|
71
|
+
*/
|
|
72
|
+
readonly loadTrustedSetup: () => Effect.Effect<void, KZGError>;
|
|
73
|
+
/**
|
|
74
|
+
* Checks if the trusted setup has been initialized.
|
|
75
|
+
* @returns Effect containing true if initialized, or KZGError if check fails
|
|
76
|
+
*/
|
|
77
|
+
readonly isInitialized: () => Effect.Effect<boolean, KZGError>;
|
|
78
|
+
}
|
|
79
|
+
declare const KZGService_base: Context.TagClass<KZGService, "KZGService", KZGServiceShape>;
|
|
80
|
+
/**
|
|
81
|
+
* KZG polynomial commitment service for Effect-based applications.
|
|
82
|
+
* Implements EIP-4844 blob commitments for Ethereum proto-danksharding.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* import { KZGService, KZGLive } from 'voltaire-effect/crypto'
|
|
87
|
+
* import * as Effect from 'effect/Effect'
|
|
88
|
+
*
|
|
89
|
+
* const program = Effect.gen(function* () {
|
|
90
|
+
* const kzg = yield* KZGService
|
|
91
|
+
* yield* kzg.loadTrustedSetup()
|
|
92
|
+
* const commitment = yield* kzg.blobToKzgCommitment(blob)
|
|
93
|
+
* const proof = yield* kzg.computeBlobKzgProof(blob, commitment)
|
|
94
|
+
* return yield* kzg.verifyBlobKzgProof(blob, commitment, proof)
|
|
95
|
+
* }).pipe(Effect.provide(KZGLive))
|
|
96
|
+
* ```
|
|
97
|
+
* @since 0.0.1
|
|
98
|
+
*/
|
|
99
|
+
declare class KZGService extends KZGService_base {
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Production layer for KZGService using native KZG implementation.
|
|
103
|
+
*
|
|
104
|
+
* @description
|
|
105
|
+
* Provides real KZG operations using the c-kzg-4844 library with Ethereum's
|
|
106
|
+
* trusted setup. The trusted setup must be loaded before other operations.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* import { KZGService, KZGLive } from 'voltaire-effect/crypto/KZG'
|
|
111
|
+
* import * as Effect from 'effect/Effect'
|
|
112
|
+
*
|
|
113
|
+
* const program = Effect.gen(function* () {
|
|
114
|
+
* const kzg = yield* KZGService
|
|
115
|
+
* yield* kzg.loadTrustedSetup()
|
|
116
|
+
* const commitment = yield* kzg.blobToKzgCommitment(blob)
|
|
117
|
+
* return commitment
|
|
118
|
+
* }).pipe(Effect.provide(KZGLive))
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @since 0.0.1
|
|
122
|
+
* @see {@link KZGTest} for unit testing
|
|
123
|
+
*/
|
|
124
|
+
declare const KZGLive: Layer.Layer<KZGService, never, never>;
|
|
125
|
+
/**
|
|
126
|
+
* Test layer for KZGService returning deterministic mock values.
|
|
127
|
+
*
|
|
128
|
+
* @description
|
|
129
|
+
* Provides mock implementations for unit testing. Returns zero-filled
|
|
130
|
+
* arrays for commitments/proofs and always verifies as true.
|
|
131
|
+
* Use when testing application logic without cryptographic overhead.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* import { KZGService, KZGTest, blobToKzgCommitment } from 'voltaire-effect/crypto/KZG'
|
|
136
|
+
* import * as Effect from 'effect/Effect'
|
|
137
|
+
*
|
|
138
|
+
* const testProgram = blobToKzgCommitment(blob).pipe(Effect.provide(KZGTest))
|
|
139
|
+
* // Returns Uint8Array(48) filled with zeros
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @since 0.0.1
|
|
143
|
+
*/
|
|
144
|
+
declare const KZGTest: Layer.Layer<KZGService, never, never>;
|
|
145
|
+
|
|
146
|
+
export { KZGService as K, KZGError as a, KZGLive as b, type KZGServiceShape as c, KZGTest as d };
|
|
@@ -13,6 +13,7 @@ import * as Context from 'effect/Context';
|
|
|
13
13
|
import * as effect_Cause from 'effect/Cause';
|
|
14
14
|
import * as effect_Types from 'effect/Types';
|
|
15
15
|
import { SignatureError as SignatureError$1, InvalidScalarError } from '@tevm/voltaire/Bls12381';
|
|
16
|
+
import { K as KZGService, a as KZGError } from './KZGService-B7PJerOb.js';
|
|
16
17
|
import { InvalidSecretKeyError, Ed25519Error, InvalidSignatureError as InvalidSignatureError$1, InvalidPublicKeyError as InvalidPublicKeyError$2 } from '@tevm/voltaire/Ed25519';
|
|
17
18
|
import { HexType } from '@tevm/voltaire/Hex';
|
|
18
19
|
import { HMACType } from '@tevm/voltaire/HMAC';
|
|
@@ -3004,144 +3005,6 @@ declare const P256Service_base: Context.TagClass<P256Service, "P256Service", P25
|
|
|
3004
3005
|
declare class P256Service extends P256Service_base {
|
|
3005
3006
|
}
|
|
3006
3007
|
|
|
3007
|
-
declare const KZGError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
3008
|
-
readonly _tag: "KZGError";
|
|
3009
|
-
} & Readonly<A>;
|
|
3010
|
-
/**
|
|
3011
|
-
* Error thrown when a KZG operation fails.
|
|
3012
|
-
*
|
|
3013
|
-
* @description
|
|
3014
|
-
* Contains the operation that failed, error code, message, and optional cause.
|
|
3015
|
-
*
|
|
3016
|
-
* Common failure reasons:
|
|
3017
|
-
* - Trusted setup not loaded (SETUP_NOT_LOADED)
|
|
3018
|
-
* - Invalid blob size or format (INVALID_BLOB)
|
|
3019
|
-
* - Invalid commitment format (INVALID_COMMITMENT)
|
|
3020
|
-
* - Invalid proof format (INVALID_PROOF)
|
|
3021
|
-
* - Verification failure
|
|
3022
|
-
*
|
|
3023
|
-
* @since 0.0.1
|
|
3024
|
-
*/
|
|
3025
|
-
declare class KZGError extends KZGError_base<{
|
|
3026
|
-
/** Error code for programmatic handling */
|
|
3027
|
-
readonly code: "SETUP_NOT_LOADED" | "INVALID_BLOB" | "INVALID_COMMITMENT" | "INVALID_PROOF" | "OPERATION_FAILED";
|
|
3028
|
-
/** The KZG operation that failed */
|
|
3029
|
-
readonly operation: "blobToKzgCommitment" | "computeBlobKzgProof" | "verifyBlobKzgProof" | "loadTrustedSetup" | "isInitialized";
|
|
3030
|
-
/** Human-readable error message */
|
|
3031
|
-
readonly message: string;
|
|
3032
|
-
/** Underlying error that caused this failure */
|
|
3033
|
-
readonly cause?: unknown;
|
|
3034
|
-
}> {
|
|
3035
|
-
}
|
|
3036
|
-
/**
|
|
3037
|
-
* Shape interface for KZG commitment service operations.
|
|
3038
|
-
*
|
|
3039
|
-
* @description
|
|
3040
|
-
* Defines the contract for KZG implementations. Operations require the trusted
|
|
3041
|
-
* setup to be loaded first via loadTrustedSetup().
|
|
3042
|
-
*
|
|
3043
|
-
* @since 0.0.1
|
|
3044
|
-
*/
|
|
3045
|
-
interface KZGServiceShape {
|
|
3046
|
-
/**
|
|
3047
|
-
* Computes a KZG commitment for a blob.
|
|
3048
|
-
* @param blob - The 128KB blob data
|
|
3049
|
-
* @returns Effect containing the 48-byte commitment, or KZGError if operation fails
|
|
3050
|
-
*/
|
|
3051
|
-
readonly blobToKzgCommitment: (blob: KzgBlobType) => Effect.Effect<KzgCommitmentType, KZGError>;
|
|
3052
|
-
/**
|
|
3053
|
-
* Computes a KZG proof for a blob and commitment.
|
|
3054
|
-
* @param blob - The 128KB blob data
|
|
3055
|
-
* @param commitment - The 48-byte commitment
|
|
3056
|
-
* @returns Effect containing the 48-byte proof, or KZGError if operation fails
|
|
3057
|
-
*/
|
|
3058
|
-
readonly computeBlobKzgProof: (blob: KzgBlobType, commitment: KzgCommitmentType) => Effect.Effect<KzgProofType, KZGError>;
|
|
3059
|
-
/**
|
|
3060
|
-
* Verifies a KZG proof against a blob and commitment.
|
|
3061
|
-
* @param blob - The 128KB blob data
|
|
3062
|
-
* @param commitment - The 48-byte commitment
|
|
3063
|
-
* @param proof - The 48-byte proof
|
|
3064
|
-
* @returns Effect containing true if proof is valid, or KZGError if operation fails
|
|
3065
|
-
*/
|
|
3066
|
-
readonly verifyBlobKzgProof: (blob: KzgBlobType, commitment: KzgCommitmentType, proof: KzgProofType) => Effect.Effect<boolean, KZGError>;
|
|
3067
|
-
/**
|
|
3068
|
-
* Loads the trusted setup for KZG operations.
|
|
3069
|
-
* @returns Effect that completes when setup is loaded, or KZGError if loading fails
|
|
3070
|
-
*/
|
|
3071
|
-
readonly loadTrustedSetup: () => Effect.Effect<void, KZGError>;
|
|
3072
|
-
/**
|
|
3073
|
-
* Checks if the trusted setup has been initialized.
|
|
3074
|
-
* @returns Effect containing true if initialized, or KZGError if check fails
|
|
3075
|
-
*/
|
|
3076
|
-
readonly isInitialized: () => Effect.Effect<boolean, KZGError>;
|
|
3077
|
-
}
|
|
3078
|
-
declare const KZGService_base: Context.TagClass<KZGService, "KZGService", KZGServiceShape>;
|
|
3079
|
-
/**
|
|
3080
|
-
* KZG polynomial commitment service for Effect-based applications.
|
|
3081
|
-
* Implements EIP-4844 blob commitments for Ethereum proto-danksharding.
|
|
3082
|
-
*
|
|
3083
|
-
* @example
|
|
3084
|
-
* ```typescript
|
|
3085
|
-
* import { KZGService, KZGLive } from 'voltaire-effect/crypto'
|
|
3086
|
-
* import * as Effect from 'effect/Effect'
|
|
3087
|
-
*
|
|
3088
|
-
* const program = Effect.gen(function* () {
|
|
3089
|
-
* const kzg = yield* KZGService
|
|
3090
|
-
* yield* kzg.loadTrustedSetup()
|
|
3091
|
-
* const commitment = yield* kzg.blobToKzgCommitment(blob)
|
|
3092
|
-
* const proof = yield* kzg.computeBlobKzgProof(blob, commitment)
|
|
3093
|
-
* return yield* kzg.verifyBlobKzgProof(blob, commitment, proof)
|
|
3094
|
-
* }).pipe(Effect.provide(KZGLive))
|
|
3095
|
-
* ```
|
|
3096
|
-
* @since 0.0.1
|
|
3097
|
-
*/
|
|
3098
|
-
declare class KZGService extends KZGService_base {
|
|
3099
|
-
}
|
|
3100
|
-
/**
|
|
3101
|
-
* Production layer for KZGService using native KZG implementation.
|
|
3102
|
-
*
|
|
3103
|
-
* @description
|
|
3104
|
-
* Provides real KZG operations using the c-kzg-4844 library with Ethereum's
|
|
3105
|
-
* trusted setup. The trusted setup must be loaded before other operations.
|
|
3106
|
-
*
|
|
3107
|
-
* @example
|
|
3108
|
-
* ```typescript
|
|
3109
|
-
* import { KZGService, KZGLive } from 'voltaire-effect/crypto/KZG'
|
|
3110
|
-
* import * as Effect from 'effect/Effect'
|
|
3111
|
-
*
|
|
3112
|
-
* const program = Effect.gen(function* () {
|
|
3113
|
-
* const kzg = yield* KZGService
|
|
3114
|
-
* yield* kzg.loadTrustedSetup()
|
|
3115
|
-
* const commitment = yield* kzg.blobToKzgCommitment(blob)
|
|
3116
|
-
* return commitment
|
|
3117
|
-
* }).pipe(Effect.provide(KZGLive))
|
|
3118
|
-
* ```
|
|
3119
|
-
*
|
|
3120
|
-
* @since 0.0.1
|
|
3121
|
-
* @see {@link KZGTest} for unit testing
|
|
3122
|
-
*/
|
|
3123
|
-
declare const KZGLive: Layer.Layer<KZGService, never, never>;
|
|
3124
|
-
/**
|
|
3125
|
-
* Test layer for KZGService returning deterministic mock values.
|
|
3126
|
-
*
|
|
3127
|
-
* @description
|
|
3128
|
-
* Provides mock implementations for unit testing. Returns zero-filled
|
|
3129
|
-
* arrays for commitments/proofs and always verifies as true.
|
|
3130
|
-
* Use when testing application logic without cryptographic overhead.
|
|
3131
|
-
*
|
|
3132
|
-
* @example
|
|
3133
|
-
* ```typescript
|
|
3134
|
-
* import { KZGService, KZGTest, blobToKzgCommitment } from 'voltaire-effect/crypto/KZG'
|
|
3135
|
-
* import * as Effect from 'effect/Effect'
|
|
3136
|
-
*
|
|
3137
|
-
* const testProgram = blobToKzgCommitment(blob).pipe(Effect.provide(KZGTest))
|
|
3138
|
-
* // Returns Uint8Array(48) filled with zeros
|
|
3139
|
-
* ```
|
|
3140
|
-
*
|
|
3141
|
-
* @since 0.0.1
|
|
3142
|
-
*/
|
|
3143
|
-
declare const KZGTest: Layer.Layer<KZGService, never, never>;
|
|
3144
|
-
|
|
3145
3008
|
/**
|
|
3146
3009
|
* @fileoverview KeystoreService Effect service definition for keystore encryption.
|
|
3147
3010
|
* @module Keystore/KeystoreService
|
|
@@ -5349,4 +5212,4 @@ declare const X25519Live: Layer.Layer<X25519Service, never, never>;
|
|
|
5349
5212
|
*/
|
|
5350
5213
|
declare const X25519Test: Layer.Layer<X25519Service, never, never>;
|
|
5351
5214
|
|
|
5352
|
-
export {
|
|
5215
|
+
export { g2Mul as $, AddressDerivationError as A, Bip39Service as B, ChaCha20Poly1305Service as C, Blake2Live as D, EIP712Service as E, Blake2Test as F, hash$2 as G, HMACService as H, aggregate as I, Bls12381Live as J, KeystoreService as K, type Bls12381ServiceShape as L, sign$2 as M, verify$2 as N, Bn254Error as O, P256Service as P, Bn254Live as Q, Ripemd160Service as R, SHA256Service as S, type Bn254ServiceShape as T, Bn254Test as U, VerifyError as V, g1Add as W, g1Generator as X, g1Mul as Y, g2Add as Z, g2Generator as _, Blake2Service as a, type ModExpServiceShape as a$, pairingCheck as a0, ChaCha20Poly1305Live as a1, type ChaCha20Poly1305ServiceShape as a2, ChaCha20Poly1305Test as a3, decrypt$1 as a4, encrypt$1 as a5, generateKey as a6, generateNonce as a7, Ed25519Live as a8, type Ed25519ServiceShape as a9, type HDWalletServiceShape as aA, HDWalletTest as aB, InvalidKeyError as aC, InvalidPathError as aD, InvalidSeedError as aE, mnemonicToSeed as aF, withPrivateKey as aG, withSeed as aH, HMACLive as aI, type HMACServiceShape as aJ, HMACTest as aK, hmacSha256 as aL, hmacSha512 as aM, hash$3 as aN, type DecryptError as aO, decrypt as aP, encrypt as aQ, KeystoreLive as aR, type KeystoreServiceShape as aS, KeystoreTest as aT, withDecryptedKey as aU, blobToKzgCommitment as aV, computeBlobKzgProof as aW, verifyBlobKzgProof as aX, calculateGas as aY, ModExpLive as aZ, ModExpService as a_, Ed25519Test as aa, getPublicKey$2 as ab, sign$1 as ac, verify$1 as ad, EIP712Live as ae, type EIP712ServiceShape as af, EIP712Test as ag, hashDomain as ah, hashStruct as ai, hashTypedData as aj, recoverAddress$1 as ak, signTypedData as al, verifyTypedData as am, unwrapSignature as an, verifySignature as ao, wrapSignature as ap, derive as aq, fromMnemonic as ar, fromSeed as as, generateMnemonic as at, getPrivateKey as au, getPublicKey$1 as av, HardenedDerivationError as aw, type HDNode as ax, type HDPath as ay, type HDWalletError as az, Bls12381Service as b, ModExpTest as b0, modexp as b1, modexpBytes as b2, P256Live as b3, type P256ServiceShape as b4, sign as b5, verify as b6, hash$1 as b7, Ripemd160Live as b8, Ripemd160Test as b9, hash as ba, SHA256Live as bb, SHA256Test as bc, recoverAddress as bd, type SignatureError as be, computeSecret as bf, generateKeyPair as bg, getPublicKey as bh, X25519Live as bi, X25519Service as bj, type X25519ServiceShape as bk, X25519Test as bl, recover as bm, Secp256k1Live as bn, Secp256k1Test as bo, sign$3 as bp, verify$3 as bq, type MnemonicStrength as br, WORD_COUNTS as bs, type ChaCha20Poly1305Error as bt, InvalidKeyError$1 as bu, InvalidNonceError as bv, mapToHDWalletError as bw, Bn254Service as c, Ed25519Service as d, HDWalletService as e, CryptoLive as f, CryptoTest as g, type SignatureInput as h, index as i, RecoverError as j, AesGcmLive as k, AesGcmService as l, type AesGcmServiceShape as m, AesGcmTest as n, decrypt$2 as o, encrypt$2 as p, generateKey$1 as q, generateNonce$1 as r, Bip39Live as s, type Bip39ServiceShape as t, Bip39Test as u, generateMnemonic$1 as v, getWordCount as w, mnemonicToSeed$1 as x, mnemonicToSeedSync as y, validateMnemonic as z };
|
package/dist/crypto/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { h as SignatureInput, j as RecoverError, A as AddressDerivationError, V as VerifyError, E as EIP712Service } from '../X25519Test-C8Cicdd_.js';
|
|
2
|
+
export { k as AesGcmLive, l as AesGcmService, m as AesGcmServiceShape, n as AesGcmTest, s as Bip39Live, B as Bip39Service, t as Bip39ServiceShape, u as Bip39Test, D as Blake2Live, a as Blake2Service, F as Blake2Test, J as Bls12381Live, b as Bls12381Service, L as Bls12381ServiceShape, O as Bn254Error, Q as Bn254Live, c as Bn254Service, T as Bn254ServiceShape, U as Bn254Test, a1 as ChaCha20Poly1305Live, C as ChaCha20Poly1305Service, a2 as ChaCha20Poly1305ServiceShape, a3 as ChaCha20Poly1305Test, f as CryptoLive, g as CryptoTest, ae as EIP712Live, af as EIP712ServiceShape, ag as EIP712Test, a8 as Ed25519Live, d as Ed25519Service, a9 as Ed25519ServiceShape, aa as Ed25519Test, ax as HDNode, ay as HDPath, az as HDWalletError, e as HDWalletService, aA as HDWalletServiceShape, aB as HDWalletTest, aI as HMACLive, H as HMACService, aJ as HMACServiceShape, aK as HMACTest, aw as HardenedDerivationError, aC as InvalidKeyError, aD as InvalidPathError, aE as InvalidSeedError, aO as KeystoreDecryptError, aR as KeystoreLive, K as KeystoreService, aS as KeystoreServiceShape, aT as KeystoreTest, aZ as ModExpLive, a_ as ModExpService, a$ as ModExpServiceShape, b0 as ModExpTest, b3 as P256Live, P as P256Service, b4 as P256ServiceShape, b8 as Ripemd160Live, R as Ripemd160Service, b9 as Ripemd160Test, bb as SHA256Live, S as SHA256Service, bc as SHA256Test, bn as Secp256k1Live, bo as Secp256k1Test, be as SignatureError, bi as X25519Live, bj as X25519Service, bk as X25519ServiceShape, bl as X25519Test, o as aesGcmDecrypt, p as aesGcmEncrypt, q as aesGcmGenerateKey, r as aesGcmGenerateNonce, v as bip39GenerateMnemonic, x as bip39MnemonicToSeed, G as blake2Hash, aV as blobToKzgCommitment, I as bls12381Aggregate, M as bls12381Sign, N as bls12381Verify, a4 as chaCha20Poly1305Decrypt, a5 as chaCha20Poly1305Encrypt, a6 as chaCha20Poly1305GenerateKey, a7 as chaCha20Poly1305GenerateNonce, aW as computeBlobKzgProof, ab as ed25519GetPublicKey, ac as ed25519Sign, ad as ed25519Verify, ak as eip712RecoverAddress, an as erc6492UnwrapSignature, ao as erc6492VerifySignature, ap as erc6492WrapSignature, ar as fromMnemonic, as as fromSeed, W as g1Add, X as g1Generator, Y as g1Mul, Z as g2Add, _ as g2Generator, $ as g2Mul, at as generateMnemonic, w as getWordCount, ah as hashDomain, ai as hashStruct, aj as hashTypedData, aq as hdwalletDerive, au as hdwalletGetPrivateKey, av as hdwalletGetPublicKey, aG as hdwalletWithPrivateKey, aH as hdwalletWithSeed, aL as hmacSha256, aM as hmacSha512, aN as keccakHash, aP as keystoreDecrypt, aQ as keystoreEncrypt, aU as keystoreWithDecryptedKey, aF as mnemonicToSeed, y as mnemonicToSeedSync, b1 as modexp, b2 as modexpBytes, aY as modexpCalculateGas, b5 as p256Sign, b6 as p256Verify, a0 as pairingCheck, bm as recover, bd as recoverAddress, b7 as ripemd160Hash, ba as sha256Hash, bp as sign, al as signTypedData, aj as signatureHashTypedData, z as validateMnemonic, bq as verify, aX as verifyBlobKzgProof, am as verifyTypedData, bf as x25519ComputeSecret, bg as x25519GenerateKeyPair, bh as x25519GetPublicKey } from '../X25519Test-C8Cicdd_.js';
|
|
3
3
|
import { am as KeccakService } from '../AccountService-BetXokad.js';
|
|
4
4
|
export { an as KeccakLive, ao as KeccakTest } from '../AccountService-BetXokad.js';
|
|
5
5
|
import { Keccak256Hash } from '@tevm/voltaire';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
|
+
export { a as KZGError, b as KZGLive, K as KZGService, c as KZGServiceShape, d as KZGTest } from '../KZGService-B7PJerOb.js';
|
|
7
8
|
import { S as Secp256k1Service } from '../Secp256k1Service-OxQ6hJFp.js';
|
|
8
9
|
export { I as InvalidPrivateKeyError, a as InvalidPublicKeyError, b as InvalidRecoveryIdError, c as InvalidSignatureError, d as Secp256k1Error, e as Secp256k1Errors, f as Secp256k1ServiceShape, g as SignOptions, m as mapToSecp256k1Error } from '../Secp256k1Service-OxQ6hJFp.js';
|
|
9
10
|
import { AddressType } from '@tevm/voltaire/Address';
|