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 TransactionEnvelopeEip1559<
16
+ export type TxEnvelopeEip1559<
17
17
  signed extends boolean = boolean,
18
18
  bigintType = bigint,
19
19
  numberType = number,
@@ -29,7 +29,7 @@ export type TransactionEnvelopeEip1559<
29
29
  }
30
30
  >
31
31
 
32
- export type Rpc<signed extends boolean = boolean> = TransactionEnvelopeEip1559<
32
+ export type Rpc<signed extends boolean = boolean> = TxEnvelopeEip1559<
33
33
  signed,
34
34
  Hex.Hex,
35
35
  Hex.Hex,
@@ -41,19 +41,19 @@ export type Serialized = `${SerializedType}${string}`
41
41
  export const serializedType = '0x02' as const
42
42
  export type SerializedType = typeof serializedType
43
43
 
44
- export type Signed = TransactionEnvelopeEip1559<true>
44
+ export type Signed = TxEnvelopeEip1559<true>
45
45
 
46
46
  export const type = 'eip1559' as const
47
47
  export type Type = typeof type
48
48
 
49
49
  /**
50
- * Asserts a {@link ox#TransactionEnvelopeEip1559.TransactionEnvelopeEip1559} is valid.
50
+ * Asserts a {@link ox#TxEnvelopeEip1559.TxEnvelopeEip1559} is valid.
51
51
  *
52
52
  * @example
53
53
  * ```ts twoslash
54
- * import { TransactionEnvelopeEip1559, Value } from 'ox'
54
+ * import { TxEnvelopeEip1559, Value } from 'ox'
55
55
  *
56
- * TransactionEnvelopeEip1559.assert({
56
+ * TxEnvelopeEip1559.assert({
57
57
  * maxFeePerGas: 2n ** 256n - 1n + 1n,
58
58
  * chainId: 1,
59
59
  * to: '0x0000000000000000000000000000000000000000',
@@ -66,9 +66,7 @@ export type Type = typeof type
66
66
  *
67
67
  * @param envelope - The transaction envelope to assert.
68
68
  */
