Skip to content

Commit

Permalink
chore: up readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Oct 28, 2024
1 parent 8c083d2 commit c4bff7d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ As an unopinionated Standard Library, it is designed to be used by higher-level
The example below demonstrates how to construct, sign, and broadcast a transaction envelope using Ox:

```ts
import { Provider, Secp256k1, TransactionEnvelope, Value } from 'ox'
import { Provider, Secp256k1, TransactionEnvelopeEip1559, Value } from 'ox'

// 1. Construct a transaction envelope.
const envelope = TransactionEnvelope.from({
const envelope = TransactionEnvelopeEip1559.from({
chainId: 1,
gas: 21000n,
nonce: 0n,
Expand All @@ -59,13 +59,13 @@ const envelope = TransactionEnvelope.from({
})

// 2. Get the signing payload for the envelope.
const payload = TransactionEnvelope.getSignPayload(envelope)
const payload = TransactionEnvelopeEip1559.getSignPayload(envelope)

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

// 4. Serialize the envelope with the signature.
const serialized = TransactionEnvelope.serialize(envelope, { signature })
const serialized = TransactionEnvelopeEip1559.serialize(envelope, { signature })

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

0 comments on commit c4bff7d

Please sign in to comment.