Skip to content

Commit f8bf590

Browse files
committed
feat: rename TransactionEnvelope* to TxEnvelope*
1 parent c7491e5 commit f8bf590

32 files changed

+1396
-1718
lines changed

.changeset/rich-plants-trade.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"ox": minor
3+
---
4+
5+
Renamed `TransactionEnvelope*` to `TxEnvelope*`.

.github/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ As an unopinionated Standard Library, it is designed to be used by higher-level
4545
The example below demonstrates how to construct, sign, and broadcast a transaction envelope using Ox:
4646

4747
```ts
48-
import { Provider, Secp256k1, TransactionEnvelopeEip1559, Value } from 'ox'
48+
import { Provider, Secp256k1, TxEnvelopeEip1559, Value } from 'ox'
4949

5050
// 1. Construct a transaction envelope.
51-
const envelope = TransactionEnvelopeEip1559.from({
51+
const envelope = TxEnvelopeEip1559.from({
5252
chainId: 1,
5353
gas: 21000n,
5454
nonce: 0n,
@@ -59,13 +59,13 @@ const envelope = TransactionEnvelopeEip1559.from({
5959
})
6060

6161
// 2. Get the signing payload for the envelope.
62-
const payload = TransactionEnvelopeEip1559.getSignPayload(envelope)
62+
const payload = TxEnvelopeEip1559.getSignPayload(envelope)
6363

6464
// 3. Sign the payload with your private key using secp256k1.
6565
const signature = Secp256k1.sign({ payload, privateKey: '0x...' })
6666

6767
// 4. Serialize the envelope with the signature.
68-
const serialized = TransactionEnvelopeEip1559.serialize(envelope, { signature })
68+
const serialized = TxEnvelopeEip1559.serialize(envelope, { signature })
6969

7070
// 5. Broadcast the envelope to the network.
7171
const provider = Provider.from(window.ethereum)

site/pages/guides/transaction-envelopes.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@ utilized to construct Transactions to be broadcast to a network.
77

88
Ox supports the core Ethereum Transaction Envelope types:
99

10-
| Module | Name | Type |
11-
| --------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------ |
12-
| [`TransactionEnvelopeLegacy`](/api/TransactionEnvelopeLegacy) | Legacy Transactions | `0x00` |
13-
| [`TransactionEnvelopeEip2930`](/api/TransactionEnvelopeEip2930) | [EIP-2930: Access List Transactions](https://eips.ethereum.org/EIPS/eip-2930) | `0x01` |
14-
| [`TransactionEnvelopeEip1559`](/api/TransactionEnvelopeEip1559) | [EIP-1559: Fee Market Transactions](https://eips.ethereum.org/EIPS/eip-1559) | `0x02` |
15-
| [`TransactionEnvelopeEip4844`](/api/TransactionEnvelopeEip4844) | [EIP-4844: Blob Transactions](https://eips.ethereum.org/EIPS/eip-4844) | `0x03` |
16-
| [`TransactionEnvelopeEip7702`](/api/TransactionEnvelopeEip7702) | [EIP-7702: Authorization Transactions](https://eips.ethereum.org/EIPS/eip-7702) | `0x04` |
10+
| Module | Name | Type |
11+
| --------------------------------------------- | ------------------------------------------------------------------------------- | ------ |
12+
| [`TxEnvelopeLegacy`](/api/TxEnvelopeLegacy) | Legacy Transactions | `0x00` |
13+
| [`TxEnvelopeEip2930`](/api/TxEnvelopeEip2930) | [EIP-2930: Access List Transactions](https://eips.ethereum.org/EIPS/eip-2930) | `0x01` |
14+
| [`TxEnvelopeEip1559`](/api/TxEnvelopeEip1559) | [EIP-1559: Fee Market Transactions](https://eips.ethereum.org/EIPS/eip-1559) | `0x02` |
15+
| [`TxEnvelopeEip4844`](/api/TxEnvelopeEip4844) | [EIP-4844: Blob Transactions](https://eips.ethereum.org/EIPS/eip-4844) | `0x03` |
16+
| [`TxEnvelopeEip7702`](/api/TxEnvelopeEip7702) | [EIP-7702: Authorization Transactions](https://eips.ethereum.org/EIPS/eip-7702) | `0x04` |
1717

1818
## Examples
1919

2020
### Constructing
2121

2222
A Transaction Envelope can be constructed using the respective `.from` function.
2323

24-
The example below demonstrates how to construct an [EIP-1559 Transaction Envelope](/api/TransactionEnvelopeEip1559) using [`TransactionEnvelopeEip1559.from`](/api/TransactionEnvelopeEip1559/from). EIP-1559 Transactions are the most commonly used Transaction Envelope type.
24+
The example below demonstrates how to construct an [EIP-1559 Transaction Envelope](/api/TxEnvelopeEip1559) using [`TxEnvelopeEip1559.from`](/api/TxEnvelopeEip1559/from). EIP-1559 Transactions are the most commonly used Transaction Envelope type.
2525

2626
```ts twoslash
27-
import { TransactionEnvelopeEip1559, Value } from 'ox'
27+
import { TxEnvelopeEip1559, Value } from 'ox'
2828

