@solana-mev-sdk/jito-client 0.2.8 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
# jito-client
|
|
1
|
+
# @solana-mev-sdk/jito-client
|
|
2
2
|
|
|
3
3
|
**Jito Block Engine client** for Solana: send bundles (up to 5 txs), optional tip transaction, and wait for confirmation.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install jito-client @solana/web3.js
|
|
8
|
+
npm install @solana-mev-sdk/jito-client @solana/web3.js
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
`@solana/web3.js` is a peer dependency.
|
|
12
|
-
|
|
13
11
|
## Usage
|
|
14
12
|
|
|
15
13
|
### Basic
|
|
16
14
|
|
|
17
15
|
```ts
|
|
18
16
|
import { Connection, Keypair } from "@solana/web3.js";
|
|
19
|
-
import { JitoClient } from "jito-client";
|
|
17
|
+
import { JitoClient } from "@solana-mev-sdk/jito-client";
|
|
20
18
|
|
|
21
19
|
const connection = new Connection("https://api.mainnet-beta.solana.com");
|
|
22
20
|
const client = new JitoClient(connection);
|
|
@@ -29,10 +27,10 @@ const ok = await client.sendBundleAndConfirm([signedTx1, signedTx2], tipPayer);
|
|
|
29
27
|
|
|
30
28
|
```ts
|
|
31
29
|
await client.sendBundleAndConfirm(txs, tipPayer, {
|
|
32
|
-
commitment: "finalized",
|
|
33
|
-
simulate: true,
|
|
34
|
-
uuid: "your-jito-uuid",
|
|
35
|
-
confirmationCommitment: "finalized",
|
|
30
|
+
commitment: "finalized", // blockhash commitment for tip tx
|
|
31
|
+
simulate: true, // simulate each tx before sending
|
|
32
|
+
uuid: "your-jito-uuid", // optional API uuid
|
|
33
|
+
confirmationCommitment: "finalized", // wait until last tx is finalized
|
|
36
34
|
});
|
|
37
35
|
```
|
|
38
36
|
|
|
@@ -46,30 +44,65 @@ if (result) {
|
|
|
46
44
|
}
|
|
47
45
|
```
|
|
48
46
|
|
|
49
|
-
### Custom tip
|
|
47
|
+
### Custom tip amount and logger
|
|
50
48
|
|
|
51
49
|
```ts
|
|
52
50
|
const client = new JitoClient(connection, {
|
|
53
|
-
tipAccount: "96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5",
|
|
54
51
|
tipSol: 0.00001,
|
|
55
52
|
logger: {
|
|
56
53
|
logError: (msg) => console.error(msg),
|
|
57
54
|
logWarning: (msg) => console.warn(msg),
|
|
55
|
+
logInfo: (msg) => console.log(msg),
|
|
58
56
|
},
|
|
59
57
|
});
|
|
60
58
|
```
|
|
61
59
|
|
|
62
60
|
## API
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
### `JitoClient`
|
|
63
|
+
|
|
64
|
+
**Constructor:** `new JitoClient(connection, config?)`
|
|
65
|
+
|
|
66
|
+
| Config | Type | Description |
|
|
67
|
+
|-------------------|-------------------|-------------|
|
|
68
|
+
| `tipAccount` | `string` | Tip destination when adding tip tx. Default from jito-tip-tx. |
|
|
69
|
+
| `tipSol` | `number` | Tip amount in SOL when adding tip tx. Default `0.00001`. |
|
|
70
|
+
| `logger` | `JitoClientLogger`| Optional `logError`, `logWarning`, `logInfo`. |
|
|
71
|
+
|
|
72
|
+
**Methods**
|
|
73
|
+
|
|
74
|
+
- **`sendBundle(txs, tipPayer, options?)`** – Send bundle; returns `{ bundleId, lastTx }` or `null`. Tip tx is appended if `tipPayer` is set.
|
|
75
|
+
- **`sendBundleAndConfirm(txs, tipPayer, options?)`** – Send and wait for last tx to reach `confirmationCommitment`; returns `boolean`.
|
|
76
|
+
- **`waitForBundleConfirmation(lastTx, commitment?)`** – Poll until last tx is `finalized` or `confirmed`. Default commitment `"finalized"`.
|
|
77
|
+
|
|
78
|
+
### `BundleOptions`
|
|
68
79
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
| Option | Type | Description |
|
|
81
|
+
|---------------------------|-----------|-------------|
|
|
82
|
+
| `commitment` | `"finalized" \| "confirmed" \| "processed"` | For tip tx blockhash. Default `"finalized"`. |
|
|
83
|
+
| `simulate` | `boolean` | Simulate each tx before sending. Default `true`. |
|
|
84
|
+
| `uuid` | `string \| null` | Optional Jito API uuid. |
|
|
85
|
+
| `confirmationCommitment` | `"finalized" \| "confirmed"` | When to consider bundle landed. Default `"finalized"`. |
|
|
86
|
+
|
|
87
|
+
### Constants
|
|
88
|
+
|
|
89
|
+
- **`JITO_BLOCK_ENGINE_HOSTS`** – Block engine hostnames (mainnet).
|
|
90
|
+
- **`JITO_TIP_ACCOUNT_DEFAULT`** – Default tip account address.
|
|
91
|
+
- **`JITO_TIP_SOL_DEFAULT`** – Default tip amount in SOL (`0.00001`).
|
|
92
|
+
|
|
93
|
+
### Types
|
|
94
|
+
|
|
95
|
+
- **`SendBundleResult`** – `{ bundleId, lastTx } | null`.
|
|
96
|
+
- **`JitoClientConfig`** – Constructor config.
|
|
97
|
+
- **`JitoClientLogger`** – Optional logger interface.
|
|
98
|
+
- **`OnTipSent`** – `(lamports: number) => void | Promise<void>` (for reporting tips to your API).
|
|
72
99
|
|
|
73
100
|
## License
|
|
74
101
|
|
|
75
102
|
MIT
|
|
103
|
+
|
|
104
|
+
## Links
|
|
105
|
+
|
|
106
|
+
- [Repository](https://github.com/solana-mev-sdk/jito-client)
|
|
107
|
+
- [Issues](https://github.com/solana-mev-sdk/jito-client/issues)
|
|
108
|
+
- [Jito docs](https://docs.jito.wtf/)
|