ox 0.9.16 → 0.10.0

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.
Files changed (216) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +4 -4
  3. package/TxEnvelope/package.json +6 -0
  4. package/TxEnvelopeEip1559/package.json +6 -0
  5. package/TxEnvelopeEip2930/package.json +6 -0
  6. package/TxEnvelopeEip4844/package.json +6 -0
  7. package/TxEnvelopeEip7702/package.json +6 -0
  8. package/TxEnvelopeLegacy/package.json +6 -0
  9. package/_cjs/core/{TransactionEnvelope.js → TxEnvelope.js} +1 -1
  10. package/_cjs/core/TxEnvelope.js.map +1 -0
  11. package/_cjs/core/{TransactionEnvelopeEip1559.js → TxEnvelopeEip1559.js} +2 -2
  12. package/_cjs/core/TxEnvelopeEip1559.js.map +1 -0
  13. package/_cjs/core/{TransactionEnvelopeEip2930.js → TxEnvelopeEip2930.js} +2 -2
  14. package/_cjs/core/TxEnvelopeEip2930.js.map +1 -0
  15. package/_cjs/core/{TransactionEnvelopeEip4844.js → TxEnvelopeEip4844.js} +4 -4
  16. package/_cjs/core/TxEnvelopeEip4844.js.map +1 -0
  17. package/_cjs/core/{TransactionEnvelopeEip7702.js → TxEnvelopeEip7702.js} +4 -4
  18. package/_cjs/core/TxEnvelopeEip7702.js.map +1 -0
  19. package/_cjs/core/{TransactionEnvelopeLegacy.js → TxEnvelopeLegacy.js} +2 -2
  20. package/_cjs/core/TxEnvelopeLegacy.js.map +1 -0
  21. package/_cjs/core/WebAuthnP256.js +1 -1
  22. package/_cjs/core/WebAuthnP256.js.map +1 -1
  23. package/_cjs/erc8021/Attribution.js +36 -6
  24. package/_cjs/erc8021/Attribution.js.map +1 -1
  25. package/_cjs/index.docs.js +1 -0
  26. package/_cjs/index.docs.js.map +1 -1
  27. package/_cjs/index.js +7 -7
  28. package/_cjs/index.js.map +1 -1
  29. package/_cjs/tempo/AuthorizationTempo.js +101 -0
  30. package/_cjs/tempo/AuthorizationTempo.js.map +1 -0
  31. package/_cjs/tempo/KeyAuthorization.js +123 -0
  32. package/_cjs/tempo/KeyAuthorization.js.map +1 -0
  33. package/_cjs/tempo/PoolId.js +10 -0
  34. package/_cjs/tempo/PoolId.js.map +1 -0
  35. package/_cjs/tempo/SignatureEnvelope.js +394 -0
  36. package/_cjs/tempo/SignatureEnvelope.js.map +1 -0
  37. package/_cjs/tempo/Tick.js +77 -0
  38. package/_cjs/tempo/Tick.js.map +1 -0
  39. package/_cjs/tempo/TokenId.js +28 -0
  40. package/_cjs/tempo/TokenId.js.map +1 -0
  41. package/_cjs/tempo/TokenRole.js +26 -0
  42. package/_cjs/tempo/TokenRole.js.map +1 -0
  43. package/_cjs/tempo/Transaction.js +80 -0
  44. package/_cjs/tempo/Transaction.js.map +1 -0
  45. package/_cjs/tempo/TransactionReceipt.js +26 -0
  46. package/_cjs/tempo/TransactionReceipt.js.map +1 -0
  47. package/_cjs/tempo/TransactionRequest.js +53 -0
  48. package/_cjs/tempo/TransactionRequest.js.map +1 -0
  49. package/_cjs/tempo/TxEnvelopeTempo.js +267 -0
  50. package/_cjs/tempo/TxEnvelopeTempo.js.map +1 -0
  51. package/_cjs/tempo/index.js +15 -0
  52. package/_cjs/tempo/index.js.map +1 -0
  53. package/_cjs/version.js +1 -1
  54. package/_esm/core/Blobs.js +8 -8
  55. package/_esm/core/{TransactionEnvelope.js → TxEnvelope.js} +11 -11
  56. package/_esm/core/TxEnvelope.js.map +1 -0
  57. package/_esm/core/{TransactionEnvelopeEip1559.js → TxEnvelopeEip1559.js} +42 -42
  58. package/_esm/core/TxEnvelopeEip1559.js.map +1 -0
  59. package/_esm/core/{TransactionEnvelopeEip2930.js → TxEnvelopeEip2930.js} +43 -43
  60. package/_esm/core/TxEnvelopeEip2930.js.map +1 -0
  61. package/_esm/core/{TransactionEnvelopeEip4844.js → TxEnvelopeEip4844.js} +42 -42
  62. package/_esm/core/TxEnvelopeEip4844.js.map +1 -0
  63. package/_esm/core/{TransactionEnvelopeEip7702.js → TxEnvelopeEip7702.js} +40 -40
  64. package/_esm/core/TxEnvelopeEip7702.js.map +1 -0
  65. package/_esm/core/{TransactionEnvelopeLegacy.js → TxEnvelopeLegacy.js} +42 -42
  66. package/_esm/core/TxEnvelopeLegacy.js.map +1 -0
  67. package/_esm/core/WebAuthnP256.js +1 -1
  68. package/_esm/core/WebAuthnP256.js.map +1 -1
  69. package/_esm/erc8021/Attribution.js +58 -13
  70. package/_esm/erc8021/Attribution.js.map +1 -1
  71. package/_esm/index.docs.js +1 -0
  72. package/_esm/index.docs.js.map +1 -1
  73. package/_esm/index.js +192 -192
  74. package/_esm/index.js.map +1 -1
  75. package/_esm/tempo/AuthorizationTempo.js +664 -0
  76. package/_esm/tempo/AuthorizationTempo.js.map +1 -0
  77. package/_esm/tempo/KeyAuthorization.js +426 -0
  78. package/_esm/tempo/KeyAuthorization.js.map +1 -0
  79. package/_esm/tempo/PoolId.js +28 -0
  80. package/_esm/tempo/PoolId.js.map +1 -0
  81. package/_esm/tempo/SignatureEnvelope.js +660 -0
  82. package/_esm/tempo/SignatureEnvelope.js.map +1 -0
  83. package/_esm/tempo/Tick.js +147 -0
  84. package/_esm/tempo/Tick.js.map +1 -0
  85. package/_esm/tempo/TokenId.js +71 -0
  86. package/_esm/tempo/TokenId.js.map +1 -0
  87. package/_esm/tempo/TokenRole.js +40 -0
  88. package/_esm/tempo/TokenRole.js.map +1 -0
  89. package/_esm/tempo/Transaction.js +167 -0
  90. package/_esm/tempo/Transaction.js.map +1 -0
  91. package/_esm/tempo/TransactionReceipt.js +138 -0
  92. package/_esm/tempo/TransactionReceipt.js.map +1 -0
  93. package/_esm/tempo/TransactionRequest.js +99 -0
  94. package/_esm/tempo/TransactionRequest.js.map +1 -0
  95. package/_esm/tempo/TxEnvelopeTempo.js +607 -0
  96. package/_esm/tempo/TxEnvelopeTempo.js.map +1 -0
  97. package/_esm/tempo/index.js +298 -0
  98. package/_esm/tempo/index.js.map +1 -0
  99. package/_esm/version.js +1 -1
  100. package/_types/core/Blobs.d.ts +8 -8
  101. package/_types/core/{TransactionEnvelope.d.ts → TxEnvelope.d.ts} +11 -11
  102. package/_types/core/TxEnvelope.d.ts.map +1 -0
  103. package/_types/core/{TransactionEnvelopeEip1559.d.ts → TxEnvelopeEip1559.d.ts} +54 -54
  104. package/_types/core/TxEnvelopeEip1559.d.ts.map +1 -0
  105. package/_types/core/{TransactionEnvelopeEip2930.d.ts → TxEnvelopeEip2930.d.ts} +55 -55
  106. package/_types/core/TxEnvelopeEip2930.d.ts.map +1 -0
  107. package/_types/core/{TransactionEnvelopeEip4844.d.ts → TxEnvelopeEip4844.d.ts} +54 -54
  108. package/_types/core/TxEnvelopeEip4844.d.ts.map +1 -0
  109. package/_types/core/{TransactionEnvelopeEip7702.d.ts → TxEnvelopeEip7702.d.ts} +49 -49
  110. package/_types/core/TxEnvelopeEip7702.d.ts.map +1 -0
  111. package/_types/core/{TransactionEnvelopeLegacy.d.ts → TxEnvelopeLegacy.d.ts} +54 -54
  112. package/_types/core/TxEnvelopeLegacy.d.ts.map +1 -0
  113. package/_types/core/WebAuthnP256.d.ts +1 -1
  114. package/_types/core/WebAuthnP256.d.ts.map +1 -1
  115. package/_types/erc8021/Attribution.d.ts +20 -6
  116. package/_types/erc8021/Attribution.d.ts.map +1 -1
  117. package/_types/index.d.ts +192 -192
  118. package/_types/index.d.ts.map +1 -1
  119. package/_types/index.docs.d.ts +1 -0
  120. package/_types/index.docs.d.ts.map +1 -1
  121. package/_types/tempo/AuthorizationTempo.d.ts +688 -0
  122. package/_types/tempo/AuthorizationTempo.d.ts.map +1 -0
  123. package/_types/tempo/KeyAuthorization.d.ts +437 -0
  124. package/_types/tempo/KeyAuthorization.d.ts.map +1 -0
  125. package/_types/tempo/PoolId.d.ts +33 -0
  126. package/_types/tempo/PoolId.d.ts.map +1 -0
  127. package/_types/tempo/SignatureEnvelope.d.ts +438 -0
  128. package/_types/tempo/SignatureEnvelope.d.ts.map +1 -0
  129. package/_types/tempo/Tick.d.ts +120 -0
  130. package/_types/tempo/Tick.d.ts.map +1 -0
  131. package/_types/tempo/TokenId.d.ts +55 -0
  132. package/_types/tempo/TokenId.d.ts.map +1 -0
  133. package/_types/tempo/TokenRole.d.ts +29 -0
  134. package/_types/tempo/TokenRole.d.ts.map +1 -0
  135. package/_types/tempo/Transaction.d.ts +208 -0
  136. package/_types/tempo/Transaction.d.ts.map +1 -0
  137. package/_types/tempo/TransactionReceipt.d.ts +165 -0
  138. package/_types/tempo/TransactionReceipt.d.ts.map +1 -0
  139. package/_types/tempo/TransactionRequest.d.ts +89 -0
  140. package/_types/tempo/TransactionRequest.d.ts.map +1 -0
  141. package/_types/tempo/TxEnvelopeTempo.d.ts +551 -0
  142. package/_types/tempo/TxEnvelopeTempo.d.ts.map +1 -0
  143. package/_types/tempo/index.d.ts +300 -0
  144. package/_types/tempo/index.d.ts.map +1 -0
  145. package/_types/version.d.ts +1 -1
  146. package/core/Blobs.ts +8 -8
  147. package/core/{TransactionEnvelope.ts → TxEnvelope.ts} +10 -10
  148. package/core/{TransactionEnvelopeEip1559.ts → TxEnvelopeEip1559.ts} +60 -69
  149. package/core/{TransactionEnvelopeEip2930.ts → TxEnvelopeEip2930.ts} +61 -72
  150. package/core/{TransactionEnvelopeEip4844.ts → TxEnvelopeEip4844.ts} +62 -71
  151. package/core/{TransactionEnvelopeEip7702.ts → TxEnvelopeEip7702.ts} +58 -67
  152. package/core/{TransactionEnvelopeLegacy.ts → TxEnvelopeLegacy.ts} +59 -68
  153. package/core/WebAuthnP256.ts +3 -1
  154. package/erc8021/Attribution.ts +77 -15
  155. package/index.docs.ts +1 -0
  156. package/index.ts +192 -195
  157. package/package.json +91 -31
  158. package/tempo/AuthorizationTempo/package.json +6 -0
  159. package/tempo/AuthorizationTempo.test.ts +1293 -0
  160. package/tempo/AuthorizationTempo.ts +884 -0
  161. package/tempo/KeyAuthorization/package.json +6 -0
  162. package/tempo/KeyAuthorization.test.ts +1373 -0
  163. package/tempo/KeyAuthorization.ts +622 -0
  164. package/tempo/PoolId/package.json +6 -0
  165. package/tempo/PoolId.test.ts +33 -0
  166. package/tempo/PoolId.ts +42 -0
  167. package/tempo/SignatureEnvelope/package.json +6 -0
  168. package/tempo/SignatureEnvelope.test.ts +1877 -0
  169. package/tempo/SignatureEnvelope.ts +973 -0
  170. package/tempo/Tick/package.json +6 -0
  171. package/tempo/Tick.test.ts +281 -0
  172. package/tempo/Tick.ts +186 -0
  173. package/tempo/TokenId/package.json +6 -0
  174. package/tempo/TokenId.test.ts +40 -0
  175. package/tempo/TokenId.ts +80 -0
  176. package/tempo/TokenRole/package.json +6 -0
  177. package/tempo/TokenRole.test.ts +16 -0
  178. package/tempo/TokenRole.ts +45 -0
  179. package/tempo/Transaction/package.json +6 -0
  180. package/tempo/Transaction.test.ts +523 -0
  181. package/tempo/Transaction.ts +339 -0
  182. package/tempo/TransactionReceipt/package.json +6 -0
  183. package/tempo/TransactionReceipt.ts +200 -0
  184. package/tempo/TransactionRequest/package.json +6 -0
  185. package/tempo/TransactionRequest.ts +160 -0
  186. package/tempo/TxEnvelopeTempo/package.json +6 -0
  187. package/tempo/TxEnvelopeTempo.test.ts +1371 -0
  188. package/tempo/TxEnvelopeTempo.ts +972 -0
  189. package/tempo/e2e.test.ts +1387 -0
  190. package/tempo/index.ts +308 -0
  191. package/tempo/package.json +6 -0
  192. package/version.ts +1 -1
  193. package/TransactionEnvelope/package.json +0 -6
  194. package/TransactionEnvelopeEip1559/package.json +0 -6
  195. package/TransactionEnvelopeEip2930/package.json +0 -6
  196. package/TransactionEnvelopeEip4844/package.json +0 -6
  197. package/TransactionEnvelopeEip7702/package.json +0 -6
  198. package/TransactionEnvelopeLegacy/package.json +0 -6
  199. package/_cjs/core/TransactionEnvelope.js.map +0 -1
  200. package/_cjs/core/TransactionEnvelopeEip1559.js.map +0 -1
  201. package/_cjs/core/TransactionEnvelopeEip2930.js.map +0 -1
  202. package/_cjs/core/TransactionEnvelopeEip4844.js.map +0 -1
  203. package/_cjs/core/TransactionEnvelopeEip7702.js.map +0 -1
  204. package/_cjs/core/TransactionEnvelopeLegacy.js.map +0 -1
  205. package/_esm/core/TransactionEnvelope.js.map +0 -1
  206. package/_esm/core/TransactionEnvelopeEip1559.js.map +0 -1
  207. package/_esm/core/TransactionEnvelopeEip2930.js.map +0 -1
  208. package/_esm/core/TransactionEnvelopeEip4844.js.map +0 -1
  209. package/_esm/core/TransactionEnvelopeEip7702.js.map +0 -1
  210. package/_esm/core/TransactionEnvelopeLegacy.js.map +0 -1
  211. package/_types/core/TransactionEnvelope.d.ts.map +0 -1
  212. package/_types/core/TransactionEnvelopeEip1559.d.ts.map +0 -1
  213. package/_types/core/TransactionEnvelopeEip2930.d.ts.map +0 -1
  214. package/_types/core/TransactionEnvelopeEip4844.d.ts.map +0 -1
  215. package/_types/core/TransactionEnvelopeEip7702.d.ts.map +0 -1
  216. package/_types/core/TransactionEnvelopeLegacy.d.ts.map +0 -1
