See the canonical spec:
.TypeScriptimport { Client, Wallet } from 'xrpl'; async function createOffer(): Promise<void> { const client = new Client('wss://honeycluster.dev'); await client.connect(); const wallet = Wallet.fromSeed('s...'); const prepared = await client.autofill({ TransactionType: 'OfferCreate', Account: wallet.address, TakerGets: '1000000', TakerPays: { currency: 'USD', issuer: 'r...issuer', value: '1' }, Flags: 0, }); const signed = wallet.sign(prepared); const res = await client.submitAndWait(signed.tx_blob); console.log(res); await client.disconnect(); } createOffer().catch(console.error);
| Field | Type | Required | Description |
|---|---|---|---|
Account | String | Yes | The address of the account creating the offer |
TakerGets | String/Object | Yes | What the taker gets if the offer is accepted |
TakerPays | String/Object | Yes | What the taker pays if the offer is accepted |
Flags | Number | No | Flags to enable/disable certain offer features |
Expiration | Number | No | Time after which the offer expires |
OfferSequence | Number | No | Sequence number of a previous offer to replace |
TakerGets/TakerPays:
For XRP: "1000000" (drops)
For issued currency: {"currency": "USD", "issuer": "r...", "value": "1"}
Flags:
0x00010000 (tfPassive): Offer won't consume offers that are better than this one
0x00020000 (tfImmediateOrCancel): Offer is either fully consumed or cancelled
0x00040000 (tfFillOrKill): Offer is either fully consumed or cancelled
0x00080000 (tfSell): Offer is a sell offer (affects order book placement)
Expiration:
Unix timestamp in seconds
If omitted, offer never expires
Creates a buy or sell offer on the decentralized exchange
TakerGets and TakerPays specify the exchange terms
Flags control offer behavior (e.g., passive, immediate-or-cancel)
Offers can be partially filled and remain active until consumed
Always use autofill to set fees and sequence safely when using the XRPL client library