Skip to content

Commit 0ee4bdc

Browse files
feat: Xample cancel transaction (#7)
1 parent 973a585 commit 0ee4bdc

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Cancel Relayer Transaction By Id Example
3+
*
4+
* This example demonstrates how to use the OpenZeppelin Relayer SDK to cancel a relayer transaction by id.
5+
*
6+
* IMPORTANT: This is provided as a demonstration only. For production use:
7+
* - Use proper error handling and transaction confirmation checks
8+
* - Implement appropriate security measures for API keys and tokens
9+
* - Consider rate limiting and monitoring for production applications
10+
* - Test thoroughly on devnet/testnet before using on mainnet
11+
* - Use https connection for production applications
12+
*
13+
* Usage:
14+
* ts-node cancelTransactionById.ts
15+
*/
16+
import { Configuration, RelayersApi } from '../../src';
17+
18+
// example dev config
19+
const config = new Configuration({
20+
basePath: 'http://localhost:8080',
21+
accessToken: 'Bearer example-123456',
22+
});
23+
24+
const relayersApi = new RelayersApi(config);
25+
26+
const relayer_id = 'sepolia-example';
27+
28+
const transaction_id = '305ff83d-6653-465f-8fa3-e8a46271fb83';
29+
30+
relayersApi
31+
.cancelTransaction(relayer_id, transaction_id)
32+
.then((transaction) => console.log(JSON.stringify(transaction.data, null, 2)))
33+
.catch(console.error);

0 commit comments

Comments
 (0)