Skip to content

Commit 97b1d62

Browse files
committed
formatting edits
1 parent 486a5ad commit 97b1d62

File tree

1 file changed

+47
-29
lines changed

1 file changed

+47
-29
lines changed

.chain-interactions/send-transactions/with-sdks.md

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,25 @@ Sending transactions on Polkadot SDK-based blockchains involves constructing an
1212

1313
This guide demonstrates how to send transactions using five popular SDKs:
1414

15-
- **[Polkadot API (PAPI)](/reference/tools/papi/){target=\_blank}** - Modern TypeScript library with type-safe APIs
16-
- **[Polkadot.js API](/reference/tools/polkadot-js-api/){target=\_blank}** - Comprehensive JavaScript library (maintenance mode)
17-
- **[Dedot](/reference/tools/dedot/){target=\_blank}** - Lightweight TypeScript library optimized for performance
18-
- **[Python Substrate Interface](/reference/tools/py-substrate-interface/){target=\_blank}** - Python library for Substrate chains
19-
- **[Subxt](/reference/tools/subxt/){target=\_blank}** - Rust library with compile-time type safety
15+
- **[Polkadot API (PAPI)](/reference/tools/papi/){target=\_blank}**: Modern TypeScript library with type-safe APIs
16+
- **[Polkadot.js API](/reference/tools/polkadot-js-api/){target=\_blank}**: Comprehensive JavaScript library (maintenance mode)
17+
- **[Dedot](/reference/tools/dedot/){target=\_blank}**: Lightweight TypeScript library optimized for performance
18+
- **[Python Substrate Interface](/reference/tools/py-substrate-interface/){target=\_blank}**: Python library for Substrate chains
19+
- **[Subxt](/reference/tools/subxt/){target=\_blank}**: Rust library with compile-time type safety
2020

2121
Select your preferred SDK below to see complete, runnable examples that send balance transfer transactions on Polkadot Hub.
2222

23-
!!! note
24-
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, `INSERT_SENDER_MNEMONIC` with your account's mnemonic phrase, and `INSERT_DEST_ADDRESS` with the recipient address. For this example, you can use Polkadot Hub (`wss://polkadot-asset-hub-rpc.polkadot.io`).
25-
26-
!!! warning
27-
Never share your mnemonic phrase or private keys. The examples below use mnemonics for demonstration purposes only. In production, use secure key management solutions.
28-
2923
## Prerequisites
3024

