formatting.d.ts 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. /**
  2. * About provider formatting?
  3. *
  4. * @_section: api/providers/formatting:Formatting [provider-formatting]
  5. */
  6. import type { Signature } from "../crypto/index.js";
  7. import type { AccessList } from "../transaction/index.js";
  8. /**
  9. * a **BlockParams** encodes the minimal required properties for a
  10. * formatted block.
  11. */
  12. export interface BlockParams {
  13. /**
  14. * The block hash.
  15. */
  16. hash?: null | string;
  17. /**
  18. * The block number.
  19. */
  20. number: number;
  21. /**
  22. * The timestamp for this block, which is the number of seconds
  23. * since epoch that this block was included.
  24. */
  25. timestamp: number;
  26. /**
  27. * The hash of the previous block in the blockchain. The genesis block
  28. * has the parentHash of the [[ZeroHash]].
  29. */
  30. parentHash: string;
  31. /**
  32. * The hash tree root of the parent beacon block for the given
  33. * execution block. See [[link-eip-4788]].
  34. */
  35. parentBeaconBlockRoot?: null | string;
  36. /**
  37. * A random sequence provided during the mining process for
  38. * proof-of-work networks.
  39. */
  40. nonce: string;
  41. /**
  42. * For proof-of-work networks, the difficulty target is used to
  43. * adjust the difficulty in mining to ensure a expected block rate.
  44. */
  45. difficulty: bigint;
  46. /**
  47. * The maximum amount of gas a block can consume.
  48. */
  49. gasLimit: bigint;
  50. /**
  51. * The amount of gas a block consumed.
  52. */
  53. gasUsed: bigint;
  54. /**
  55. * The total amount of BLOb gas consumed by transactions within
  56. * the block. See [[link-eip4844].
  57. */
  58. blobGasUsed?: null | bigint;
  59. /**
  60. * The running total of BLOb gas consumed in excess of the target
  61. * prior to the block. See [[link-eip-4844]].
  62. */
  63. excessBlobGas?: null | bigint;
  64. /**
  65. * The miner (or author) of a block.
  66. */
  67. miner: string;
  68. /**
  69. * The latest RANDAO mix of the post beacon state of
  70. * the previous block.
  71. */
  72. prevRandao?: null | string;
  73. /**
  74. * Additional data the miner choose to include.
  75. */
  76. extraData: string;
  77. /**
  78. * The protocol-defined base fee per gas in an [[link-eip-1559]]
  79. * block.
  80. */
  81. baseFeePerGas: null | bigint;
  82. /**
  83. * The root hash for the global state after applying changes
  84. * in this block.
  85. */
  86. stateRoot?: null | string;
  87. /**
  88. * The hash of the transaction receipts trie.
  89. */
  90. receiptsRoot?: null | string;
  91. /**
  92. * The list of transactions in the block.
  93. */
  94. transactions: ReadonlyArray<string | TransactionResponseParams>;
  95. }
  96. /**
  97. * a **LogParams** encodes the minimal required properties for a
  98. * formatted log.
  99. */
  100. export interface LogParams {
  101. /**
  102. * The transaction hash for the transaxction the log occurred in.
  103. */
  104. transactionHash: string;
  105. /**
  106. * The block hash of the block that included the transaction for this
  107. * log.
  108. */
  109. blockHash: string;
  110. /**
  111. * The block number of the block that included the transaction for this
  112. * log.
  113. */
  114. blockNumber: number;
  115. /**
  116. * Whether this log was removed due to the transaction it was included
  117. * in being removed dur to an orphaned block.
  118. */
  119. removed: boolean;
  120. /**
  121. * The address of the contract that emitted this log.
  122. */
  123. address: string;
  124. /**
  125. * The data emitted with this log.
  126. */
  127. data: string;
  128. /**
  129. * The topics emitted with this log.
  130. */
  131. topics: ReadonlyArray<string>;
  132. /**
  133. * The index of this log.
  134. */
  135. index: number;
  136. /**
  137. * The transaction index of this log.
  138. */
  139. transactionIndex: number;
  140. }
  141. /**
  142. * a **TransactionReceiptParams** encodes the minimal required properties
  143. * for a formatted transaction receipt.
  144. */
  145. export interface TransactionReceiptParams {
  146. /**
  147. * The target of the transaction. If null, the transaction was trying
  148. * to deploy a transaction with the ``data`` as the initi=code.
  149. */
  150. to: null | string;
  151. /**
  152. * The sender of the transaction.
  153. */
  154. from: string;
  155. /**
  156. * If the transaction was directly deploying a contract, the [[to]]
  157. * will be null, the ``data`` will be initcode and if successful, this
  158. * will be the address of the contract deployed.
  159. */
  160. contractAddress: null | string;
  161. /**
  162. * The transaction hash.
  163. */
  164. hash: string;
  165. /**
  166. * The transaction index.
  167. */
  168. index: number;
  169. /**
  170. * The block hash of the block that included this transaction.
  171. */
  172. blockHash: string;
  173. /**
  174. * The block number of the block that included this transaction.
  175. */
  176. blockNumber: number;
  177. /**
  178. * The bloom filter for the logs emitted during execution of this
  179. * transaction.
  180. */
  181. logsBloom: string;
  182. /**
  183. * The logs emitted during the execution of this transaction.
  184. */
  185. logs: ReadonlyArray<LogParams>;
  186. /**
  187. * The amount of gas consumed executing this transaciton.
  188. */
  189. gasUsed: bigint;
  190. /**
  191. * The amount of BLOb gas used. See [[link-eip-4844]].
  192. */
  193. blobGasUsed?: null | bigint;
  194. /**
  195. * The total amount of gas consumed during the entire block up to
  196. * and including this transaction.
  197. */
  198. cumulativeGasUsed: bigint;
  199. /**
  200. * The actual gas price per gas charged for this transaction.
  201. */
  202. gasPrice?: null | bigint;
  203. /**
  204. * The actual BLOb gas price that was charged. See [[link-eip-4844]].
  205. */
  206. blobGasPrice?: null | bigint;
  207. /**
  208. * The actual gas price per gas charged for this transaction.
  209. */
  210. effectiveGasPrice?: null | bigint;
  211. /**
  212. * The [[link-eip-2718]] envelope type.
  213. */
  214. type: number;
  215. /**
  216. * The status of the transaction execution. If ``1`` then the
  217. * the transaction returned success, if ``0`` then the transaction
  218. * was reverted. For pre-byzantium blocks, this is usually null, but
  219. * some nodes may have backfilled this data.
  220. */
  221. status: null | number;
  222. /**
  223. * The root of this transaction in a pre-bazatium block. In
  224. * post-byzantium blocks this is null.
  225. */
  226. root: null | string;
  227. }
  228. /**
  229. * a **TransactionResponseParams** encodes the minimal required properties
  230. * for a formatted transaction response.
  231. */
  232. export interface TransactionResponseParams {
  233. /**
  234. * The block number of the block that included this transaction.
  235. */
  236. blockNumber: null | number;
  237. /**
  238. * The block hash of the block that included this transaction.
  239. */
  240. blockHash: null | string;
  241. /**
  242. * The transaction hash.
  243. */
  244. hash: string;
  245. /**
  246. * The transaction index.
  247. */
  248. index: number;
  249. /**
  250. * The [[link-eip-2718]] transaction type.
  251. */
  252. type: number;
  253. /**
  254. * The target of the transaction. If ``null``, the ``data`` is initcode
  255. * and this transaction is a deployment transaction.
  256. */
  257. to: null | string;
  258. /**
  259. * The sender of the transaction.
  260. */
  261. from: string;
  262. /**
  263. * The nonce of the transaction, used for replay protection.
  264. */
  265. nonce: number;
  266. /**
  267. * The maximum amount of gas this transaction is authorized to consume.
  268. */
  269. gasLimit: bigint;
  270. /**
  271. * For legacy transactions, this is the gas price per gas to pay.
  272. */
  273. gasPrice: bigint;
  274. /**
  275. * For [[link-eip-1559]] transactions, this is the maximum priority
  276. * fee to allow a producer to claim.
  277. */
  278. maxPriorityFeePerGas: null | bigint;
  279. /**
  280. * For [[link-eip-1559]] transactions, this is the maximum fee that
  281. * will be paid.
  282. */
  283. maxFeePerGas: null | bigint;
  284. /**
  285. * For [[link-eip-4844]] transactions, this is the maximum fee that
  286. * will be paid per BLOb.
  287. */
  288. maxFeePerBlobGas?: null | bigint;
  289. /**
  290. * The transaction data.
  291. */
  292. data: string;
  293. /**
  294. * The transaction value (in wei).
  295. */
  296. value: bigint;
  297. /**
  298. * The chain ID this transaction is valid on.
  299. */
  300. chainId: bigint;
  301. /**
  302. * The signature of the transaction.
  303. */
  304. signature: Signature;
  305. /**
  306. * The transaction access list.
  307. */
  308. accessList: null | AccessList;
  309. /**
  310. * The [[link-eip-4844]] BLOb versioned hashes.
  311. */
  312. blobVersionedHashes?: null | Array<string>;
  313. }
  314. //# sourceMappingURL=formatting.d.ts.map