@apibara/beaconchain 2.0.1-beta.9 → 2.1.0-beta.2

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/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BytesFromUint8Array, StreamConfig } from '@apibara/protocol';
2
- import { B256 as B256$1, Address as Address$1, U256 as U256$1, U128 as U128$1, Signature as Signature$1, AccessListItem as AccessListItem$1 } from '@apibara/evm';
2
+ import { B256 as B256$1, Address as Address$1, U256 as U256$1, U128 as U128$1, AccessListItem as AccessListItem$1 } from '@apibara/evm';
3
3
  export { Address, B256, U128, U256 } from '@apibara/evm';
4
4
  import { Schema } from '@effect/schema';
5
5
  import { hexToBytes, pad } from 'viem';
@@ -1081,7 +1081,7 @@ const Transaction$1 = {
1081
1081
  writer.uint32(98).bytes(message.input);
1082
1082
  }
1083
1083
  if (message.signature !== void 0) {
1084
- Signature.encode(message.signature, writer.uint32(106).fork()).ldelim();
1084
+ Signature$1.encode(message.signature, writer.uint32(106).fork()).ldelim();
1085
1085
  }
1086
1086
  if (message.chainId !== void 0) {
1087
1087
  if (BigInt.asUintN(64, message.chainId) !== message.chainId) {
@@ -1200,7 +1200,7 @@ const Transaction$1 = {
1200
1200
  if (tag !== 106) {
1201
1201
  break;
1202
1202
  }
1203
- message.signature = Signature.decode(reader, reader.uint32());
1203
+ message.signature = Signature$1.decode(reader, reader.uint32());
1204
1204
  continue;
1205
1205
  case 14:
1206
1206
  if (tag !== 112) {
@@ -1254,7 +1254,7 @@ const Transaction$1 = {
1254
1254
  maxFeePerGas: isSet$1(object.maxFeePerGas) ? U128.fromJSON(object.maxFeePerGas) : void 0,
1255
1255
  maxPriorityFeePerGas: isSet$1(object.maxPriorityFeePerGas) ? U128.fromJSON(object.maxPriorityFeePerGas) : void 0,
1256
1256
  input: isSet$1(object.input) ? bytesFromBase64(object.input) : new Uint8Array(0),
1257
- signature: isSet$1(object.signature) ? Signature.fromJSON(object.signature) : void 0,
1257
+ signature: isSet$1(object.signature) ? Signature$1.fromJSON(object.signature) : void 0,
1258
1258
  chainId: isSet$1(object.chainId) ? BigInt(object.chainId) : void 0,
1259
1259
  accessList: globalThis.Array.isArray(object?.accessList) ? object.accessList.map((e) => AccessListItem.fromJSON(e)) : [],
1260
1260
  transactionType: isSet$1(object.transactionType) ? BigInt(object.transactionType) : BigInt("0"),
@@ -1301,7 +1301,7 @@ const Transaction$1 = {
1301
1301
  obj.input = base64FromBytes(message.input);
1302
1302
  }
1303
1303
  if (message.signature !== void 0) {
1304
- obj.signature = Signature.toJSON(message.signature);
1304
+ obj.signature = Signature$1.toJSON(message.signature);
1305
1305
  }
1306
1306
  if (message.chainId !== void 0) {
1307
1307
  obj.chainId = message.chainId.toString();
@@ -1337,7 +1337,7 @@ const Transaction$1 = {
1337
1337
  message.maxFeePerGas = object.maxFeePerGas !== void 0 && object.maxFeePerGas !== null ? U128.fromPartial(object.maxFeePerGas) : void 0;
1338
1338
  message.maxPriorityFeePerGas = object.maxPriorityFeePerGas !== void 0 && object.maxPriorityFeePerGas !== null ? U128.fromPartial(object.maxPriorityFeePerGas) : void 0;
1339
1339
  message.input = object.input ?? new Uint8Array(0);
1340
- message.signature = object.signature !== void 0 && object.signature !== null ? Signature.fromPartial(object.signature) : void 0;
1340
+ message.signature = object.signature !== void 0 && object.signature !== null ? Signature$1.fromPartial(object.signature) : void 0;
1341
1341
  message.chainId = object.chainId ?? void 0;
1342
1342
  message.accessList = object.accessList?.map((e) => AccessListItem.fromPartial(e)) || [];
1343
1343
  message.transactionType = object.transactionType ?? BigInt("0");
@@ -1948,7 +1948,7 @@ const ExecutionPayload$1 = {
1948
1948
  function createBaseSignature() {
1949
1949
  return { r: void 0, s: void 0 };
1950
1950
  }
1951
- const Signature = {
1951
+ const Signature$1 = {
1952
1952
  encode(message, writer = _m0.Writer.create()) {
1953
1953
  if (message.r !== void 0) {
1954
1954
  U256.encode(message.r, writer.uint32(10).fork()).ldelim();
@@ -2002,7 +2002,7 @@ const Signature = {
2002
2002
  return obj;
2003
2003
  },
2004
2004
  create(base) {
2005
- return Signature.fromPartial(base ?? {});
2005
+ return Signature$1.fromPartial(base ?? {});
2006
2006
  },
2007
2007
  fromPartial(object) {
2008
2008
  const message = createBaseSignature();
@@ -2139,7 +2139,7 @@ const data = {
2139
2139
  Block: Block$1,
2140
2140
  BlockHeader: BlockHeader$1,
2141
2141
  ExecutionPayload: ExecutionPayload$1,
2142
- Signature: Signature,
2142
+ Signature: Signature$1,
2143
2143
  Transaction: Transaction$1,
2144
2144
  Validator: Validator$1,
2145
2145
  protobufPackage: protobufPackage$1
@@ -2647,75 +2647,81 @@ const B384 = Schema.transform(B384Proto, _B384, {
2647
2647
  });
2648
2648
 
2649
2649
  const ExecutionPayload = Schema.Struct({
2650
- parentHash: Schema.optional(B256$1),
2651
- feeRecipient: Schema.optional(Address$1),
2652
- stateRoot: Schema.optional(B256$1),
2653
- receiptsRoot: Schema.optional(B256$1),
2650
+ parentHash: B256$1,
2651
+ feeRecipient: Address$1,
2652
+ stateRoot: B256$1,
2653
+ receiptsRoot: B256$1,
2654
2654
  logsBloom: BytesFromUint8Array,
2655
- prevRandao: Schema.optional(B256$1),
2656
- blockNumber: Schema.optional(Schema.BigIntFromSelf),
2657
- timestamp: Schema.optional(Schema.DateFromSelf)
2655
+ prevRandao: B256$1,
2656
+ blockNumber: Schema.BigIntFromSelf,
2657
+ timestamp: Schema.DateFromSelf
2658
2658
  });
2659
2659
  const BlockHeader = Schema.Struct({
2660
2660
  slot: Schema.BigIntFromSelf,
2661
2661
  proposerIndex: Schema.Number,
2662
- parentRoot: Schema.optional(B256$1),
2663
- stateRoot: Schema.optional(B256$1),
2662
+ parentRoot: B256$1,
2663
+ stateRoot: B256$1,
2664
2664
  randaoReveal: BytesFromUint8Array,
2665
- depositCount: Schema.optional(Schema.BigIntFromSelf),
2666
- depositRoot: Schema.optional(B256$1),
2667
- blockHash: Schema.optional(B256$1),
2668
- graffiti: Schema.optional(B256$1),
2665
+ depositCount: Schema.BigIntFromSelf,
2666
+ depositRoot: B256$1,
2667
+ blockHash: B256$1,
2668
+ graffiti: B256$1,
2669
2669
  executionPayload: Schema.optional(ExecutionPayload),
2670
- blobKzgCommitments: Schema.optional(Schema.Array(B384))
2670
+ blobKzgCommitments: Schema.Array(B384)
2671
2671
  });
2672
2672
  const Validator = Schema.Struct({
2673
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
2674
- validatorIndex: Schema.optional(Schema.Number),
2675
- balance: Schema.optional(Schema.BigIntFromSelf),
2676
- status: Schema.optional(ValidatorStatus),
2677
- pubkey: Schema.optional(B384),
2678
- withdrawalCredentials: Schema.optional(B256$1),
2679
- effectiveBalance: Schema.optional(Schema.BigIntFromSelf),
2680
- slashed: Schema.optional(Schema.Boolean),
2681
- activationEligibilityEpoch: Schema.optional(Schema.BigIntFromSelf),
2682
- activationEpoch: Schema.optional(Schema.BigIntFromSelf),
2683
- exitEpoch: Schema.optional(Schema.BigIntFromSelf),
2684
- withdrawableEpoch: Schema.optional(Schema.BigIntFromSelf)
2673
+ filterIds: Schema.Array(Schema.Number),
2674
+ validatorIndex: Schema.Number,
2675
+ balance: Schema.BigIntFromSelf,
2676
+ status: ValidatorStatus,
2677
+ pubkey: B384,
2678
+ withdrawalCredentials: B256$1,
2679
+ effectiveBalance: Schema.BigIntFromSelf,
2680
+ slashed: Schema.Boolean,
2681
+ activationEligibilityEpoch: Schema.BigIntFromSelf,
2682
+ activationEpoch: Schema.BigIntFromSelf,
2683
+ exitEpoch: Schema.BigIntFromSelf,
2684
+ withdrawableEpoch: Schema.BigIntFromSelf
2685
2685
  });
2686
2686
  const Blob = Schema.Struct({
2687
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
2688
- blobIndex: Schema.optional(Schema.Number),
2689
- blob: Schema.optional(Schema.Uint8ArrayFromSelf),
2690
- kzgCommitment: Schema.optional(B384),
2691
- kzgProof: Schema.optional(B384),
2692
- kzgCommitmentInclusionProof: Schema.optional(Schema.Array(B256$1)),
2693
- blobHash: Schema.optional(B256$1),
2694
- transactionIndex: Schema.optional(Schema.Number),
2695
- transactionHash: Schema.optional(B256$1)
2687
+ filterIds: Schema.Array(Schema.Number),
2688
+ blobIndex: Schema.Number,
2689
+ blob: Schema.Uint8ArrayFromSelf,
2690
+ kzgCommitment: B384,
2691
+ kzgProof: B384,
2692
+ kzgCommitmentInclusionProof: Schema.Array(B256$1),
2693
+ blobHash: B256$1,
2694
+ transactionIndex: Schema.Number,
2695
+ transactionHash: B256$1
2696
+ });
2697
+ const Signature = Schema.Struct({
2698
+ r: Schema.optional(U256$1),
2699
+ s: Schema.optional(U256$1),
2700
+ v: Schema.optional(U256$1),
2701
+ YParity: Schema.optional(Schema.Boolean)
2696
2702
  });
2697
2703
  const Transaction = Schema.Struct({
2698
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
2699
- transactionHash: Schema.optional(B256$1),
2700
- nonce: Schema.optional(Schema.BigIntFromSelf),
2701
- transactionIndex: Schema.optional(Schema.Number),
2702
- from: Schema.optional(Address$1),
2704
+ filterIds: Schema.Array(Schema.Number),
2705
+ transactionHash: B256$1,
2706
+ nonce: Schema.BigIntFromSelf,
2707
+ transactionIndex: Schema.Number,
2708
+ from: Address$1,
2703
2709
  to: Schema.optional(Address$1),
2704
- value: Schema.optional(U256$1),
2710
+ value: U256$1,
2705
2711
  gasPrice: Schema.optional(U128$1),
2706
2712
  gasLimit: Schema.optional(U128$1),
2707
2713
  maxFeePerGas: Schema.optional(U128$1),
2708
2714
  maxPriorityFeePerGas: Schema.optional(U128$1),
2709
- input: Schema.optional(Schema.Uint8ArrayFromSelf),
2710
- signature: Schema.optional(Signature$1),
2715
+ input: Schema.Uint8ArrayFromSelf,
2716
+ signature: Schema.optional(Signature),
2711
2717
  chainId: Schema.optional(Schema.BigIntFromSelf),
2712
- accessList: Schema.optional(Schema.Array(AccessListItem$1)),
2713
- transactionType: Schema.optional(Schema.BigIntFromSelf),
2718
+ accessList: Schema.Array(AccessListItem$1),
2719
+ transactionType: Schema.BigIntFromSelf,
2714
2720
  maxFeePerBlobGas: Schema.optional(U128$1),
2715
- blobVersionedHashes: Schema.optional(Schema.Array(B256$1))
2721
+ blobVersionedHashes: Schema.Array(B256$1)
2716
2722
  });
2717
2723
  const Block = Schema.Struct({
2718
- header: Schema.optional(BlockHeader),
2724
+ header: BlockHeader,
2719
2725
  validators: Schema.Array(Validator),
2720
2726
  blobs: Schema.Array(Blob),
2721
2727
  transactions: Schema.Array(Transaction)
@@ -2838,4 +2844,4 @@ const BeaconChainStream = new StreamConfig(
2838
2844
  mergeFilter
2839
2845
  );
2840
2846
 
2841
- export { B384, BeaconChainStream, Blob, BlobFilter, Block, BlockFromBytes, BlockHeader, ExecutionPayload, Filter, FilterFromBytes, HeaderFilter, Transaction, TransactionFilter, Validator, ValidatorFilter, ValidatorStatus, filterFromBytes, filterFromProto, filterToBytes, filterToProto, mergeFilter, index as proto };
2847
+ export { B384, BeaconChainStream, Blob, BlobFilter, Block, BlockFromBytes, BlockHeader, ExecutionPayload, Filter, FilterFromBytes, HeaderFilter, Signature, Transaction, TransactionFilter, Validator, ValidatorFilter, ValidatorStatus, filterFromBytes, filterFromProto, filterToBytes, filterToProto, mergeFilter, index as proto };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apibara/beaconchain",
3
- "version": "2.0.1-beta.9",
3
+ "version": "2.1.0-beta.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -35,8 +35,8 @@
35
35
  "vitest": "^1.6.0"
36
36
  },
37
37
  "dependencies": {
38
- "@apibara/evm": "2.0.1-beta.9",
39
- "@apibara/protocol": "2.0.0-beta.17",
38
+ "@apibara/evm": "2.1.0-beta.2",
39
+ "@apibara/protocol": "2.1.0-beta.2",
40
40
  "@effect/schema": "^0.67.15",
41
41
  "effect": "^3.2.6",
42
42
  "long": "^5.2.1",
package/src/block.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AccessListItem, Signature } from "@apibara/evm";
1
+ import { AccessListItem } from "@apibara/evm";
2
2
  import { BytesFromUint8Array } from "@apibara/protocol";
3
3
  import { Schema } from "@effect/schema";
4
4
 
@@ -6,14 +6,14 @@ import { Address, B256, B384, U128, U256, ValidatorStatus } from "./common";
6
6
  import * as proto from "./proto";
7
7
 
8
8
  export const ExecutionPayload = Schema.Struct({
9
- parentHash: Schema.optional(B256),
10
- feeRecipient: Schema.optional(Address),
11
- stateRoot: Schema.optional(B256),
12
- receiptsRoot: Schema.optional(B256),
9
+ parentHash: B256,
10
+ feeRecipient: Address,
11
+ stateRoot: B256,
12
+ receiptsRoot: B256,
13
13
  logsBloom: BytesFromUint8Array,
14
- prevRandao: Schema.optional(B256),
15
- blockNumber: Schema.optional(Schema.BigIntFromSelf),
16
- timestamp: Schema.optional(Schema.DateFromSelf),
14
+ prevRandao: B256,
15
+ blockNumber: Schema.BigIntFromSelf,
16
+ timestamp: Schema.DateFromSelf,
17
17
  });
18
18
 
19
19
  export type ExecutionPayload = typeof ExecutionPayload.Type;
@@ -21,71 +21,80 @@ export type ExecutionPayload = typeof ExecutionPayload.Type;
21
21
  export const BlockHeader = Schema.Struct({
22
22
  slot: Schema.BigIntFromSelf,
23
23
  proposerIndex: Schema.Number,
24
- parentRoot: Schema.optional(B256),
25
- stateRoot: Schema.optional(B256),
24
+ parentRoot: B256,
25
+ stateRoot: B256,
26
26
  randaoReveal: BytesFromUint8Array,
27
- depositCount: Schema.optional(Schema.BigIntFromSelf),
28
- depositRoot: Schema.optional(B256),
29
- blockHash: Schema.optional(B256),
30
- graffiti: Schema.optional(B256),
27
+ depositCount: Schema.BigIntFromSelf,
28
+ depositRoot: B256,
29
+ blockHash: B256,
30
+ graffiti: B256,
31
31
  executionPayload: Schema.optional(ExecutionPayload),
32
- blobKzgCommitments: Schema.optional(Schema.Array(B384)),
32
+ blobKzgCommitments: Schema.Array(B384),
33
33
  });
34
34
 
35
35
  export type BlockHeader = typeof BlockHeader.Type;
36
36
 
37
37
  export const Validator = Schema.Struct({
38
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
39
- validatorIndex: Schema.optional(Schema.Number),
40
- balance: Schema.optional(Schema.BigIntFromSelf),
41
- status: Schema.optional(ValidatorStatus),
42
- pubkey: Schema.optional(B384),
43
- withdrawalCredentials: Schema.optional(B256),
44
- effectiveBalance: Schema.optional(Schema.BigIntFromSelf),
45
- slashed: Schema.optional(Schema.Boolean),
46
- activationEligibilityEpoch: Schema.optional(Schema.BigIntFromSelf),
47
- activationEpoch: Schema.optional(Schema.BigIntFromSelf),
48
- exitEpoch: Schema.optional(Schema.BigIntFromSelf),
49
- withdrawableEpoch: Schema.optional(Schema.BigIntFromSelf),
38
+ filterIds: Schema.Array(Schema.Number),
39
+ validatorIndex: Schema.Number,
40
+ balance: Schema.BigIntFromSelf,
41
+ status: ValidatorStatus,
42
+ pubkey: B384,
43
+ withdrawalCredentials: B256,
44
+ effectiveBalance: Schema.BigIntFromSelf,
45
+ slashed: Schema.Boolean,
46
+ activationEligibilityEpoch: Schema.BigIntFromSelf,
47
+ activationEpoch: Schema.BigIntFromSelf,
48
+ exitEpoch: Schema.BigIntFromSelf,
49
+ withdrawableEpoch: Schema.BigIntFromSelf,
50
50
  });
51
51
 
52
52
  export const Blob = Schema.Struct({
53
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
54
- blobIndex: Schema.optional(Schema.Number),
55
- blob: Schema.optional(Schema.Uint8ArrayFromSelf),
56
- kzgCommitment: Schema.optional(B384),
57
- kzgProof: Schema.optional(B384),
58
- kzgCommitmentInclusionProof: Schema.optional(Schema.Array(B256)),
59
- blobHash: Schema.optional(B256),
60
- transactionIndex: Schema.optional(Schema.Number),
61
- transactionHash: Schema.optional(B256),
53
+ filterIds: Schema.Array(Schema.Number),
54
+ blobIndex: Schema.Number,
55
+ blob: Schema.Uint8ArrayFromSelf,
56
+ kzgCommitment: B384,
57
+ kzgProof: B384,
58
+ kzgCommitmentInclusionProof: Schema.Array(B256),
59
+ blobHash: B256,
60
+ transactionIndex: Schema.Number,
61
+ transactionHash: B256,
62
62
  });
63
63
 
64
+ export const Signature = Schema.Struct({
65
+ r: Schema.optional(U256),
66
+ s: Schema.optional(U256),
67
+ v: Schema.optional(U256),
68
+ YParity: Schema.optional(Schema.Boolean),
69
+ });
70
+
71
+ export type Signature = typeof Signature.Type;
72
+
64
73
  export const Transaction = Schema.Struct({
65
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
66
- transactionHash: Schema.optional(B256),
67
- nonce: Schema.optional(Schema.BigIntFromSelf),
68
- transactionIndex: Schema.optional(Schema.Number),
69
- from: Schema.optional(Address),
74
+ filterIds: Schema.Array(Schema.Number),
75
+ transactionHash: B256,
76
+ nonce: Schema.BigIntFromSelf,
77
+ transactionIndex: Schema.Number,
78
+ from: Address,
70
79
  to: Schema.optional(Address),
71
- value: Schema.optional(U256),
80
+ value: U256,
72
81
  gasPrice: Schema.optional(U128),
73
82
  gasLimit: Schema.optional(U128),
74
83
  maxFeePerGas: Schema.optional(U128),
75
84
  maxPriorityFeePerGas: Schema.optional(U128),
76
- input: Schema.optional(Schema.Uint8ArrayFromSelf),
85
+ input: Schema.Uint8ArrayFromSelf,
77
86
  signature: Schema.optional(Signature),
78
87
  chainId: Schema.optional(Schema.BigIntFromSelf),
79
- accessList: Schema.optional(Schema.Array(AccessListItem)),
80
- transactionType: Schema.optional(Schema.BigIntFromSelf),
88
+ accessList: Schema.Array(AccessListItem),
89
+ transactionType: Schema.BigIntFromSelf,
81
90
  maxFeePerBlobGas: Schema.optional(U128),
82
- blobVersionedHashes: Schema.optional(Schema.Array(B256)),
91
+ blobVersionedHashes: Schema.Array(B256),
83
92
  });
84
93
 
85
94
  export type Transaction = typeof Transaction.Type;
86
95
 
87
96
  export const Block = Schema.Struct({
88
- header: Schema.optional(BlockHeader),
97
+ header: BlockHeader,
89
98
  validators: Schema.Array(Validator),
90
99
  blobs: Schema.Array(Blob),
91
100
  transactions: Schema.Array(Transaction),