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,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module size
|
|
3
|
+
* @description Get bytecode size (pure)
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import { size as _size } from "@tevm/voltaire/Bytecode";
|
|
7
|
+
import type { BrandedBytecode } from "./types.js";
|
|
8
|
+
|
|
9
|
+
export const size = (code: BrandedBytecode): number => _size(code);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module stripMetadata
|
|
3
|
+
* @description Strip CBOR metadata from bytecode (pure)
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import { stripMetadata as _stripMetadata } from "@tevm/voltaire/Bytecode";
|
|
7
|
+
import type { BrandedBytecode } from "./types.js";
|
|
8
|
+
|
|
9
|
+
export const stripMetadata = (code: BrandedBytecode): BrandedBytecode =>
|
|
10
|
+
_stripMetadata(code);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module toAbi
|
|
3
|
+
* @description Extract ABI from bytecode (pure)
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import { toAbi as _toAbi } from "@tevm/voltaire/Bytecode";
|
|
7
|
+
import type { BrandedBytecode, BrandedAbi } from "./types.js";
|
|
8
|
+
|
|
9
|
+
export const toAbi = (bytecode: BrandedBytecode): BrandedAbi =>
|
|
10
|
+
_toAbi(bytecode);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module toHex
|
|
3
|
+
* @description Convert bytecode to hex string (pure)
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import { toHex as _toHex } from "@tevm/voltaire/Bytecode";
|
|
7
|
+
import type { BrandedBytecode } from "./types.js";
|
|
8
|
+
|
|
9
|
+
export const toHex = (code: BrandedBytecode, prefix?: boolean): string =>
|
|
10
|
+
_toHex(code, prefix);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module types
|
|
3
|
+
* @description Bytecode type re-exports
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
Analysis,
|
|
9
|
+
BasicBlock,
|
|
10
|
+
BlockAnalysisOptions,
|
|
11
|
+
GasAnalysis,
|
|
12
|
+
GasAnalysisOptions,
|
|
13
|
+
Instruction,
|
|
14
|
+
PrettyPrintOptions,
|
|
15
|
+
ScanOptions,
|
|
16
|
+
StackAnalysis,
|
|
17
|
+
StackAnalysisOptions,
|
|
18
|
+
BrandedAbi,
|
|
19
|
+
} from "@tevm/voltaire/Bytecode";
|
|
20
|
+
|
|
21
|
+
// Use loose type to avoid brand symbol issues
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
export type BrandedBytecode = any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module validate
|
|
3
|
+
* @description Validate bytecode structure (pure)
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import { validate as _validate } from "@tevm/voltaire/Bytecode";
|
|
7
|
+
import type { BrandedBytecode } from "./types.js";
|
|
8
|
+
|
|
9
|
+
export const validate = (code: BrandedBytecode): boolean => _validate(code);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { describe, expect, it } from "@effect/vitest";
|
|
2
|
+
import { Effect, Exit } from "effect";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import * as Ens from "./index.js";
|
|
5
|
+
|
|
6
|
+
describe("Ens.EnsSchema", () => {
|
|
7
|
+
it("validates ENS name", () => {
|
|
8
|
+
const name = Schema.decodeSync(Ens.EnsSchema)("vitalik.eth");
|
|
9
|
+
expect(typeof name).toBe("string");
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
describe("Ens.from", () => {
|
|
14
|
+
it("creates EnsType from string", async () => {
|
|
15
|
+
const name = await Effect.runPromise(Ens.from("vitalik.eth"));
|
|
16
|
+
expect(typeof name).toBe("string");
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe("Ens.normalize", () => {
|
|
21
|
+
it("normalizes ENS name", async () => {
|
|
22
|
+
const normalized = await Effect.runPromise(Ens.normalize("VITALIK.ETH"));
|
|
23
|
+
expect(normalized.toLowerCase()).toBe("vitalik.eth");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe("Ens.beautify", () => {
|
|
28
|
+
it("beautifies ENS name", async () => {
|
|
29
|
+
const beautified = await Effect.runPromise(Ens.beautify("vitalik.eth"));
|
|
30
|
+
expect(typeof beautified).toBe("string");
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe("Ens.namehash", () => {
|
|
35
|
+
it("computes namehash", async () => {
|
|
36
|
+
const hash = await Effect.runPromise(Ens.namehash("eth"));
|
|
37
|
+
expect(hash).toBeInstanceOf(Uint8Array);
|
|
38
|
+
expect(hash.length).toBe(32);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe("Ens.labelhash", () => {
|
|
43
|
+
it("computes labelhash", async () => {
|
|
44
|
+
const hash = await Effect.runPromise(Ens.labelhash("vitalik"));
|
|
45
|
+
expect(hash).toBeInstanceOf(Uint8Array);
|
|
46
|
+
expect(hash.length).toBe(32);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe("Ens.validation", () => {
|
|
51
|
+
it("isValid returns true for valid names", () => {
|
|
52
|
+
expect(Ens.isValid("vitalik.eth")).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("isValid returns false for invalid names", () => {
|
|
56
|
+
expect(Ens.isValid("")).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("validate succeeds for valid names", async () => {
|
|
60
|
+
const result = await Effect.runPromiseExit(Ens.validate("vitalik.eth"));
|
|
61
|
+
expect(Exit.isSuccess(result)).toBe(true);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe("Ens.toString", () => {
|
|
66
|
+
it("converts to string", async () => {
|
|
67
|
+
const name = await Effect.runPromise(Ens.from("vitalik.eth"));
|
|
68
|
+
const str = Ens.toString(name);
|
|
69
|
+
expect(str).toBe("vitalik.eth");
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module convert
|
|
3
|
+
* @description Pure ENS conversion functions
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import { Ens } from "@tevm/voltaire";
|
|
7
|
+
import type { EnsType } from "./String.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Convert ENS name to string
|
|
11
|
+
*/
|
|
12
|
+
// biome-ignore lint/suspicious/noShadowRestrictedNames: intentional API name
|
|
13
|
+
export const toString = (name: EnsType): string => Ens.toString(name);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module from
|
|
3
|
+
* @description Effect-wrapped ENS constructor
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import { Effect } from "effect";
|
|
7
|
+
import { Ens } from "@tevm/voltaire";
|
|
8
|
+
import type { EnsType } from "./String.js";
|
|
9
|
+
|
|
10
|
+
type EnsError =
|
|
11
|
+
| Ens.DisallowedCharacterError
|
|
12
|
+
| Ens.EmptyLabelError
|
|
13
|
+
| Ens.IllegalMixtureError
|
|
14
|
+
| Ens.InvalidLabelExtensionError
|
|
15
|
+
| Ens.InvalidUtf8Error
|
|
16
|
+
| Ens.WholeConfusableError;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create ENS name from string
|
|
20
|
+
*
|
|
21
|
+
* @param name - ENS name string
|
|
22
|
+
* @returns Effect yielding EnsType or failing with EnsError
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const ens = await Effect.runPromise(Ens.from('vitalik.eth'))
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export const from = (name: string): Effect.Effect<EnsType, EnsError> =>
|
|
29
|
+
Effect.try({
|
|
30
|
+
try: () => Ens.from(name),
|
|
31
|
+
catch: (e) => e as EnsError,
|
|
32
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module hash
|
|
3
|
+
* @description Effect-wrapped ENS hash operations
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import { Effect } from "effect";
|
|
7
|
+
import { Ens } from "@tevm/voltaire";
|
|
8
|
+
|
|
9
|
+
type EnsError =
|
|
10
|
+
| Ens.DisallowedCharacterError
|
|
11
|
+
| Ens.EmptyLabelError
|
|
12
|
+
| Ens.IllegalMixtureError
|
|
13
|
+
| Ens.InvalidLabelExtensionError
|
|
14
|
+
| Ens.InvalidUtf8Error
|
|
15
|
+
| Ens.WholeConfusableError;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Compute namehash of ENS name (32-byte hash for contracts)
|
|
19
|
+
*
|
|
20
|
+
* @param name - ENS name to hash
|
|
21
|
+
* @returns Effect yielding 32-byte hash
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const hash = await Effect.runPromise(Ens.namehash('vitalik.eth'))
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export const namehash = (name: string): Effect.Effect<Uint8Array, EnsError> =>
|
|
28
|
+
Effect.try({
|
|
29
|
+
try: () => Ens.namehash(name),
|
|
30
|
+
catch: (e) => e as EnsError,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Compute labelhash of single ENS label
|
|
35
|
+
*
|
|
36
|
+
* @param label - Single ENS label to hash
|
|
37
|
+
* @returns Effect yielding 32-byte hash
|
|
38
|
+
*/
|
|
39
|
+
export const labelhash = (label: string): Effect.Effect<Uint8Array, EnsError> =>
|
|
40
|
+
Effect.try({
|
|
41
|
+
try: () => Ens.labelhash(label),
|
|
42
|
+
catch: (e) => e as EnsError,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Re-export factories for advanced usage
|
|
46
|
+
export { Labelhash, Namehash } from "@tevm/voltaire/Ens";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* @module Ens
|
|
3
|
+
* @description Effect-based operations for Ethereum Name Service names.
|
|
4
4
|
*
|
|
5
5
|
* ## Type Declarations
|
|
6
6
|
*
|
|
@@ -12,7 +12,89 @@
|
|
|
12
12
|
* }
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* ## Schemas
|
|
16
|
+
*
|
|
17
|
+
* | Schema | Input | Output |
|
|
18
|
+
* |--------|-------|--------|
|
|
19
|
+
* | `Ens.EnsSchema` | string | EnsType |
|
|
20
|
+
*
|
|
21
|
+
* ## Constructors (Effect-wrapped)
|
|
22
|
+
*
|
|
23
|
+
* ```typescript
|
|
24
|
+
* Ens.from(name) // Effect<EnsType, EnsError>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* ## Normalization (Effect-wrapped)
|
|
28
|
+
*
|
|
29
|
+
* ```typescript
|
|
30
|
+
* Ens.normalize(name) // Effect<EnsType, EnsError>
|
|
31
|
+
* Ens.beautify(name) // Effect<EnsType, EnsError>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* ## Hashing (Effect-wrapped)
|
|
35
|
+
*
|
|
36
|
+
* ```typescript
|
|
37
|
+
* Ens.namehash(name) // Effect<Uint8Array, EnsError>
|
|
38
|
+
* Ens.labelhash(label) // Effect<Uint8Array, EnsError>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* ## Validation
|
|
42
|
+
*
|
|
43
|
+
* ```typescript
|
|
44
|
+
* Ens.isValid(name) // boolean (pure)
|
|
45
|
+
* Ens.is(value) // type guard (pure)
|
|
46
|
+
* Ens.validate(name) // Effect<void, EnsError>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* ## Conversion (Pure)
|
|
50
|
+
*
|
|
51
|
+
* ```typescript
|
|
52
|
+
* Ens.toString(ens) // string
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import * as Ens from 'voltaire-effect/primitives/Ens'
|
|
58
|
+
* import { Effect } from 'effect'
|
|
59
|
+
*
|
|
60
|
+
* const program = Effect.gen(function* () {
|
|
61
|
+
* yield* Ens.validate('vitalik.eth')
|
|
62
|
+
* const normalized = yield* Ens.normalize('VITALIK.eth')
|
|
63
|
+
* const hash = yield* Ens.namehash(normalized)
|
|
64
|
+
* return { name: normalized, hash }
|
|
65
|
+
* })
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
16
68
|
* @since 0.0.1
|
|
17
69
|
*/
|
|
18
|
-
|
|
70
|
+
|
|
71
|
+
// Types
|
|
72
|
+
export type { EnsType } from "./String.js";
|
|
73
|
+
|
|
74
|
+
// Errors (re-export from voltaire)
|
|
75
|
+
export {
|
|
76
|
+
DisallowedCharacterError,
|
|
77
|
+
EmptyLabelError,
|
|
78
|
+
IllegalMixtureError,
|
|
79
|
+
InvalidLabelExtensionError,
|
|
80
|
+
InvalidUtf8Error,
|
|
81
|
+
WholeConfusableError,
|
|
82
|
+
} from "@tevm/voltaire/Ens";
|
|
83
|
+
|
|
84
|
+
// Schemas
|
|
85
|
+
export { EnsSchema } from "./String.js";
|
|
86
|
+
|
|
87
|
+
// Constructors (Effect-wrapped)
|
|
88
|
+
export { from } from "./from.js";
|
|
89
|
+
|
|
90
|
+
// Normalization (Effect-wrapped)
|
|
91
|
+
export { normalize, beautify } from "./normalize.js";
|
|
92
|
+
|
|
93
|
+
// Hashing (Effect-wrapped)
|
|
94
|
+
export { namehash, labelhash, Labelhash, Namehash } from "./hash.js";
|
|
95
|
+
|
|
96
|
+
// Validation
|
|
97
|
+
export { isValid, is, validate } from "./validation.js";
|
|
98
|
+
|
|
99
|
+
// Conversion (Pure)
|
|
100
|
+
export { toString } from "./convert.js";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module normalize
|
|
3
|
+
* @description Effect-wrapped ENS normalization
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import { Effect } from "effect";
|
|
7
|
+
import { Ens } from "@tevm/voltaire";
|
|
8
|
+
import type { EnsType } from "./String.js";
|
|
9
|
+
|
|
10
|
+
type EnsError =
|
|
11
|
+
| Ens.DisallowedCharacterError
|
|
12
|
+
| Ens.EmptyLabelError
|
|
13
|
+
| Ens.IllegalMixtureError
|
|
14
|
+
| Ens.InvalidLabelExtensionError
|
|
15
|
+
| Ens.InvalidUtf8Error
|
|
16
|
+
| Ens.WholeConfusableError;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Normalize ENS name per ENSIP-15
|
|
20
|
+
*
|
|
21
|
+
* @param name - ENS name to normalize
|
|
22
|
+
* @returns Effect yielding normalized EnsType
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const normalized = await Effect.runPromise(Ens.normalize('Vitalik.ETH'))
|
|
26
|
+
* // 'vitalik.eth'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export const normalize = (name: string): Effect.Effect<EnsType, EnsError> =>
|
|
30
|
+
Effect.try({
|
|
31
|
+
try: () => Ens.normalize(name),
|
|
32
|
+
catch: (e) => e as EnsError,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Beautify ENS name for display
|
|
37
|
+
*
|
|
38
|
+
* @param name - ENS name to beautify
|
|
39
|
+
* @returns Effect yielding beautified EnsType
|
|
40
|
+
*/
|
|
41
|
+
export const beautify = (name: string): Effect.Effect<EnsType, EnsError> =>
|
|
42
|
+
Effect.try({
|
|
43
|
+
try: () => Ens.beautify(name),
|
|
44
|
+
catch: (e) => e as EnsError,
|
|
45
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module validation
|
|
3
|
+
* @description ENS validation functions
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import { Effect } from "effect";
|
|
7
|
+
import { Ens } from "@tevm/voltaire";
|
|
8
|
+
import type { EnsType } from "./String.js";
|
|
9
|
+
|
|
10
|
+
type EnsError =
|
|
11
|
+
| Ens.DisallowedCharacterError
|
|
12
|
+
| Ens.EmptyLabelError
|
|
13
|
+
| Ens.IllegalMixtureError
|
|
14
|
+
| Ens.InvalidLabelExtensionError
|
|
15
|
+
| Ens.InvalidUtf8Error
|
|
16
|
+
| Ens.WholeConfusableError;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Check if value is valid ENS name (pure)
|
|
20
|
+
*/
|
|
21
|
+
export const isValid = (name: string): boolean => Ens.isValid(name);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Type guard for EnsType
|
|
25
|
+
*/
|
|
26
|
+
export const is = (value: unknown): value is EnsType => Ens.is(value);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Validate ENS name, throwing on error
|
|
30
|
+
*
|
|
31
|
+
* @param name - ENS name to validate
|
|
32
|
+
* @returns Effect that succeeds if valid, fails with EnsError if invalid
|
|
33
|
+
*/
|
|
34
|
+
export const validate = (name: string): Effect.Effect<void, EnsError> =>
|
|
35
|
+
Effect.try({
|
|
36
|
+
try: () => Ens.validate(name),
|
|
37
|
+
catch: (e) => e as EnsError,
|
|
38
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module accessors
|
|
3
|
+
* @description Pure EventLog accessor functions
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import * as EventLog from "@tevm/voltaire/EventLog";
|
|
7
|
+
import type { EventLogType } from "@tevm/voltaire/EventLog";
|
|
8
|
+
import type { HashType } from "@tevm/voltaire/Hash";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Get topic at index 0 (event signature)
|
|
12
|
+
*/
|
|
13
|
+
export const getTopic0 = (log: EventLogType): HashType | undefined =>
|
|
14
|
+
EventLog.getTopic0(log);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get event signature hash
|
|
18
|
+
*/
|
|
19
|
+
export const getSignature = (log: EventLogType): HashType | undefined =>
|
|
20
|
+
EventLog.getSignature(log);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get all indexed topics (topics 1-3)
|
|
24
|
+
*/
|
|
25
|
+
export const getIndexedTopics = (log: EventLogType): readonly HashType[] =>
|
|
26
|
+
EventLog.getIndexedTopics(log);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get indexed parameters (alias for getIndexedTopics)
|
|
30
|
+
*/
|
|
31
|
+
export const getIndexed = (log: EventLogType): readonly HashType[] =>
|
|
32
|
+
EventLog.getIndexed(log);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module clone
|
|
3
|
+
* @description Pure EventLog clone/copy functions
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import * as EventLog from "@tevm/voltaire/EventLog";
|
|
7
|
+
import type { EventLogType } from "@tevm/voltaire/EventLog";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Create deep clone of EventLog
|
|
11
|
+
*/
|
|
12
|
+
export const clone = (log: EventLogType): EventLogType => EventLog.clone(log);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Copy EventLog (alias for clone)
|
|
16
|
+
*/
|
|
17
|
+
export const copy = (log: EventLogType): EventLogType => EventLog.copy(log);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module create
|
|
3
|
+
* @description Effect-wrapped EventLog constructors
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import { Effect } from "effect";
|
|
7
|
+
import * as EventLog from "@tevm/voltaire/EventLog";
|
|
8
|
+
import type { EventLogType } from "@tevm/voltaire/EventLog";
|
|
9
|
+
import type { AddressType } from "@tevm/voltaire/Address";
|
|
10
|
+
import type { HashType } from "@tevm/voltaire/Hash";
|
|
11
|
+
|
|
12
|
+
interface EventLogInput {
|
|
13
|
+
address: AddressType;
|
|
14
|
+
topics: HashType[];
|
|
15
|
+
data: Uint8Array;
|
|
16
|
+
blockNumber?: bigint;
|
|
17
|
+
transactionHash?: HashType;
|
|
18
|
+
transactionIndex?: number;
|
|
19
|
+
blockHash?: HashType;
|
|
20
|
+
logIndex?: number;
|
|
21
|
+
removed?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Create EventLog from raw values
|
|
26
|
+
*
|
|
27
|
+
* @param input - EventLog data
|
|
28
|
+
* @returns Effect yielding EventLogType
|
|
29
|
+
*/
|
|
30
|
+
export const create = (input: EventLogInput): Effect.Effect<EventLogType, Error> =>
|
|
31
|
+
Effect.try({
|
|
32
|
+
try: () => EventLog.create(input),
|
|
33
|
+
catch: (e) => e as Error,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Create EventLog from various input formats
|
|
38
|
+
*
|
|
39
|
+
* @param input - EventLog data or compatible object
|
|
40
|
+
* @returns Effect yielding EventLogType
|
|
41
|
+
*/
|
|
42
|
+
export const from = (input: unknown): Effect.Effect<EventLogType, Error> =>
|
|
43
|
+
Effect.try({
|
|
44
|
+
try: () => EventLog.from(input as EventLogInput),
|
|
45
|
+
catch: (e) => e as Error,
|
|
46
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module filtering
|
|
3
|
+
* @description Pure EventLog filtering functions
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import * as EventLog from "@tevm/voltaire/EventLog";
|
|
7
|
+
import type { EventLogType } from "@tevm/voltaire/EventLog";
|
|
8
|
+
import type { AddressType } from "@tevm/voltaire/Address";
|
|
9
|
+
import type { HashType } from "@tevm/voltaire/Hash";
|
|
10
|
+
|
|
11
|
+
interface LogFilter {
|
|
12
|
+
address?: AddressType | AddressType[];
|
|
13
|
+
topics?: (HashType | HashType[] | null)[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Check if log matches given address
|
|
18
|
+
*/
|
|
19
|
+
export const matchesAddress = (
|
|
20
|
+
log: EventLogType,
|
|
21
|
+
address: AddressType | AddressType[],
|
|
22
|
+
): boolean => EventLog.matchesAddress(log, address);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Check if log matches topic filter
|
|
26
|
+
*/
|
|
27
|
+
export const matchesTopics = (
|
|
28
|
+
log: EventLogType,
|
|
29
|
+
topics: (HashType | HashType[] | null)[],
|
|
30
|
+
): boolean => EventLog.matchesTopics(log, topics);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Check if log matches full filter (address + topics)
|
|
34
|
+
*/
|
|
35
|
+
export const matchesFilter = (log: EventLogType, filter: LogFilter): boolean =>
|
|
36
|
+
EventLog.matchesFilter(log, filter);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Filter array of logs by filter criteria
|
|
40
|
+
*/
|
|
41
|
+
export const filterLogs = (logs: EventLogType[], filter: LogFilter): EventLogType[] =>
|
|
42
|
+
EventLog.filterLogs(logs, filter);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Sort logs by block number, transaction index, and log index
|
|
46
|
+
*/
|
|
47
|
+
export const sortLogs = (logs: EventLogType[]): EventLogType[] =>
|
|
48
|
+
EventLog.sortLogs(logs);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module EventLog
|
|
3
|
-
* @description
|
|
3
|
+
* @description Effect-based operations for EVM event logs.
|
|
4
4
|
*
|
|
5
5
|
* ## Type Declarations
|
|
6
6
|
*
|
|
@@ -12,12 +12,102 @@
|
|
|
12
12
|
* }
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
|
+
* ## Schemas
|
|
16
|
+
*
|
|
17
|
+
* | Schema | Input | Output |
|
|
18
|
+
* |--------|-------|--------|
|
|
19
|
+
* | `EventLog.Rpc` | RPC log object | EventLogType |
|
|
20
|
+
* | `EventLog.Schema` | RPC log object | EventLogType |
|
|
21
|
+
*
|
|
22
|
+
* ## Constructors (Effect-wrapped)
|
|
23
|
+
*
|
|
24
|
+
* ```typescript
|
|
25
|
+
* EventLog.create(input) // Effect<EventLogType, Error>
|
|
26
|
+
* EventLog.from(input) // Effect<EventLogType, Error>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* ## Accessors (Pure)
|
|
30
|
+
*
|
|
31
|
+
* ```typescript
|
|
32
|
+
* EventLog.getTopic0(log) // HashType | undefined
|
|
33
|
+
* EventLog.getSignature(log) // HashType | undefined
|
|
34
|
+
* EventLog.getIndexed(log) // readonly HashType[]
|
|
35
|
+
* EventLog.getIndexedTopics(log) // readonly HashType[]
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* ## Filtering (Pure)
|
|
39
|
+
*
|
|
40
|
+
* ```typescript
|
|
41
|
+
* EventLog.matchesAddress(log, address) // boolean
|
|
42
|
+
* EventLog.matchesTopics(log, topics) // boolean
|
|
43
|
+
* EventLog.matchesFilter(log, filter) // boolean
|
|
44
|
+
* EventLog.filterLogs(logs, filter) // EventLogType[]
|
|
45
|
+
* EventLog.sortLogs(logs) // EventLogType[]
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* ## Status (Pure)
|
|
49
|
+
*
|
|
50
|
+
* ```typescript
|
|
51
|
+
* EventLog.isRemoved(log) // boolean
|
|
52
|
+
* EventLog.wasRemoved(log) // boolean
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* ## Clone/Copy (Pure)
|
|
56
|
+
*
|
|
57
|
+
* ```typescript
|
|
58
|
+
* EventLog.clone(log) // EventLogType
|
|
59
|
+
* EventLog.copy(log) // EventLogType
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* ## Conversion (Pure)
|
|
63
|
+
*
|
|
64
|
+
* ```typescript
|
|
65
|
+
* EventLog.toRpc(log) // RpcLog
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* import * as EventLog from 'voltaire-effect/primitives/EventLog'
|
|
71
|
+
* import * as Schema from 'effect/Schema'
|
|
72
|
+
*
|
|
73
|
+
* const log = Schema.decodeSync(EventLog.Rpc)({
|
|
74
|
+
* address: '0x...',
|
|
75
|
+
* topics: ['0x...'],
|
|
76
|
+
* data: new Uint8Array(32),
|
|
77
|
+
* })
|
|
78
|
+
*
|
|
79
|
+
* const signature = EventLog.getSignature(log)
|
|
80
|
+
* const transfers = EventLog.filterLogs(logs, { topics: [transferTopic] })
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
15
83
|
* @since 0.0.1
|
|
16
84
|
*/
|
|
85
|
+
|
|
86
|
+
// Types
|
|
87
|
+
export type { EventLogType } from "@tevm/voltaire/EventLog";
|
|
88
|
+
|
|
89
|
+
// Schemas
|
|
17
90
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Schema,
|
|
91
|
+
EventLogSchema,
|
|
92
|
+
EventLogTypeSchema,
|
|
93
|
+
Rpc,
|
|
94
|
+
Schema,
|
|
23
95
|
} from "./Rpc.js";
|
|
96
|
+
|
|
97
|
+
// Constructors (Effect-wrapped)
|
|
98
|
+
export { create, from } from "./create.js";
|
|
99
|
+
|
|
100
|
+
// Accessors (Pure)
|
|
101
|
+
export { getTopic0, getSignature, getIndexed, getIndexedTopics } from "./accessors.js";
|
|
102
|
+
|
|
103
|
+
// Filtering (Pure)
|
|
104
|
+
export { matchesAddress, matchesTopics, matchesFilter, filterLogs, sortLogs } from "./filtering.js";
|
|
105
|
+
|
|
106
|
+
// Status (Pure)
|
|
107
|
+
export { isRemoved, wasRemoved } from "./status.js";
|
|
108
|
+
|
|
109
|
+
// Clone/Copy (Pure)
|
|
110
|
+
export { clone, copy } from "./clone.js";
|
|
111
|
+
|
|
112
|
+
// Conversion (Pure)
|
|
113
|
+
export { toRpc } from "./toRpc.js";
|