@@ -11,9 +11,9 @@ import type {
11
11
  } from './internal/types.js'
12
12
  import * as Rlp from './Rlp.js'
13
13
  import * as Signature from './Signature.js'
14
- import * as TransactionEnvelope from './TransactionEnvelope.js'
14
+ import * as TransactionEnvelope from './TxEnvelope.js'
15
15
 
16
- export type TransactionEnvelopeEip2930<
16
+ export type TxEnvelopeEip2930<
17
17
  signed extends boolean = boolean,
18
18
  bigintType = bigint,
19
19
  numberType = number,
@@ -27,7 +27,7 @@ export type TransactionEnvelopeEip2930<
27
27
  }
28
28
  >
29
29
 
30
- export type Rpc<signed extends boolean = boolean> = TransactionEnvelopeEip2930<
30
+ export type Rpc<signed extends boolean = boolean> = TxEnvelopeEip2930<
31
31
  signed,
32
32
  Hex.Hex,
33
33
  Hex.Hex,
@@ -39,19 +39,19 @@ export type Serialized = `${SerializedType}${string}`
39
39
  export const serializedType = '0x01' as const
40
40
  export type SerializedType = typeof serializedType
41
41
 
42
- export type Signed = TransactionEnvelopeEip2930<true>
42
+ export type Signed = TxEnvelopeEip2930<true>
43
43
 