69
- export function assert(
70
- envelope: PartialBy<TransactionEnvelopeEip1559, 'type'>,
71
- ) {
69
+ export function assert(envelope: PartialBy<TxEnvelopeEip1559, 'type'>) {
72
70
  const { chainId, maxPriorityFeePerGas, maxFeePerGas, to } = envelope
73
71
  if (chainId <= 0)
74
72
  throw new TransactionEnvelope.InvalidChainIdError({ chainId })
@@ -96,13 +94,13 @@ export declare namespace assert {
96
94
  }
97
95
 
98
96
  /**
99
- * Deserializes a {@link ox#TransactionEnvelopeEip1559.TransactionEnvelopeEip1559} from its serialized form.
97
+ * Deserializes a {@link ox#TxEnvelopeEip1559.TxEnvelopeEip1559} from its serialized form.
100
98
  *
101
99
  * @example
102
100
  * ```ts twoslash
103
- * import { TransactionEnvelopeEip1559 } from 'ox'
101
+ * import { TxEnvelopeEip1559 } from 'ox'
104
102
  *
105
- * const envelope = TransactionEnvelopeEip1559.deserialize('0x02ef0182031184773594008477359400809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c0')
103
+ * const envelope = TxEnvelopeEip1559.deserialize('0x02ef0182031184773594008477359400809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c0')
106
104
  * // @log: {
107
105
  * // @log: type: 'eip1559',
108
106
  * // @log: nonce: 785n,
@@ -118,7 +116,7 @@ export declare namespace assert {
118
116
  */
119
117
  export function deserialize(
120
118
  serialized: Serialized,
121
- ): Compute<TransactionEnvelopeEip1559> {
119
+ ): Compute<TxEnvelopeEip1559> {
122
120
  const transactionArray = Rlp.toHex(Hex.slice(serialized, 1))
123
121
 
124
122
  const [
@@ -163,7 +161,7 @@ export function deserialize(
163
161
  let transaction = {
164
162
  chainId: Number(chainId),
165
163
  type,
166
- } as TransactionEnvelopeEip1559
164
+ } as TxEnvelopeEip1559
167
165
  if (Hex.validate(to) && to !== '0x') transaction.to = to
168
166
  if (Hex.validate(gas) && gas !== '0x') transaction.gas = BigInt(gas)
169
167
  if (Hex.validate(data) && data !== '0x') transaction.data = data
@@ -183,7 +181,7 @@ export function deserialize(
183
181
  transaction = {
184
182
  ...transaction,
185
183
  ...signature,
186
- } as TransactionEnvelopeEip1559
184
+ } as TxEnvelopeEip1559
187
185
 
188
186
  assert(transaction)
189
187
 
@@ -199,9 +197,9 @@ export declare namespace deserialize {
199
197
  *
200
198
  * @example
201
199
  * ```ts twoslash
202
- * import { TransactionEnvelopeEip1559, Value } from 'ox'
200
+ * import { TxEnvelopeEip1559, Value } from 'ox'
203
201
  *
204
- * const envelope = TransactionEnvelopeEip1559.from({
202
+ * const envelope = TxEnvelopeEip1559.from({
205
203
  * chainId: 1,
206
204
  * maxFeePerGas: Value.fromGwei('10'),
207
205
  * maxPriorityFeePerGas: Value.fromGwei('1'),
@@ -216,9 +214,9 @@ export declare namespace deserialize {
216
214
  * It is possible to attach a `signature` to the transaction envelope.
217
215
  *
218
216
  * ```ts twoslash
219
- * import { Secp256k1, TransactionEnvelopeEip1559, Value } from 'ox'
217
+ * import { Secp256k1, TxEnvelopeEip1559, Value } from 'ox'
220
218
  *
221
- * const envelope = TransactionEnvelopeEip1559.from({
219
+ * const envelope = TxEnvelopeEip1559.from({
222
220
  * chainId: 1,
223
221
  * maxFeePerGas: Value.fromGwei('10'),
224
222
  * maxPriorityFeePerGas: Value.fromGwei('1'),
@@ -227,11 +225,11 @@ export declare namespace deserialize {
227
225
  * })
228
226
  *
229
227
  * const signature = Secp256k1.sign({
230
- * payload: TransactionEnvelopeEip1559.getSignPayload(envelope),
228
+ * payload: TxEnvelopeEip1559.getSignPayload(envelope),
231
229
  * privateKey: '0x...',
232
230
  * })
233
231
  *
234
- * const envelope_signed = TransactionEnvelopeEip1559.from(envelope, { // [!code focus]
232
+ * const envelope_signed = TxEnvelopeEip1559.from(envelope, { // [!code focus]
235
233
  * signature, // [!code focus]
236
234
  * }) // [!code focus]
237
235
  * // @log: {
@@ -250,12 +248,12 @@ export declare namespace deserialize {
250
248
  * @example
251
249
  * ### From Serialized
252
250
  *
253
- * It is possible to instantiate an EIP-1559 Transaction Envelope from a {@link ox#TransactionEnvelopeEip1559.Serialized} value.
251
+ * It is possible to instantiate an EIP-1559 Transaction Envelope from a {@link ox#TxEnvelopeEip1559.Serialized} value.
254
252
  *
255
253
  * ```ts twoslash
256
- * import { TransactionEnvelopeEip1559 } from 'ox'
254
+ * import { TxEnvelopeEip1559 } from 'ox'
257
255
  *
258
- * const envelope = TransactionEnvelopeEip1559.from('0x02f858018203118502540be4008504a817c800809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c08477359400e1a001627c687261b0e7f8638af1112efa8a77e23656f6e7945275b19e9deed80261')
256
+ * const envelope = TxEnvelopeEip1559.from('0x02f858018203118502540be4008504a817c800809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c08477359400e1a001627c687261b0e7f8638af1112efa8a77e23656f6e7945275b19e9deed80261')
259
257
  * // @log: {
260
258
  * // @log: chainId: 1,
261
259
  * // @log: maxFeePerGas: 10000000000n,
@@ -271,22 +269,17 @@ export declare namespace deserialize {
271
269
  * @returns An EIP-1559 Transaction Envelope.
272
270
  */
273
271
  export function from<
274
- const envelope extends
275
- | UnionPartialBy<TransactionEnvelopeEip1559, 'type'>
276
- | Serialized,
272
+ const envelope extends UnionPartialBy<TxEnvelopeEip1559, 'type'> | Serialized,
277
273
  const signature extends Signature.Signature | undefined = undefined,
278
274
  >(
279
- envelope:
280
- | envelope
281
- | UnionPartialBy<TransactionEnvelopeEip1559, 'type'>
282
- | Serialized,
275
+ envelope: envelope | UnionPartialBy<TxEnvelopeEip1559, 'type'> | Serialized,
283
276
  options: from.Options<signature> = {},
284
277
  ): from.ReturnType<envelope, signature> {
285
278
  const { signature } = options
286
279
 
287
280
  const envelope_ = (
288
281
  typeof envelope === 'string' ? deserialize(envelope) : envelope
289
- ) as TransactionEnvelopeEip1559
282
+ ) as TxEnvelopeEip1559
290
283
 
291
284
  assert(envelope_)
292
285
 
@@ -304,13 +297,13 @@ export declare namespace from {
304
297
  }
305
298
 
306
299
  type ReturnType<
307
- envelope extends
308
- | UnionPartialBy<TransactionEnvelopeEip1559, 'type'>
309
- | Hex.Hex = TransactionEnvelopeEip1559 | Hex.Hex,
300
+ envelope extends UnionPartialBy<TxEnvelopeEip1559, 'type'> | Hex.Hex =
301
+ | TxEnvelopeEip1559
302
+ | Hex.Hex,
310
303
  signature extends Signature.Signature | undefined = undefined,
311
304
  > = Compute<
312
305
  envelope extends Hex.Hex
313
- ? TransactionEnvelopeEip1559
306
+ ? TxEnvelopeEip1559
314
307
  : Assign<
315
308
  envelope,
316
309
  (signature extends Signature.Signature ? Readonly<signature> : {}) & {
@@ -326,16 +319,16 @@ export declare namespace from {
326
319
  }
327
320
 
328
321
  /**
329
- * Returns the payload to sign for a {@link ox#TransactionEnvelopeEip1559.TransactionEnvelopeEip1559}.
322
+ * Returns the payload to sign for a {@link ox#TxEnvelopeEip1559.TxEnvelopeEip1559}.
330
323
  *
331
324
  * @example
332
325
  * The example below demonstrates how to compute the sign payload which can be used
333
326
  * with ECDSA signing utilities like {@link ox#Secp256k1.(sign:function)}.
334
327
  *
335
328
  * ```ts twoslash
336
- * import { Secp256k1, TransactionEnvelopeEip1559 } from 'ox'
329
+ * import { Secp256k1, TxEnvelopeEip1559 } from 'ox'
337
330
  *
338
- * const envelope = TransactionEnvelopeEip1559.from({
331
+ * const envelope = TxEnvelopeEip1559.from({
339
332
  * chainId: 1,
340
333
  * nonce: 0n,
341
334
  * maxFeePerGas: 1000000000n,
@@ -344,7 +337,7 @@ export declare namespace from {
344
337
  * value: 1000000000000000000n,
345
338
  * })
346
339
  *
347
- * const payload = TransactionEnvelopeEip1559.getSignPayload(envelope) // [!code focus]
340
+ * const payload = TxEnvelopeEip1559.getSignPayload(envelope) // [!code focus]
348
341
  * // @log: '0x...'
349
342
  *
350
343
  * const signature = Secp256k1.sign({ payload, privateKey: '0x...' })
@@ -354,7 +347,7 @@ export declare namespace from {
354
347
  * @returns The sign payload.
355
348
  */
356
349
  export function getSignPayload(
357
- envelope: TransactionEnvelopeEip1559,
350
+ envelope: TxEnvelopeEip1559,
358
351
  ): getSignPayload.ReturnType {
359
352
  return hash(envelope, { presign: true })
360
353
  }
@@ -366,13 +359,13 @@ export declare namespace getSignPayload {
366
359
  }
367
360
 
368
361
  /**
369
- * Hashes a {@link ox#TransactionEnvelopeEip1559.TransactionEnvelopeEip1559}. This is the "transaction hash".
362
+ * Hashes a {@link ox#TxEnvelopeEip1559.TxEnvelopeEip1559}. This is the "transaction hash".
370
363
  *
371
364
  * @example
372
365
  * ```ts twoslash
373
- * import { Secp256k1, TransactionEnvelopeEip1559 } from 'ox'
366
+ * import { Secp256k1, TxEnvelopeEip1559 } from 'ox'
374
367
  *
375
- * const envelope = TransactionEnvelopeEip1559.from({
368
+ * const envelope = TxEnvelopeEip1559.from({
376
369
  * chainId: 1,
377
370
  * nonce: 0n,
378
371
  * maxFeePerGas: 1000000000n,
@@ -382,13 +375,13 @@ export declare namespace getSignPayload {
382
375
  * })
383
376
  *
384
377
  * const signature = Secp256k1.sign({
385
- * payload: TransactionEnvelopeEip1559.getSignPayload(envelope),
378
+ * payload: TxEnvelopeEip1559.getSignPayload(envelope),
386
379
  * privateKey: '0x...'
387
380
  * })
388
381
  *
389
- * const envelope_signed = TransactionEnvelopeEip1559.from(envelope, { signature })
382
+ * const envelope_signed = TxEnvelopeEip1559.from(envelope, { signature })
390
383
  *
391
- * const hash = TransactionEnvelopeEip1559.hash(envelope_signed) // [!code focus]
384
+ * const hash = TxEnvelopeEip1559.hash(envelope_signed) // [!code focus]
392
385
  * ```
393
386
  *
394
387
  * @param envelope - The EIP-1559 Transaction Envelope to hash.
@@ -396,7 +389,7 @@ export declare namespace getSignPayload {
396
389
  * @returns The hash of the transaction envelope.
397
390
  */
398
391
  export function hash<presign extends boolean = false>(
399
- envelope: TransactionEnvelopeEip1559<presign extends true ? false : true>,
392
+ envelope: TxEnvelopeEip1559<presign extends true ? false : true>,
400
393
  options: hash.Options<presign> = {},
401
394
  ): hash.ReturnType {
402
395
  const { presign } = options
@@ -430,13 +423,13 @@ export declare namespace hash {
430
423
  }
431
424
 
432
425
  /**
433
- * Serializes a {@link ox#TransactionEnvelopeEip1559.TransactionEnvelopeEip1559}.
426
+ * Serializes a {@link ox#TxEnvelopeEip1559.TxEnvelopeEip1559}.
434
427
  *
435
428
  * @example
436
429
  * ```ts twoslash
437
- * import { TransactionEnvelopeEip1559, Value } from 'ox'
430
+ * import { TxEnvelopeEip1559, Value } from 'ox'
438
431
  *
439
- * const envelope = TransactionEnvelopeEip1559.from({
432
+ * const envelope = TxEnvelopeEip1559.from({
440
433
  * chainId: 1,
441
434
  * maxFeePerGas: Value.fromGwei('10'),
442
435
  * maxPriorityFeePerGas: Value.fromGwei('1'),
@@ -444,7 +437,7 @@ export declare namespace hash {
444
437
  * value: Value.fromEther('1'),
445
438
  * })
446
439
  *
447
- * const serialized = TransactionEnvelopeEip1559.serialize(envelope) // [!code focus]
440
+ * const serialized = TxEnvelopeEip1559.serialize(envelope) // [!code focus]
448
441
  * ```
449
442
  *
450
443
  * @example
@@ -453,9 +446,9 @@ export declare namespace hash {
453
446
  * It is possible to attach a `signature` to the serialized Transaction Envelope.
454
447
  *
455
448
  * ```ts twoslash
456
- * import { Secp256k1, TransactionEnvelopeEip1559, Value } from 'ox'
449
+ * import { Secp256k1, TxEnvelopeEip1559, Value } from 'ox'
457
450
  *
458
- * const envelope = TransactionEnvelopeEip1559.from({
451
+ * const envelope = TxEnvelopeEip1559.from({
459
452
  * chainId: 1,
460
453
  * maxFeePerGas: Value.fromGwei('10'),
461
454
  * maxPriorityFeePerGas: Value.fromGwei('1'),
@@ -464,11 +457,11 @@ export declare namespace hash {
464
457
  * })
465
458
  *
466
459
  * const signature = Secp256k1.sign({
467
- * payload: TransactionEnvelopeEip1559.getSignPayload(envelope),
460
+ * payload: TxEnvelopeEip1559.getSignPayload(envelope),
468
461
  * privateKey: '0x...',
469
462
  * })
470
463
  *
471
- * const serialized = TransactionEnvelopeEip1559.serialize(envelope, { // [!code focus]
464
+ * const serialized = TxEnvelopeEip1559.serialize(envelope, { // [!code focus]
472
465
  * signature, // [!code focus]
473
466
  * }) // [!code focus]
474
467
  *
@@ -480,7 +473,7 @@ export declare namespace hash {
480
473
  * @returns The serialized Transaction Envelope.
481
474
  */
482
475
  export function serialize(
483
- envelope: PartialBy<TransactionEnvelopeEip1559, 'type'>,
476
+ envelope: PartialBy<TxEnvelopeEip1559, 'type'>,
484
477
  options: serialize.Options = {},
485
478
  ): Serialized {
486
479
  const {
@@ -534,13 +527,13 @@ export declare namespace serialize {
534
527
  }
535
528
 
536
529
  /**
537
- * Converts an {@link ox#TransactionEnvelopeEip1559.TransactionEnvelopeEip1559} to an {@link ox#TransactionEnvelopeEip1559.Rpc}.
530
+ * Converts an {@link ox#TxEnvelopeEip1559.TxEnvelopeEip1559} to an {@link ox#TxEnvelopeEip1559.Rpc}.
538
531
  *
539
532
  * @example
540
533
  * ```ts twoslash
541
- * import { RpcRequest, TransactionEnvelopeEip1559, Value } from 'ox'
534
+ * import { RpcRequest, TxEnvelopeEip1559, Value } from 'ox'
542
535
  *
543
- * const envelope = TransactionEnvelopeEip1559.from({
536
+ * const envelope = TxEnvelopeEip1559.from({
544
537
  * chainId: 1,
545
538
  * nonce: 0n,
546
539
  * gas: 21000n,
@@ -548,7 +541,7 @@ export declare namespace serialize {
548
541
  * value: Value.fromEther('1'),
549
542
  * })
550
543
  *
551
- * const envelope_rpc = TransactionEnvelopeEip1559.toRpc(envelope) // [!code focus]
544
+ * const envelope_rpc = TxEnvelopeEip1559.toRpc(envelope) // [!code focus]
552
545
  *
553
546
  * const request = RpcRequest.from({
554
547
  * id: 0,
@@ -560,7 +553,7 @@ export declare namespace serialize {
560
553
  * @param envelope - The EIP-1559 transaction envelope to convert.
561
554
  * @returns An RPC-formatted EIP-1559 transaction envelope.
562
555
  */
563
- export function toRpc(envelope: Omit<TransactionEnvelopeEip1559, 'type'>): Rpc {
556
+ export function toRpc(envelope: Omit<TxEnvelopeEip1559, 'type'>): Rpc {
564
557
  const signature = Signature.extract(envelope)
565
558
 
566
559
  return {
@@ -594,13 +587,13 @@ export declare namespace toRpc {
594
587
  }
595
588
 
596
589
  /**
597
- * Validates a {@link ox#TransactionEnvelopeEip1559.TransactionEnvelopeEip1559}. Returns `true` if the envelope is valid, `false` otherwise.
590
+ * Validates a {@link ox#TxEnvelopeEip1559.TxEnvelopeEip1559}. Returns `true` if the envelope is valid, `false` otherwise.
598
591
  *
599
592
  * @example
600
593
  * ```ts twoslash
601
- * import { TransactionEnvelopeEip1559, Value } from 'ox'
594
+ * import { TxEnvelopeEip1559, Value } from 'ox'
602
595
  *
603
- * const valid = TransactionEnvelopeEip1559.assert({
596
+ * const valid = TxEnvelopeEip1559.assert({
604
597
  * maxFeePerGas: 2n ** 256n - 1n + 1n,
605
598
  * chainId: 1,
606
599
  * to: '0x0000000000000000000000000000000000000000',
@@ -611,9 +604,7 @@ export declare namespace toRpc {
611
604
  *
612
605
  * @param envelope - The transaction envelope to validate.
613
606
  */
614
- export function validate(
615
- envelope: PartialBy<TransactionEnvelopeEip1559, 'type'>,
616
- ) {
607
+ export function validate(envelope: PartialBy<TxEnvelopeEip1559, 'type'>) {
617
608
  try {
618
609
  assert(envelope)
619
610
  return true