29-
const envelope = TransactionEnvelopeEip1559.from({
29+
const envelope = TxEnvelopeEip1559.from({
3030
chainId: 1,
3131
maxFeePerGas: Value.fromGwei('10'),
3232
maxPriorityFeePerGas: Value.fromGwei('1'),
@@ -40,13 +40,13 @@ const envelope = TransactionEnvelopeEip1559.from({
4040

4141
We can sign over a Transaction Envelope by passing the result of the Envelope's `.getSignPayload` function to the respective [Signer's](/guides/ecdsa#signing) `.sign` function.
4242

43-
The example below demonstrates how to sign an [EIP-1559 Transaction Envelope](/api/TransactionEnvelopeEip1559).
43+
The example below demonstrates how to sign an [EIP-1559 Transaction Envelope](/api/TxEnvelopeEip1559).
4444

4545
```ts twoslash
46-
import { TransactionEnvelopeEip1559, Secp256k1, Value } from 'ox'
46+
import { TxEnvelopeEip1559, Secp256k1, Value } from 'ox'
4747

4848
// Construct the Envelope.
49-
const envelope = TransactionEnvelopeEip1559.from({
49+
const envelope = TxEnvelopeEip1559.from({
5050
chainId: 1,
5151
maxFeePerGas: Value.fromGwei('10'),
5252
maxPriorityFeePerGas: Value.fromGwei('1'),
@@ -57,12 +57,12 @@ const envelope = TransactionEnvelopeEip1559.from({
5757

5858
// Sign over the Envelope. // [!code focus]
5959
const signature = Secp256k1.sign({ // [!code focus]
60-
payload: TransactionEnvelopeEip1559.getSignPayload(envelope), // [!code focus]
60+
payload: TxEnvelopeEip1559.getSignPayload(envelope), // [!code focus]
6161
privateKey: '0x...', // [!code focus]
6262
}) // [!code focus]
6363

6464
// Attach the Signature to the Envelope. // [!code focus]
65-
const signed = TransactionEnvelopeEip1559.from(envelope, { signature }) // [!code focus]
65+
const signed = TxEnvelopeEip1559.from(envelope, { signature }) // [!code focus]
6666
// ^?
6767

6868

@@ -86,10 +86,10 @@ const signed = TransactionEnvelopeEip1559.from(envelope, { signature }) // [!cod
8686
We can serialize a Transaction Envelope into RLP-encoded format by calling `.serialize`. We can also deserialize an RLP-encoded Transaction Envelope by calling `.deserialize`.
8787

8888
```ts twoslash
89-
import { TransactionEnvelopeEip1559, Secp256k1, Value } from 'ox'
89+
import { TxEnvelopeEip1559, Secp256k1, Value } from 'ox'
9090

9191
// Construct the Envelope.
92-
const envelope = TransactionEnvelopeEip1559.from({
92+
const envelope = TxEnvelopeEip1559.from({
9393
chainId: 1,
9494
maxFeePerGas: Value.fromGwei('10'),
9595
maxPriorityFeePerGas: Value.fromGwei('1'),
@@ -99,13 +99,13 @@ const envelope = TransactionEnvelopeEip1559.from({
9999
})
100100

101101
// Serialize the Envelope. // [!code focus]
102-
const serialized = TransactionEnvelopeEip1559.serialize(envelope) // [!code focus]
102+
const serialized = TxEnvelopeEip1559.serialize(envelope) // [!code focus]
103103
// ^?
104104

105105

106106

107107
// Deserialize the Envelope. // [!code focus]
108-
const deserialized = TransactionEnvelopeEip1559.deserialize(serialized) // [!code focus]
108+
const deserialized = TxEnvelopeEip1559.deserialize(serialized) // [!code focus]
109109
// ^?
110110

111111

@@ -120,10 +120,10 @@ We can send a Transaction Envelope to the network by serializing the signed enve
120120
In this example, we will use [`RpcTransport.fromHttp`](/api/RpcTransport/fromHttp) to broadcast a `eth_sendRawTransaction` request over HTTP JSON-RPC.
121121

122122
```ts twoslash
123-
import { RpcTransport, TransactionEnvelopeEip1559, Secp256k1, Value } from 'ox'
123+
import { RpcTransport, TxEnvelopeEip1559, Secp256k1, Value } from 'ox'
124124

125125
// Construct the Envelope.
126-
const envelope = TransactionEnvelopeEip1559.from({
126+
const envelope = TxEnvelopeEip1559.from({
127127
chainId: 1,
128128
maxFeePerGas: Value.fromGwei('10'),
129129
maxPriorityFeePerGas: Value.fromGwei('1'),
@@ -134,12 +134,12 @@ const envelope = TransactionEnvelopeEip1559.from({
134134

135135
// Sign over the Envelope.
136136
const signature = Secp256k1.sign({
137-
payload: TransactionEnvelopeEip1559.getSignPayload(envelope),
137+
payload: TxEnvelopeEip1559.getSignPayload(envelope),
138138
privateKey: '0x...',
139139
})
140140

141141
// Serialize the Envelope with the Signature. // [!code focus]
142-
const serialized = TransactionEnvelopeEip1559.serialize(envelope, { // [!code focus]
142+
const serialized = TxEnvelopeEip1559.serialize(envelope, { // [!code focus]
143143
signature // [!code focus]
144144
}) // [!code focus]
145145

@@ -164,17 +164,17 @@ interact with a Browser Extension Wallet. You could also use `RpcTransport.fromH
164164

165165
```ts twoslash
166166
import 'ox/window'
167-
import { Provider, TransactionEnvelopeEip1559, Value } from 'ox'
167+
import { Provider, TxEnvelopeEip1559, Value } from 'ox'
168168

169169
// Construct the Envelope.
170-
const envelope = TransactionEnvelopeEip1559.from({
170+
const envelope = TxEnvelopeEip1559.from({
171171
chainId: 1,
172172
to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
173173
value: Value.fromEther('1.5'),
174174
})
175175

176176
// Convert the Envelope to an RPC-compatible format.
177-
const envelope_rpc = TransactionEnvelopeEip1559.toRpc(envelope)
177+
const envelope_rpc = TxEnvelopeEip1559.toRpc(envelope)
178178

179179
// Broadcast the Envelope with `eth_sendTransaction`.
180180
const provider = Provider.from(window.ethereum)
@@ -186,11 +186,11 @@ const hash = await provider.request({
186186

187187
## Related Modules
188188

189-
| Module | Description |
190-
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
191-
| [TransactionEnvelope](/api/TransactionEnvelope) | Errors & Types for working with Transaction Envelopes. |
192-
| [TransactionEnvelopeEip1559](/api/TransactionEnvelopeEip1559) | Utility functions for working with [EIP-1559 Typed Transaction Envelopes](https://eips.ethereum.org/EIPS/eip-1559). |
193-
| [TransactionEnvelopeEip2930](/api/TransactionEnvelopeEip2930) | Utility functions for working with [EIP-2930 Typed Transaction Envelopes](https://eips.ethereum.org/EIPS/eip-2930). |
194-
| [TransactionEnvelopeEip4844](/api/TransactionEnvelopeEip4844) | Utility functions for working with [EIP-4844 Typed Transaction Envelopes](https://eips.ethereum.org/EIPS/eip-4844). |
195-
| [TransactionEnvelopeEip7702](/api/TransactionEnvelopeEip7702) | Utility functions for working with [EIP-7702 Typed Transaction Envelopes](https://eips.ethereum.org/EIPS/eip-7702). |
196-
| [TransactionEnvelopeLegacy](/api/TransactionEnvelopeLegacy) | Utility functions for working with **Legacy Transaction Envelopes**. |
189+
| Module | Description |
190+
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
191+
| [TransactionEnvelope](/api/TransactionEnvelope) | Errors & Types for working with Transaction Envelopes. |
192+
| [TxEnvelopeEip1559](/api/TxEnvelopeEip1559) | Utility functions for working with [EIP-1559 Typed Transaction Envelopes](https://eips.ethereum.org/EIPS/eip-1559). |
193+
| [TxEnvelopeEip2930](/api/TxEnvelopeEip2930) | Utility functions for working with [EIP-2930 Typed Transaction Envelopes](https://eips.ethereum.org/EIPS/eip-2930). |
194+
| [TxEnvelopeEip4844](/api/TxEnvelopeEip4844) | Utility functions for working with [EIP-4844 Typed Transaction Envelopes](https://eips.ethereum.org/EIPS/eip-4844). |
195+
| [TxEnvelopeEip7702](/api/TxEnvelopeEip7702) | Utility functions for working with [EIP-7702 Typed Transaction Envelopes](https://eips.ethereum.org/EIPS/eip-7702). |
196+
| [TxEnvelopeLegacy](/api/TxEnvelopeLegacy) | Utility functions for working with **Legacy Transaction Envelopes**. |

src/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ As an unopinionated Standard Library, it is designed to be used by higher-level
4545
The example below demonstrates how to construct, sign, and broadcast a transaction envelope using Ox:
4646

4747
```ts
48-
import { Provider, Secp256k1, TransactionEnvelopeEip1559, Value } from 'ox'
48+
import { Provider, Secp256k1, TxEnvelopeEip1559, Value } from 'ox'
4949

5050
// 1. Construct a transaction envelope.
51-
const envelope = TransactionEnvelopeEip1559.from({
51+
const envelope = TxEnvelopeEip1559.from({
5252
chainId: 1,
5353
gas: 21000n,
5454
nonce: 0n,
@@ -59,13 +59,13 @@ const envelope = TransactionEnvelopeEip1559.from({
5959
})
6060

6161
// 2. Get the signing payload for the envelope.
62-
const payload = TransactionEnvelopeEip1559.getSignPayload(envelope)
62+
const payload = TxEnvelopeEip1559.getSignPayload(envelope)
6363

6464
// 3. Sign the payload with your private key using secp256k1.
6565
const signature = Secp256k1.sign({ payload, privateKey: '0x...' })
6666

6767
// 4. Serialize the envelope with the signature.
68-
const serialized = TransactionEnvelopeEip1559.serialize(envelope, { signature })
68+
const serialized = TxEnvelopeEip1559.serialize(envelope, { signature })
6969

7070
// 5. Broadcast the envelope to the network.
7171
const provider = Provider.from(window.ethereum)
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ export type BaseSigned<type extends string = string> = Base<type, true>
5555
*
5656
* @example
5757
* ```ts twoslash
58-
* import { TransactionEnvelopeEip1559 } from 'ox'
58+
* import { TxEnvelopeEip1559 } from 'ox'
5959
*
60-
* TransactionEnvelopeEip1559.assert({
60+
* TxEnvelopeEip1559.assert({
6161
* maxFeePerGas: 2n ** 256n - 1n + 1n,
6262
* chainId: 1,
6363
* })
@@ -84,9 +84,9 @@ export class FeeCapTooHighError extends Errors.BaseError {
8484
*
8585
* @example
8686
* ```ts twoslash
87-
* import { TransactionEnvelopeLegacy } from 'ox'
87+
* import { TxEnvelopeLegacy } from 'ox'
8888
*
89-
* TransactionEnvelopeLegacy.assert({
89+
* TxEnvelopeLegacy.assert({
9090
* gasPrice: 2n ** 256n - 1n + 1n,
9191
* chainId: 1,
9292
* })
@@ -113,9 +113,9 @@ export class GasPriceTooHighError extends Errors.BaseError {
113113
*
114114
* @example
115115
* ```ts twoslash
116-
* import { TransactionEnvelopeEip1559 } from 'ox'
116+
* import { TxEnvelopeEip1559 } from 'ox'
117117
*
118-
* TransactionEnvelopeEip1559.assert({ chainId: 0 })
118+
* TxEnvelopeEip1559.assert({ chainId: 0 })
119119
* // @error: TransactionEnvelope.InvalidChainIdError: Chain ID "0" is invalid.
120120
* ```
121121
*/
@@ -135,9 +135,9 @@ export class InvalidChainIdError extends Errors.BaseError {
135135
*
136136
* @example
137137
* ```ts twoslash
138-
* import { TransactionEnvelopeEip1559 } from 'ox'
138+
* import { TxEnvelopeEip1559 } from 'ox'
139139
*
140-
* TransactionEnvelopeEip1559.deserialize('0x02c0')
140+
* TxEnvelopeEip1559.deserialize('0x02c0')
141141
* // @error: TransactionEnvelope.InvalidSerializedError: Invalid serialized transaction of type "eip1559" was provided.
142142
* // @error: Serialized Transaction: "0x02c0"
143143
* // @error: Missing Attributes: chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gas, to, value, data, accessList
@@ -171,9 +171,9 @@ export class InvalidSerializedError extends Errors.BaseError {
171171
*
172172
* @example
173173
* ```ts twoslash
174-
* import { TransactionEnvelopeEip1559 } from 'ox'
174+
* import { TxEnvelopeEip1559 } from 'ox'
175175
*
176-
* TransactionEnvelopeEip1559.assert({
176+
* TxEnvelopeEip1559.assert({
177177
* chainId: 1,
178178
* maxFeePerGas: 10n,
179179
* maxPriorityFeePerGas: 11n,

0 commit comments

Comments
 (0)