44
44
  export const type = 'eip2930' as const
45
45
  export type Type = typeof type
46
46
 
47
47
  /**
48
- * Asserts a {@link ox#TransactionEnvelopeEip2930.TransactionEnvelopeEip2930} is valid.
48
+ * Asserts a {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930} is valid.
49
49
  *
50
50
  * @example
51
51
  * ```ts twoslash
52
- * import { TransactionEnvelopeEip2930, Value } from 'ox'
52
+ * import { TxEnvelopeEip2930, Value } from 'ox'
53
53
  *
54
- * TransactionEnvelopeEip2930.assert({
54
+ * TxEnvelopeEip2930.assert({
55
55
  * gasPrice: 2n ** 256n - 1n + 1n,
56
56
  * chainId: 1,
57
57
  * to: '0x0000000000000000000000000000000000000000',
@@ -64,9 +64,7 @@ export type Type = typeof type
64
64
  *
65
65
  * @param envelope - The transaction envelope to assert.
66
66
  */
67
- export function assert(
68
- envelope: PartialBy<TransactionEnvelopeEip2930, 'type'>,
69
- ) {
67
+ export function assert(envelope: PartialBy<TxEnvelopeEip2930, 'type'>) {
70
68
  const { chainId, gasPrice, to } = envelope
71
69
  if (chainId <= 0)
72
70
  throw new TransactionEnvelope.InvalidChainIdError({ chainId })
@@ -84,13 +82,13 @@ export declare namespace assert {
84
82
  }
85
83
 
86
84
  /**
87
- * Deserializes a {@link ox#TransactionEnvelopeEip2930.TransactionEnvelopeEip2930} from its serialized form.
85
+ * Deserializes a {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930} from its serialized form.
88
86
  *
89
87
  * @example
90
88
  * ```ts twoslash
91
- * import { TransactionEnvelopeEip2930 } from 'ox'
89
+ * import { TxEnvelopeEip2930 } from 'ox'
92
90
  *
93
- * const envelope = TransactionEnvelopeEip2930.deserialize('0x01ef0182031184773594008477359400809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c0')
91
+ * const envelope = TxEnvelopeEip2930.deserialize('0x01ef0182031184773594008477359400809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c0')
94
92
  * // @log: {
95
93
  * // @log: type: 'eip2930',
96
94
  * // @log: nonce: 785n,
@@ -104,9 +102,7 @@ export declare namespace assert {
104
102
  * @param serialized - The serialized transaction.
105
103
  * @returns Deserialized Transaction Envelope.
106
104
  */
107
- export function deserialize(
108
- serialized: Serialized,
109
- ): TransactionEnvelopeEip2930 {
105
+ export function deserialize(serialized: Serialized): TxEnvelopeEip2930 {
110
106
  const transactionArray = Rlp.toHex(Hex.slice(serialized, 1))
111
107
 
112
108
  const [
@@ -149,7 +145,7 @@ export function deserialize(
149
145
  let transaction = {
150
146
  chainId: Number(chainId as Hex.Hex),
151
147
  type,
152
- } as TransactionEnvelopeEip2930
148
+ } as TxEnvelopeEip2930
153
149
  if (Hex.validate(to) && to !== '0x') transaction.to = to
154
150
  if (Hex.validate(gas) && gas !== '0x') transaction.gas = BigInt(gas)
155
151
  if (Hex.validate(data) && data !== '0x') transaction.data = data
@@ -167,7 +163,7 @@ export function deserialize(
167
163
  transaction = {
168
164
  ...transaction,
169
165
  ...signature,
170
- } as TransactionEnvelopeEip2930
166
+ } as TxEnvelopeEip2930
171
167
 
172
168
  assert(transaction)
173
169
 
@@ -184,9 +180,9 @@ export declare namespace deserialize {
184
180
  * @example
185
181
  * ```ts twoslash
186
182
  * // @noErrors
187
- * import { TransactionEnvelopeEip2930, Value } from 'ox'
183
+ * import { TxEnvelopeEip2930, Value } from 'ox'
188
184
  *
189
- * const envelope = TransactionEnvelopeEip2930.from({
185
+ * const envelope = TxEnvelopeEip2930.from({
190
186
  * chainId: 1,
191
187
  * accessList: [...],
192
188
  * gasPrice: Value.fromGwei('10'),
@@ -201,9 +197,9 @@ export declare namespace deserialize {
201
197
  * It is possible to attach a `signature` to the transaction envelope.
202
198
  *
203
199
  * ```ts twoslash
204
- * import { Secp256k1, TransactionEnvelopeEip2930, Value } from 'ox'
200
+ * import { Secp256k1, TxEnvelopeEip2930, Value } from 'ox'
205
201
  *
206
- * const envelope = TransactionEnvelopeEip2930.from({
202
+ * const envelope = TxEnvelopeEip2930.from({
207
203
  * chainId: 1,
208
204
  * gasPrice: Value.fromGwei('10'),
209
205
  * to: '0x0000000000000000000000000000000000000000',
@@ -211,11 +207,11 @@ export declare namespace deserialize {
211
207
  * })
212
208
  *
213
209
  * const signature = Secp256k1.sign({
214
- * payload: TransactionEnvelopeEip2930.getSignPayload(envelope),
210
+ * payload: TxEnvelopeEip2930.getSignPayload(envelope),
215
211
  * privateKey: '0x...',
216
212
  * })
217
213
  *
218
- * const envelope_signed = TransactionEnvelopeEip2930.from(envelope, { // [!code focus]
214
+ * const envelope_signed = TxEnvelopeEip2930.from(envelope, { // [!code focus]
219
215
  * signature, // [!code focus]
220
216
  * }) // [!code focus]
221
217
  * // @log: {
@@ -233,12 +229,12 @@ export declare namespace deserialize {
233
229
  * @example
234
230
  * ### From Serialized
235
231
  *
236
- * It is possible to instantiate an EIP-2930 Transaction Envelope from a {@link ox#TransactionEnvelopeEip2930.Serialized} value.
232
+ * It is possible to instantiate an EIP-2930 Transaction Envelope from a {@link ox#TxEnvelopeEip2930.Serialized} value.
237
233
  *
238
234
  * ```ts twoslash
239
- * import { TransactionEnvelopeEip2930 } from 'ox'
235
+ * import { TxEnvelopeEip2930 } from 'ox'
240
236
  *
241
- * const envelope = TransactionEnvelopeEip2930.from('0x01f858018203118502540be4008504a817c800809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c08477359400e1a001627c687261b0e7f8638af1112efa8a77e23656f6e7945275b19e9deed80261')
237
+ * const envelope = TxEnvelopeEip2930.from('0x01f858018203118502540be4008504a817c800809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c08477359400e1a001627c687261b0e7f8638af1112efa8a77e23656f6e7945275b19e9deed80261')
242
238
  * // @log: {
243
239
  * // @log: chainId: 1,
244
240
  * // @log: gasPrice: 10000000000n,
@@ -250,25 +246,20 @@ export declare namespace deserialize {
250
246
  *
251
247
  * @param envelope - The transaction object to convert.
252
248
  * @param options - Options.
253
- * @returns A {@link ox#TransactionEnvelopeEip2930.TransactionEnvelopeEip2930}
249
+ * @returns A {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930}
254
250
  */
255
251
  export function from<
256
- const envelope extends
257
- | UnionPartialBy<TransactionEnvelopeEip2930, 'type'>
258
- | Serialized,
252
+ const envelope extends UnionPartialBy<TxEnvelopeEip2930, 'type'> | Serialized,
259
253
  const signature extends Signature.Signature | undefined = undefined,
260
254
  >(
261
- envelope:
262
- | envelope
263
- | UnionPartialBy<TransactionEnvelopeEip2930, 'type'>
264
- | Serialized,
255
+ envelope: envelope | UnionPartialBy<TxEnvelopeEip2930, 'type'> | Serialized,
265
256
  options: from.Options<signature> = {},
266
257
  ): from.ReturnType<envelope, signature> {
267
258
  const { signature } = options
268
259
 
269
260
  const envelope_ = (
270
261
  typeof envelope === 'string' ? deserialize(envelope) : envelope
271
- ) as TransactionEnvelopeEip2930
262
+ ) as TxEnvelopeEip2930
272
263
 
273
264
  assert(envelope_)
274
265
 
@@ -286,13 +277,13 @@ export declare namespace from {
286
277
  }
287
278
 
288
279
  type ReturnType<
289
- envelope extends
290
- | UnionPartialBy<TransactionEnvelopeEip2930, 'type'>
291
- | Hex.Hex = TransactionEnvelopeEip2930 | Hex.Hex,
280
+ envelope extends UnionPartialBy<TxEnvelopeEip2930, 'type'> | Hex.Hex =
281
+ | TxEnvelopeEip2930
282
+ | Hex.Hex,
292
283
  signature extends Signature.Signature | undefined = undefined,
293
284
  > = Compute<
294
285
  envelope extends Hex.Hex
295
- ? TransactionEnvelopeEip2930
286
+ ? TxEnvelopeEip2930
296
287
  : Assign<
297
288
  envelope,
298
289
  (signature extends Signature.Signature ? Readonly<signature> : {}) & {
@@ -308,16 +299,16 @@ export declare namespace from {
308
299
  }
309
300
 
310
301
  /**
311
- * Returns the payload to sign for a {@link ox#TransactionEnvelopeEip2930.TransactionEnvelopeEip2930}.
302
+ * Returns the payload to sign for a {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930}.
312
303
  *
313
304
  * @example
314
305
  * The example below demonstrates how to compute the sign payload which can be used
315
306
  * with ECDSA signing utilities like {@link ox#Secp256k1.(sign:function)}.
316
307
  *
317
308
  * ```ts twoslash
318
- * import { Secp256k1, TransactionEnvelopeEip2930 } from 'ox'
309
+ * import { Secp256k1, TxEnvelopeEip2930 } from 'ox'
319
310
  *
320
- * const envelope = TransactionEnvelopeEip2930.from({
311
+ * const envelope = TxEnvelopeEip2930.from({
321
312
  * chainId: 1,
322
313
  * nonce: 0n,
323
314
  * gasPrice: 1000000000n,
@@ -326,7 +317,7 @@ export declare namespace from {
326
317
  * value: 1000000000000000000n,
327
318
  * })
328
319
  *
329
- * const payload = TransactionEnvelopeEip2930.getSignPayload(envelope) // [!code focus]
320
+ * const payload = TxEnvelopeEip2930.getSignPayload(envelope) // [!code focus]
330
321
  * // @log: '0x...'
331
322
  *
332
323
  * const signature = Secp256k1.sign({ payload, privateKey: '0x...' })
@@ -336,7 +327,7 @@ export declare namespace from {
336
327
  * @returns The sign payload.
337
328
  */
338
329
  export function getSignPayload(
339
- envelope: TransactionEnvelopeEip2930,
330
+ envelope: TxEnvelopeEip2930,
340
331
  ): getSignPayload.ReturnType {
341
332
  return hash(envelope, { presign: true })
342
333
  }
@@ -348,13 +339,13 @@ export declare namespace getSignPayload {
348
339
  }
349
340
 
350
341
  /**
351
- * Hashes a {@link ox#TransactionEnvelopeEip2930.TransactionEnvelopeEip2930}. This is the "transaction hash".
342
+ * Hashes a {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930}. This is the "transaction hash".
352
343
  *
353
344
  * @example
354
345
  * ```ts twoslash
355
- * import { Secp256k1, TransactionEnvelopeEip2930 } from 'ox'
346
+ * import { Secp256k1, TxEnvelopeEip2930 } from 'ox'
356
347
  *
357
- * const envelope = TransactionEnvelopeEip2930.from({
348
+ * const envelope = TxEnvelopeEip2930.from({
358
349
  * chainId: 1,
359
350
  * nonce: 0n,
360
351
  * gasPrice: 1000000000n,
@@ -364,15 +355,15 @@ export declare namespace getSignPayload {
364
355
  * })
365
356
  *
366
357
  * const signature = Secp256k1.sign({
367
- * payload: TransactionEnvelopeEip2930.getSignPayload(envelope),
358
+ * payload: TxEnvelopeEip2930.getSignPayload(envelope),
368
359
  * privateKey: '0x...',
369
360
  * })
370
361
  *
371
- * const envelope_signed = TransactionEnvelopeEip2930.from(envelope, {
362
+ * const envelope_signed = TxEnvelopeEip2930.from(envelope, {
372
363
  * signature,
373
364
  * })
374
365
  *
375
- * const hash = TransactionEnvelopeEip2930.hash(envelope_signed) // [!code focus]
366
+ * const hash = TxEnvelopeEip2930.hash(envelope_signed) // [!code focus]
376
367
  * ```
377
368
  *
378
369
  * @param envelope - The EIP-2930 Transaction Envelope to hash.
@@ -380,7 +371,7 @@ export declare namespace getSignPayload {
380
371
  * @returns The hash of the transaction envelope.
381
372
  */
382
373
  export function hash<presign extends boolean = false>(
383
- envelope: TransactionEnvelopeEip2930<presign extends true ? false : true>,
374
+ envelope: TxEnvelopeEip2930<presign extends true ? false : true>,
384
375
  options: hash.Options<presign> = {},
385
376
  ): hash.ReturnType {
386
377
  const { presign } = options
@@ -414,20 +405,20 @@ export declare namespace hash {
414
405
  }
415
406
 
416
407
  /**
417
- * Serializes a {@link ox#TransactionEnvelopeEip2930.TransactionEnvelopeEip2930}.
408
+ * Serializes a {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930}.
418
409
  *
419
410
  * @example
420
411
  * ```ts twoslash
421
- * import { TransactionEnvelopeEip2930, Value } from 'ox'
412
+ * import { TxEnvelopeEip2930, Value } from 'ox'
422
413
  *
423
- * const envelope = TransactionEnvelopeEip2930.from({
414
+ * const envelope = TxEnvelopeEip2930.from({
424
415
  * chainId: 1,
425
416
  * gasPrice: Value.fromGwei('10'),
426
417
  * to: '0x0000000000000000000000000000000000000000',
427
418
  * value: Value.fromEther('1'),
428
419
  * })
429
420
  *
430
- * const serialized = TransactionEnvelopeEip2930.serialize(envelope) // [!code focus]
421
+ * const serialized = TxEnvelopeEip2930.serialize(envelope) // [!code focus]
431
422
  * ```
432
423
  *
433
424
  * @example
@@ -436,9 +427,9 @@ export declare namespace hash {
436
427
  * It is possible to attach a `signature` to the serialized Transaction Envelope.
437
428
  *
438
429
  * ```ts twoslash
439
- * import { Secp256k1, TransactionEnvelopeEip2930, Value } from 'ox'
430
+ * import { Secp256k1, TxEnvelopeEip2930, Value } from 'ox'
440
431
  *
441
- * const envelope = TransactionEnvelopeEip2930.from({
432
+ * const envelope = TxEnvelopeEip2930.from({
442
433
  * chainId: 1,
443
434
  * gasPrice: Value.fromGwei('10'),
444
435
  * to: '0x0000000000000000000000000000000000000000',
@@ -446,11 +437,11 @@ export declare namespace hash {
446
437
  * })
447
438
  *
448
439
  * const signature = Secp256k1.sign({
449
- * payload: TransactionEnvelopeEip2930.getSignPayload(envelope),
440
+ * payload: TxEnvelopeEip2930.getSignPayload(envelope),
450
441
  * privateKey: '0x...',
451
442
  * })
452
443
  *
453
- * const serialized = TransactionEnvelopeEip2930.serialize(envelope, { // [!code focus]
444
+ * const serialized = TxEnvelopeEip2930.serialize(envelope, { // [!code focus]
454
445
  * signature, // [!code focus]
455
446
  * }) // [!code focus]
456
447
  *
@@ -462,7 +453,7 @@ export declare namespace hash {
462
453
  * @returns The serialized Transaction Envelope.
463
454
  */
464
455
  export function serialize(
465
- envelope: PartialBy<TransactionEnvelopeEip2930, 'type'>,
456
+ envelope: PartialBy<TxEnvelopeEip2930, 'type'>,
466
457
  options: serialize.Options = {},
467
458
  ): Serialized {
468
459
  const { chainId, gas, data, input, nonce, to, value, accessList, gasPrice } =
@@ -505,13 +496,13 @@ export declare namespace serialize {
505
496
  }
506
497
 
507
498
  /**
508
- * Converts an {@link ox#TransactionEnvelopeEip2930.TransactionEnvelopeEip2930} to an {@link ox#TransactionEnvelopeEip2930.Rpc}.
499
+ * Converts an {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930} to an {@link ox#TxEnvelopeEip2930.Rpc}.
509
500
  *
510
501
  * @example
511
502
  * ```ts twoslash
512
- * import { RpcRequest, TransactionEnvelopeEip2930, Value } from 'ox'
503
+ * import { RpcRequest, TxEnvelopeEip2930, Value } from 'ox'
513
504
  *
514
- * const envelope = TransactionEnvelopeEip2930.from({
505
+ * const envelope = TxEnvelopeEip2930.from({
515
506
  * chainId: 1,
516
507
  * nonce: 0n,
517
508
  * gas: 21000n,
@@ -520,7 +511,7 @@ export declare namespace serialize {
520
511
  * value: Value.fromEther('1'),
521
512
  * })
522
513
  *
523
- * const envelope_rpc = TransactionEnvelopeEip2930.toRpc(envelope) // [!code focus]
514
+ * const envelope_rpc = TxEnvelopeEip2930.toRpc(envelope) // [!code focus]
524
515
  *
525
516
  * const request = RpcRequest.from({
526
517
  * id: 0,
@@ -532,7 +523,7 @@ export declare namespace serialize {
532
523
  * @param envelope - The EIP-2930 transaction envelope to convert.
533
524
  * @returns An RPC-formatted EIP-2930 transaction envelope.
534
525
  */
535
- export function toRpc(envelope: Omit<TransactionEnvelopeEip2930, 'type'>): Rpc {
526
+ export function toRpc(envelope: Omit<TxEnvelopeEip2930, 'type'>): Rpc {
536
527
  const signature = Signature.extract(envelope)!
537
528
 
538
529
  return {
@@ -561,13 +552,13 @@ export declare namespace toRpc {
561
552
  }
562
553
 
563
554
  /**
564
- * Validates a {@link ox#TransactionEnvelopeEip2930.TransactionEnvelopeEip2930}. Returns `true` if the envelope is valid, `false` otherwise.
555
+ * Validates a {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930}. Returns `true` if the envelope is valid, `false` otherwise.
565
556
  *
566
557
  * @example
567
558
  * ```ts twoslash
568
- * import { TransactionEnvelopeEip2930, Value } from 'ox'
559
+ * import { TxEnvelopeEip2930, Value } from 'ox'
569
560
  *
570
- * const valid = TransactionEnvelopeEip2930.assert({
561
+ * const valid = TxEnvelopeEip2930.assert({
571
562
  * gasPrice: 2n ** 256n - 1n + 1n,
572
563
  * chainId: 1,
573
564
  * to: '0x0000000000000000000000000000000000000000',
@@ -578,9 +569,7 @@ export declare namespace toRpc {
578
569
  *
579
570
  * @param envelope - The transaction envelope to validate.
580
571
  */
581
- export function validate(
582
- envelope: PartialBy<TransactionEnvelopeEip2930, 'type'>,
583
- ) {
572
+ export function validate(envelope: PartialBy<TxEnvelopeEip2930, 'type'>) {
584
573
  try {
585
574
  assert(envelope)
586
575
  return true