@apibara/evm 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
@@ -1931,7 +1931,8 @@ function createBaseLog() {
1931
1931
  data: new Uint8Array(0),
1932
1932
  transactionIndex: 0,
1933
1933
  transactionHash: void 0,
1934
- transactionStatus: 0
1934
+ transactionStatus: 0,
1935
+ logIndexInTransaction: 0
1935
1936
  };
1936
1937
  }
1937
1938
  const Log$1 = {
@@ -1966,6 +1967,9 @@ const Log$1 = {
1966
1967
  if (message.transactionStatus !== void 0 && message.transactionStatus !== 0) {
1967
1968
  writer.uint32(64).int32(message.transactionStatus);
1968
1969
  }
1970
+ if (message.logIndexInTransaction !== void 0 && message.logIndexInTransaction !== 0) {
1971
+ writer.uint32(72).uint32(message.logIndexInTransaction);
1972
+ }
1969
1973
  return writer;
1970
1974
  },
1971
1975
  decode(input, length) {
@@ -2030,6 +2034,12 @@ const Log$1 = {
2030
2034
  }
2031
2035
  message.transactionStatus = reader.int32();
2032
2036
  continue;
2037
+ case 9:
2038
+ if (tag !== 72) {
2039
+ break;
2040
+ }
2041
+ message.logIndexInTransaction = reader.uint32();
2042
+ continue;
2033
2043
  }
2034
2044
  if ((tag & 7) === 4 || tag === 0) {
2035
2045
  break;
@@ -2047,7 +2057,8 @@ const Log$1 = {
2047
2057
  data: isSet$1(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
2048
2058
  transactionIndex: isSet$1(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
2049
2059
  transactionHash: isSet$1(object.transactionHash) ? B256.fromJSON(object.transactionHash) : void 0,
2050
- transactionStatus: isSet$1(object.transactionStatus) ? transactionStatusFromJSON(object.transactionStatus) : 0
2060
+ transactionStatus: isSet$1(object.transactionStatus) ? transactionStatusFromJSON(object.transactionStatus) : 0,
2061
+ logIndexInTransaction: isSet$1(object.logIndexInTransaction) ? globalThis.Number(object.logIndexInTransaction) : 0
2051
2062
  };
2052
2063
  },
2053
2064
  toJSON(message) {
@@ -2076,6 +2087,9 @@ const Log$1 = {
2076
2087
  if (message.transactionStatus !== void 0 && message.transactionStatus !== 0) {
2077
2088
  obj.transactionStatus = transactionStatusToJSON(message.transactionStatus);
2078
2089
  }
2090
+ if (message.logIndexInTransaction !== void 0 && message.logIndexInTransaction !== 0) {
2091
+ obj.logIndexInTransaction = Math.round(message.logIndexInTransaction);
2092
+ }
2079
2093
  return obj;
2080
2094
  },
2081
2095
  create(base) {
@@ -2091,6 +2105,7 @@ const Log$1 = {
2091
2105
  message.transactionIndex = object.transactionIndex ?? 0;
2092
2106
  message.transactionHash = object.transactionHash !== void 0 && object.transactionHash !== null ? B256.fromPartial(object.transactionHash) : void 0;
2093
2107
  message.transactionStatus = object.transactionStatus ?? 0;
2108
+ message.logIndexInTransaction = object.logIndexInTransaction ?? 0;
2094
2109
  return message;
2095
2110
  }
2096
2111
  };
@@ -3009,18 +3024,18 @@ const TransactionStatus = Schema.transform(
3009
3024
  );
3010
3025
  const BlockHeader = Schema.Struct({
3011
3026
  blockNumber: Schema.BigIntFromSelf,
3012
- blockHash: Schema.optional(B256$1),
3013
- parentBlockHash: Schema.optional(B256$1),
3014
- unclesHash: Schema.optional(B256$1),
3015
- miner: Schema.optional(Address$1),
3016
- stateRoot: Schema.optional(B256$1),
3017
- transactionsRoot: Schema.optional(B256$1),
3018
- receiptsRoot: Schema.optional(B256$1),
3019
- logsBloom: Schema.optional(Bloom),
3020
- difficulty: Schema.optional(U256$1),
3021
- gasLimit: Schema.optional(U128$1),
3022
- gasUsed: Schema.optional(U128$1),
3023
- timestamp: Schema.optional(Schema.DateFromSelf),
3027
+ blockHash: B256$1,
3028
+ parentBlockHash: B256$1,
3029
+ unclesHash: B256$1,
3030
+ miner: Address$1,
3031
+ stateRoot: B256$1,
3032
+ transactionsRoot: B256$1,
3033
+ receiptsRoot: B256$1,
3034
+ logsBloom: Bloom,
3035
+ difficulty: U256$1,
3036
+ gasLimit: U128$1,
3037
+ gasUsed: U128$1,
3038
+ timestamp: Schema.DateFromSelf,
3024
3039
  extraData: BytesFromUint8Array,
3025
3040
  mixHash: Schema.optional(B256$1),
3026
3041
  nonce: Schema.optional(Schema.BigIntFromSelf),
@@ -3032,72 +3047,73 @@ const BlockHeader = Schema.Struct({
3032
3047
  parentBeaconBlockRoot: Schema.optional(B256$1)
3033
3048
  });
3034
3049
  const Withdrawal = Schema.Struct({
3035
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
3050
+ filterIds: Schema.Array(Schema.Number),
3036
3051
  withdrawalIndex: Schema.Number,
3037
3052
  index: Schema.BigIntFromSelf,
3038
3053
  validatorIndex: Schema.Number,
3039
- address: Schema.optional(Address$1),
3040
- amount: Schema.optional(Schema.BigIntFromSelf)
3054
+ address: Address$1,
3055
+ amount: Schema.BigIntFromSelf
3041
3056
  });
3042
3057
  const AccessListItem = Schema.Struct({
3043
- address: Schema.optional(Address$1),
3058
+ address: Address$1,
3044
3059
  storageKeys: Schema.Array(B256$1)
3045
3060
  });
3046
3061
  const Signature = Schema.Struct({
3047
- r: Schema.optional(U256$1),
3048
- s: Schema.optional(U256$1),
3049
- v: Schema.optional(U256$1),
3062
+ r: U256$1,
3063
+ s: U256$1,
3064
+ v: U256$1,
3050
3065
  YParity: Schema.optional(Schema.Boolean)
3051
3066
  });
3052
3067
  const Transaction = Schema.Struct({
3053
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
3068
+ filterIds: Schema.Array(Schema.Number),
3054
3069
  transactionIndex: Schema.Number,
3055
- transactionHash: Schema.optional(B256$1),
3056
- nonce: Schema.optional(Schema.BigIntFromSelf),
3057
- from: Schema.optional(Address$1),
3070
+ transactionHash: B256$1,
3071
+ nonce: Schema.BigIntFromSelf,
3072
+ from: Address$1,
3058
3073
  to: Schema.optional(Address$1),
3059
- value: Schema.optional(U256$1),
3074
+ value: U256$1,
3060
3075
  gasPrice: Schema.optional(U128$1),
3061
- gas: Schema.optional(U128$1),
3076
+ gas: U128$1,
3062
3077
  maxFeePerGas: Schema.optional(U128$1),
3063
3078
  maxPriorityFeePerGas: Schema.optional(U128$1),
3064
3079
  input: BytesFromUint8Array,
3065
3080
  signature: Schema.optional(Signature),
3066
3081
  chainId: Schema.optional(Schema.BigIntFromSelf),
3067
3082
  accessList: Schema.Array(AccessListItem),
3068
- transactionType: Schema.optional(Schema.BigIntFromSelf),
3083
+ transactionType: Schema.BigIntFromSelf,
3069
3084
  maxFeePerBlobGas: Schema.optional(U128$1),
3070
3085
  blobVersionedHashes: Schema.Array(B256$1),
3071
- transactionStatus: Schema.optional(TransactionStatus)
3086
+ transactionStatus: TransactionStatus
3072
3087
  });
3073
3088
  const TransactionReceipt = Schema.Struct({
3074
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
3075
- transactionIndex: Schema.optional(Schema.Number),
3076
- transactionHash: Schema.optional(B256$1),
3077
- cumulativeGasUsed: Schema.optional(U128$1),
3078
- gasUsed: Schema.optional(U128$1),
3079
- effectiveGasPrice: Schema.optional(U128$1),
3080
- from: Schema.optional(Address$1),
3089
+ filterIds: Schema.Array(Schema.Number),
3090
+ transactionIndex: Schema.Number,
3091
+ transactionHash: B256$1,
3092
+ cumulativeGasUsed: U128$1,
3093
+ gasUsed: U128$1,
3094
+ effectiveGasPrice: U128$1,
3095
+ from: Address$1,
3081
3096
  to: Schema.optional(Address$1),
3082
3097
  contractAddress: Schema.optional(Address$1),
3083
- logsBloom: Schema.optional(Bloom),
3084
- transactionType: Schema.optional(Schema.BigIntFromSelf),
3098
+ logsBloom: Bloom,
3099
+ transactionType: Schema.BigIntFromSelf,
3085
3100
  blobGasUsed: Schema.optional(U128$1),
3086
3101
  blobGasPrice: Schema.optional(U128$1),
3087
- transactionStatus: Schema.optional(TransactionStatus)
3102
+ transactionStatus: TransactionStatus
3088
3103
  });
3089
3104
  const Log = Schema.Struct({
3090
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
3091
- address: Schema.optional(Address$1),
3105
+ filterIds: Schema.Array(Schema.Number),
3106
+ address: Address$1,
3092
3107
  topics: Schema.Array(B256$1),
3093
3108
  data: BytesFromUint8Array,
3094
3109
  logIndex: Schema.Number,
3110
+ logIndexInTransaction: Schema.Number,
3095
3111
  transactionIndex: Schema.Number,
3096
- transactionHash: Schema.optional(B256$1),
3097
- transactionStatus: Schema.optional(TransactionStatus)
3112
+ transactionHash: B256$1,
3113
+ transactionStatus: TransactionStatus
3098
3114
  });
3099
3115
  const Block = Schema.Struct({
3100
- header: Schema.optional(BlockHeader),
3116
+ header: BlockHeader,
3101
3117
  withdrawals: Schema.Array(Withdrawal),
3102
3118
  transactions: Schema.Array(Transaction),
3103
3119
  receipts: Schema.Array(TransactionReceipt),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apibara/evm",
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,7 +35,7 @@
35
35
  "vitest": "^1.6.0"
36
36
  },
37
37
  "dependencies": {
38
- "@apibara/protocol": "2.0.0-beta.17",
38
+ "@apibara/protocol": "2.1.0-beta.2",
39
39
  "@effect/schema": "^0.67.15",
40
40
  "effect": "^3.2.6",
41
41
  "long": "^5.2.1",
package/src/block.ts CHANGED
@@ -44,18 +44,18 @@ export type TransactionStatus = typeof TransactionStatus.Type;
44
44
 
45
45
  export const BlockHeader = Schema.Struct({
46
46
  blockNumber: Schema.BigIntFromSelf,
47
- blockHash: Schema.optional(B256),
48
- parentBlockHash: Schema.optional(B256),
49
- unclesHash: Schema.optional(B256),
50
- miner: Schema.optional(Address),
51
- stateRoot: Schema.optional(B256),
52
- transactionsRoot: Schema.optional(B256),
53
- receiptsRoot: Schema.optional(B256),
54
- logsBloom: Schema.optional(Bloom),
55
- difficulty: Schema.optional(U256),
56
- gasLimit: Schema.optional(U128),
57
- gasUsed: Schema.optional(U128),
58
- timestamp: Schema.optional(Schema.DateFromSelf),
47
+ blockHash: B256,
48
+ parentBlockHash: B256,
49
+ unclesHash: B256,
50
+ miner: Address,
51
+ stateRoot: B256,
52
+ transactionsRoot: B256,
53
+ receiptsRoot: B256,
54
+ logsBloom: Bloom,
55
+ difficulty: U256,
56
+ gasLimit: U128,
57
+ gasUsed: U128,
58
+ timestamp: Schema.DateFromSelf,
59
59
  extraData: BytesFromUint8Array,
60
60
  mixHash: Schema.optional(B256),
61
61
  nonce: Schema.optional(Schema.BigIntFromSelf),
@@ -70,80 +70,81 @@ export const BlockHeader = Schema.Struct({
70
70
  export type BlockHeader = typeof BlockHeader.Type;
71
71
 
72
72
  export const Withdrawal = Schema.Struct({
73
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
73
+ filterIds: Schema.Array(Schema.Number),
74
74
  withdrawalIndex: Schema.Number,
75
75
  index: Schema.BigIntFromSelf,
76
76
  validatorIndex: Schema.Number,
77
- address: Schema.optional(Address),
78
- amount: Schema.optional(Schema.BigIntFromSelf),
77
+ address: Address,
78
+ amount: Schema.BigIntFromSelf,
79
79
  });
80
80
 
81
81
  export const AccessListItem = Schema.Struct({
82
- address: Schema.optional(Address),
82
+ address: Address,
83
83
  storageKeys: Schema.Array(B256),
84
84
  });
85
85
 
86
86
  export const Signature = Schema.Struct({
87
- r: Schema.optional(U256),
88
- s: Schema.optional(U256),
89
- v: Schema.optional(U256),
87
+ r: U256,
88
+ s: U256,
89
+ v: U256,
90
90
  YParity: Schema.optional(Schema.Boolean),
91
91
  });
92
92
 
93
93
  export const Transaction = Schema.Struct({
94
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
94
+ filterIds: Schema.Array(Schema.Number),
95
95
  transactionIndex: Schema.Number,
96
- transactionHash: Schema.optional(B256),
97
- nonce: Schema.optional(Schema.BigIntFromSelf),
98
- from: Schema.optional(Address),
96
+ transactionHash: B256,
97
+ nonce: Schema.BigIntFromSelf,
98
+ from: Address,
99
99
  to: Schema.optional(Address),
100
- value: Schema.optional(U256),
100
+ value: U256,
101
101
  gasPrice: Schema.optional(U128),
102
- gas: Schema.optional(U128),
102
+ gas: U128,
103
103
  maxFeePerGas: Schema.optional(U128),
104
104
  maxPriorityFeePerGas: Schema.optional(U128),
105
105
  input: BytesFromUint8Array,
106
106
  signature: Schema.optional(Signature),
107
107
  chainId: Schema.optional(Schema.BigIntFromSelf),
108
108
  accessList: Schema.Array(AccessListItem),
109
- transactionType: Schema.optional(Schema.BigIntFromSelf),
109
+ transactionType: Schema.BigIntFromSelf,
110
110
  maxFeePerBlobGas: Schema.optional(U128),
111
111
  blobVersionedHashes: Schema.Array(B256),
112
- transactionStatus: Schema.optional(TransactionStatus),
112
+ transactionStatus: TransactionStatus,
113
113
  });
114
114
 
115
115
  export const TransactionReceipt = Schema.Struct({
116
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
117
- transactionIndex: Schema.optional(Schema.Number),
118
- transactionHash: Schema.optional(B256),
119
- cumulativeGasUsed: Schema.optional(U128),
120
- gasUsed: Schema.optional(U128),
121
- effectiveGasPrice: Schema.optional(U128),
122
- from: Schema.optional(Address),
116
+ filterIds: Schema.Array(Schema.Number),
117
+ transactionIndex: Schema.Number,
118
+ transactionHash: B256,
119
+ cumulativeGasUsed: U128,
120
+ gasUsed: U128,
121
+ effectiveGasPrice: U128,
122
+ from: Address,
123
123
  to: Schema.optional(Address),
124
124
  contractAddress: Schema.optional(Address),
125
- logsBloom: Schema.optional(Bloom),
126
- transactionType: Schema.optional(Schema.BigIntFromSelf),
125
+ logsBloom: Bloom,
126
+ transactionType: Schema.BigIntFromSelf,
127
127
  blobGasUsed: Schema.optional(U128),
128
128
  blobGasPrice: Schema.optional(U128),
129
- transactionStatus: Schema.optional(TransactionStatus),
129
+ transactionStatus: TransactionStatus,
130
130
  });
131
131
 
132
132
  export const Log = Schema.Struct({
133
- filterIds: Schema.optional(Schema.Array(Schema.Number)),
134
- address: Schema.optional(Address),
133
+ filterIds: Schema.Array(Schema.Number),
134
+ address: Address,
135
135
  topics: Schema.Array(B256),
136
136
  data: BytesFromUint8Array,
137
137
  logIndex: Schema.Number,
138
+ logIndexInTransaction: Schema.Number,
138
139
  transactionIndex: Schema.Number,
139
- transactionHash: Schema.optional(B256),
140
- transactionStatus: Schema.optional(TransactionStatus),
140
+ transactionHash: B256,
141
+ transactionStatus: TransactionStatus,
141
142
  });
142
143
 
143
144
  export type Log = typeof Log.Type;
144
145
 
145
146
  export const Block = Schema.Struct({
146
- header: Schema.optional(BlockHeader),
147
+ header: BlockHeader,
147
148
  withdrawals: Schema.Array(Withdrawal),
148
149
  transactions: Schema.Array(Transaction),
149
150
  receipts: Schema.Array(TransactionReceipt),
package/src/proto/data.ts CHANGED
@@ -351,7 +351,11 @@ export interface Log {
351
351
  | B256
352
352
  | undefined;
353
353
  /** The transaction status. */
354
- readonly transactionStatus?: TransactionStatus | undefined;
354
+ readonly transactionStatus?:
355
+ | TransactionStatus
356
+ | undefined;
357
+ /** Index of the log in the transaction. */
358
+ readonly logIndexInTransaction?: number | undefined;
355
359
  }
356
360
 
357
361
  export interface Signature {
@@ -1830,6 +1834,7 @@ function createBaseLog(): Log {
1830
1834
  transactionIndex: 0,
1831
1835
  transactionHash: undefined,
1832
1836
  transactionStatus: 0,
1837
+ logIndexInTransaction: 0,
1833
1838
  };
1834
1839
  }
1835
1840
 
@@ -1865,6 +1870,9 @@ export const Log = {
1865
1870
  if (message.transactionStatus !== undefined && message.transactionStatus !== 0) {
1866
1871
  writer.uint32(64).int32(message.transactionStatus);
1867
1872
  }
1873
+ if (message.logIndexInTransaction !== undefined && message.logIndexInTransaction !== 0) {
1874
+ writer.uint32(72).uint32(message.logIndexInTransaction);
1875
+ }
1868
1876
  return writer;
1869
1877
  },
1870
1878
 
@@ -1941,6 +1949,13 @@ export const Log = {
1941
1949
 
1942
1950
  message.transactionStatus = reader.int32() as any;
1943
1951
  continue;
1952
+ case 9:
1953
+ if (tag !== 72) {
1954
+ break;
1955
+ }
1956
+
1957
+ message.logIndexInTransaction = reader.uint32();
1958
+ continue;
1944
1959
  }
1945
1960
  if ((tag & 7) === 4 || tag === 0) {
1946
1961
  break;
@@ -1962,6 +1977,7 @@ export const Log = {
1962
1977
  transactionIndex: isSet(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
1963
1978
  transactionHash: isSet(object.transactionHash) ? B256.fromJSON(object.transactionHash) : undefined,
1964
1979
  transactionStatus: isSet(object.transactionStatus) ? transactionStatusFromJSON(object.transactionStatus) : 0,
1980
+ logIndexInTransaction: isSet(object.logIndexInTransaction) ? globalThis.Number(object.logIndexInTransaction) : 0,
1965
1981
  };
1966
1982
  },
1967
1983
 
@@ -1991,6 +2007,9 @@ export const Log = {
1991
2007
  if (message.transactionStatus !== undefined && message.transactionStatus !== 0) {
1992
2008
  obj.transactionStatus = transactionStatusToJSON(message.transactionStatus);
1993
2009
  }
2010
+ if (message.logIndexInTransaction !== undefined && message.logIndexInTransaction !== 0) {
2011
+ obj.logIndexInTransaction = Math.round(message.logIndexInTransaction);
2012
+ }
1994
2013
  return obj;
1995
2014
  },
1996
2015
 
@@ -2011,6 +2030,7 @@ export const Log = {
2011
2030
  ? B256.fromPartial(object.transactionHash)
2012
2031
  : undefined;
2013
2032
  message.transactionStatus = object.transactionStatus ?? 0;
2033
+ message.logIndexInTransaction = object.logIndexInTransaction ?? 0;
2014
2034
  return message;
2015
2035
  },
2016
2036
  };