3125
- Access to a Polkadot-SDK-compatible wallet, with its mnemonic phrase or private key.
3226
- A funded account on Polkadot Hub, with some testnet tokens. You can use the [Polkadot Faucet](https://faucet.polkadot.io/?parachain=1111){target=\_blank} to obtain test tokens.
3327

3428
## Send Transactions
3529

36-
=== "PAPI"
30+
!!! warning
31+
Never share your mnemonic phrase or private keys. The examples below use mnemonics for demonstration purposes only. In production, use secure key management solutions.
3732

38-
[Polkadot API (PAPI)](/reference/tools/papi/){target=\_blank} is a modern, type-safe TypeScript library optimized for light-client functionality.
33+
=== "PAPI"
3934

4035
**Prerequisites**
4136

@@ -68,12 +63,15 @@ Select your preferred SDK below to see complete, runnable examples that send bal
6863

6964
The following example constructs, signs, and submits a balance transfer transaction.
7065

71-
Create a file named `send-transfer.ts`:
66+
Create a file named `send-transfer.ts` and add the following code to it:
7267

7368
```typescript title="send-transfer.ts"
7469
--8<-- "code/chain-interactions/send-transactions/with-sdks/papi/send-transfer.ts"
7570
```
7671

72+
!!! note
73+
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, `INSERT_SENDER_MNEMONIC` with your account's mnemonic phrase, and `INSERT_DEST_ADDRESS` with the recipient address. For this example, you can use Polkadot Hub (`wss://polkadot-asset-hub-rpc.polkadot.io`).
74+
7775
Run the script:
7876

7977
```bash
@@ -89,8 +87,6 @@ Select your preferred SDK below to see complete, runnable examples that send bal
8987
!!! warning "Maintenance Mode Only"
9088
The Polkadot.js API is no longer actively developed. New projects should use [PAPI](/reference/tools/papi/){target=\_blank} or [Dedot](/reference/tools/dedot/){target=\_blank} as actively maintained alternatives.
9189

92-
[Polkadot.js API](/reference/tools/polkadot-js-api/){target=\_blank} is a comprehensive JavaScript library with extensive ecosystem support.
93-
9490
**Prerequisites**
9591

9692
- [Node.js](https://nodejs.org/){target=\_blank} v18 or higher
@@ -115,12 +111,15 @@ Select your preferred SDK below to see complete, runnable examples that send bal
115111

116112
The following example constructs, signs, and submits a balance transfer transaction.
117113

118-
Create a file named `send-transfer.js`:
114+
Create a file named `send-transfer.js` and add the following code:
119115

120116
```javascript title="send-transfer.js"
121117
--8<-- "code/chain-interactions/send-transactions/with-sdks/pjs/send-transfer.js"
122118
```
123119

120+
!!! note
121+
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, `INSERT_SENDER_MNEMONIC` with your account's mnemonic phrase, and `INSERT_DEST_ADDRESS` with the recipient address. For this example, you can use Polkadot Hub (`wss://polkadot-asset-hub-rpc.polkadot.io`).
122+
124123
Run the script:
125124

126125
```bash
@@ -133,8 +132,6 @@ Select your preferred SDK below to see complete, runnable examples that send bal
133132

134133
=== "Dedot"
135134

136-
[Dedot](/reference/tools/dedot/){target=\_blank} is a next-generation TypeScript client that's lightweight, tree-shakable, and maintains API compatibility with Polkadot.js.
137-
138135
**Prerequisites**
139136

140137
- [Node.js](https://nodejs.org/){target=\_blank} v18 or higher
@@ -160,12 +157,15 @@ Select your preferred SDK below to see complete, runnable examples that send bal
160157

161158
The following example constructs, signs, and submits a balance transfer transaction.
162159

163-
Create a file named `send-transfer.ts`:
160+
Create a file named `send-transfer.ts` and add the following code to it:
164161

165162
```typescript title="send-transfer.ts"
166163
--8<-- "code/chain-interactions/send-transactions/with-sdks/dedot/send-transfer.ts"
167164
```
168165

166+
!!! note
167+
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, `INSERT_SENDER_MNEMONIC` with your account's mnemonic phrase, and `INSERT_DEST_ADDRESS` with the recipient address. For this example, you can use Polkadot Hub (`wss://polkadot-asset-hub-rpc.polkadot.io`).
168+
169169
Run the script:
170170

171171
```bash
@@ -176,9 +176,7 @@ Select your preferred SDK below to see complete, runnable examples that send bal
176176

177177
--8<-- 'code/chain-interactions/send-transactions/with-sdks/dedot/send-transfer-ts.html'
178178

179-
=== "Python"
180-
181-
[Python Substrate Interface](/reference/tools/py-substrate-interface/){target=\_blank} provides a Python library for interacting with Substrate-based chains.
179+
=== "Python Substrate Interface"
182180

183181
**Prerequisites**
184182

@@ -204,12 +202,15 @@ Select your preferred SDK below to see complete, runnable examples that send bal
204202

205203
The following example constructs, signs, and submits a balance transfer transaction.
206204

207-
Create a file named `send_transfer.py`:
205+
Create a file named `send_transfer.py` and add the following code to it:
208206

209207
```python title="send_transfer.py"
210208
--8<-- "code/chain-interactions/send-transactions/with-sdks/psi/send_transfer.py"
211209
```
212210

211+
!!! note
212+
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, `INSERT_SENDER_MNEMONIC` with your account's mnemonic phrase, and `INSERT_DEST_ADDRESS` with the recipient address. For this example, you can use Polkadot Hub (`wss://polkadot-asset-hub-rpc.polkadot.io`).
213+
213214
Run the script:
214215

215216
```bash
@@ -259,12 +260,15 @@ Select your preferred SDK below to see complete, runnable examples that send bal
259260

260261
The following example constructs, signs, and submits a balance transfer transaction.
261262

262-
Create a file at `src/bin/send_transfer.rs`:
263+
Create a file at `src/bin/send_transfer.rs` and add the following code to it:
263264

264265
```rust title="src/bin/send_transfer.rs"
265266
--8<-- "code/chain-interactions/send-transactions/with-sdks/subxt/src/bin/send_transfer.rs"
266267
```
267268

269+
!!! note
270+
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, `INSERT_SENDER_MNEMONIC` with your account's mnemonic phrase, and `INSERT_DEST_ADDRESS` with the recipient address. For this example, you can use Polkadot Hub (`wss://polkadot-asset-hub-rpc.polkadot.io`).
271+
268272
Run the script:
269273

270274
```bash
@@ -277,8 +281,22 @@ Select your preferred SDK below to see complete, runnable examples that send bal
277281

278282
## Where to Go Next
279283

280-
Now that you understand how to send transactions, explore these related topics:
284+
<div class="grid cards" markdown>
285+
286+
- <span class="badge guide">Guide</span> **Query On-Chain State**
287+
288+
---
289+
290+
Learn how to query storage and runtime data with the SDKs used in this guide.
291+
292+
[:octicons-arrow-right-24: Get Started](/chain-interactions/query-data/query-sdks/)
293+
294+
- <span class="badge guide">Guide</span> **Calculate Transaction Fees**
295+
296+
---
297+
298+
Estimate fees before sending transactions
299+
300+
[:octicons-arrow-right-24: Get Started](/chain-interactions/send-transactions/calculate-transaction-fees/)
281301

282-
- **[Query On-Chain State](/chain-interactions/query-data/query-sdks/)** - Learn to query storage and runtime data
283-
- **[Calculate Transaction Fees](/chain-interactions/send-transactions/calculate-transaction-fees/)** - Estimate fees before sending transactions
284-
- **[SDK Reference Pages](/reference/tools/papi/)** - Detailed documentation for each SDK
302+
</div>

0 commit comments

Comments
 (0)