Skip to content

Commit b98d808

Browse files
docs: Add more Stellar transaction submission examples (#424)
Signed-off-by: Dylan Kilkenny <dylankilkenny95@gmail.com>
1 parent 7e7fb4f commit b98d808

1 file changed

Lines changed: 53 additions & 2 deletions

File tree

docs/modules/ROOT/pages/stellar.adoc

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,10 @@ The relayer supports three ways to submit transactions:
196196

197197
1. **Operations-based**: Build a transaction by specifying the `operations` array (recommended for most use cases)
198198
2. **Transaction XDR (unsigned)**: Submit a pre-built unsigned transaction using `transaction_xdr` field (advanced use case)
199-
3. **Transaction XDR (signed) with fee bump**: Submit a signed transaction using `transaction_xdr` with `fee_bump: true` to wrap it in a fee bump transaction
199+
3. **Transaction XDR (signed)**: Submit a signed transaction using `transaction_xdr` with `fee_bump: true` (required for signed XDR) to wrap it in a fee bump transaction
200+
201+
==== Example 1: Operations-based Transaction
200202

201-
Example: Send Transaction
202203
[source,bash]
203204
----
204205
curl --location --request POST 'http://localhost:8080/api/v1/relayers/<stellar_relayer_id>/transactions' \
@@ -218,6 +219,56 @@ curl --location --request POST 'http://localhost:8080/api/v1/relayers/<stellar_r
218219
}'
219220
----
220221

222+
==== Example 2: Unsigned Transaction XDR
223+
224+
Submit a pre-built unsigned transaction. The relayer will sign it with its configured signer:
225+
226+
[source,bash]
227+
----
228+
curl --location --request POST 'http://localhost:8080/api/v1/relayers/<stellar_relayer_id>/transactions' \
229+
--header 'Authorization: Bearer <api_key>' \
230+
--header 'Content-Type: application/json' \
231+
--data-raw '{
232+
"network": "testnet",
233+
"transaction_xdr": "AAAAAgAAAACige4lTdwSB/sto4SniEdJ2kOa2X65s5bqkd40J4DjSwAAAGQAAHAkAAAADgAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAKKB7iVN3BIH+y2jhKeIR0naQ5rZfrmzluqR3jQngONLAAAAAAAAAAAAD0JAAAAAAAAAAAA="
234+
}'
235+
----
236+
237+
The `transaction_xdr` field should contain a base64-encoded unsigned transaction envelope. This is useful when:
238+
- You need precise control over transaction structure
239+
- You want to use advanced Stellar features not exposed via the operations API
240+
241+
==== Example 3: Signed Transaction XDR
242+
243+
Submit a pre-signed transaction with fee bump wrapper. **Note: `fee_bump: true` is required when submitting signed XDR**:
244+
245+
[source,bash]
246+
----
247+
curl --location --request POST 'http://localhost:8080/api/v1/relayers/<stellar_relayer_id>/transactions' \
248+
--header 'Authorization: Bearer <api_key>' \
249+
--header 'Content-Type: application/json' \
250+
--data-raw '{
251+
"network": "testnet",
252+
"transaction_xdr": "AAAAAgAAAABjc+mbXCnvmVk4lxqVl7s0LAz5slXqmkHBg8PpH7p3DgAAAGQABpK0AAAACQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAGN0qQBW8x3mfbwGGYndt2uq4O4sZPUrDx5HlwuQke9zAAAAAAAAAAAAAA9CAAAAAQAAAAA=",
253+
"fee_bump": true,
254+
"max_fee": 10000000
255+
}'
256+
----
257+
258+
The fee bump feature is useful when:
259+
- You have a pre-signed transaction from another system or wallet
260+
- You want the relayer to pay transaction fees on behalf of the original signer
261+
- You need to increase the fee for a transaction to ensure timely execution
262+
263+
[IMPORTANT]
264+
====
265+
When using `transaction_xdr`:
266+
- The XDR must be properly formatted and valid for the target network
267+
- For unsigned XDR, the relayer will add its signature before submission
268+
- **For signed XDR, `fee_bump: true` is mandatory** - the relayer requires this to wrap the signed transaction in a fee bump envelope
269+
- The `max_fee` parameter (in stroops) controls the maximum fee for fee bump transactions (defaults to 1,000,000 = 0.1 XLM)
270+
====
271+
221272
See link:https://release-v1-0-0%2D%2Dopenzeppelin-relayer.netlify.app/api_docs.html[API Reference^] for full details and examples.
222273

223274
=== Asset Types

0 commit comments

Comments
 (0)